@itwin/tree-widget-react 4.0.0-alpha.2 → 4.0.0-alpha.20
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 +281 -1
- package/README.md +190 -63
- package/lib/esm/tree-widget-react/TreeWidget.d.ts +7 -4
- package/lib/esm/tree-widget-react/TreeWidget.js +32 -12
- package/lib/esm/tree-widget-react/TreeWidget.js.map +1 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetComponentImpl.d.ts +7 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetComponentImpl.js +22 -23
- package/lib/esm/tree-widget-react/components/TreeWidgetComponentImpl.js.map +1 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js +4 -3
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/ErrorState.js +4 -3
- 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 -1
- package/lib/esm/tree-widget-react/components/tree-header/SearchBox.js +6 -6
- 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 +3 -2
- package/lib/esm/tree-widget-react/components/tree-header/SelectableTree.d.ts +4 -4
- package/lib/esm/tree-widget-react/components/tree-header/SelectableTree.js +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/SelectableTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.css +1 -0
- package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.d.ts +12 -5
- package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.js +13 -9
- 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 +3 -3
- 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 +11 -7
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +64 -14
- 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 +8 -6
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js +4 -4
- 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 +41 -8
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +700 -125
- 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 +18 -7
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +124 -83
- 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 +70 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +504 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.d.ts +41 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js +50 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseFilteredPaths.d.ts +27 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseFilteredPaths.js +136 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseFilteredPaths.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.d.ts +54 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js +291 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHandler.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.d.ts +64 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.js +94 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/CategoriesTreeVisibilityHelper.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/FilteredTree.d.ts +36 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/FilteredTree.js +219 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/visibility/FilteredTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTree.d.ts +12 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTree.js +19 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.d.ts +30 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.js +47 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeComponent.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.d.ts +45 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js +569 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeDefinition.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeIcon.d.ts +6 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeIcon.js +33 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/ClassificationsTreeIcon.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.d.ts +24 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.js +115 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.d.ts +44 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.js +61 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/UseClassificationsTreeDefinition.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.d.ts +50 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js +364 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.d.ts +19 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.js +32 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseFilteredPaths.d.ts +20 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseFilteredPaths.js +53 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseFilteredPaths.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.d.ts +37 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js +177 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHandler.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.d.ts +55 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.js +53 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/ClassificationsTreeVisibilityHelper.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/FilteredTree.d.ts +32 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/FilteredTree.js +168 -0
- package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/visibility/FilteredTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.d.ts +11 -23
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js +22 -76
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.d.ts +28 -4
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.js +73 -2
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/TreeErrors.js +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/TreeErrors.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/TreeWidgetViewport.d.ts +186 -0
- package/lib/esm/tree-widget-react/components/trees/common/TreeWidgetViewport.js +79 -0
- package/lib/esm/tree-widget-react/components/trees/common/TreeWidgetViewport.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.d.ts +15 -7
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js +33 -22
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.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 +45 -23
- package/lib/esm/tree-widget-react/components/trees/common/Utils.js +110 -44
- 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.d.ts +2 -3
- package/lib/esm/tree-widget-react/components/trees/common/components/BaseTreeRenderer.js +4 -5
- 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 +25 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.d.ts +27 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.js +47 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.js.map +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/common/components/SkeletonTree.css +16 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.d.ts +7 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.js +19 -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 +9 -12
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js +55 -38
- 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.css +2 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.d.ts +24 -8
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js +41 -25
- 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.d.ts +6 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js +13 -4
- 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 +6 -5
- package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.js +7 -7
- 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.d.ts +5 -5
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.js +10 -6
- 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.d.ts +5 -3
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js +17 -15
- 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 +74 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.js +207 -0
- 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 +43 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.js +47 -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 +12 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.js +112 -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} +10 -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} +4 -8
- package/lib/esm/tree-widget-react/components/trees/common/internal/Tooltip.js +18 -0
- 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/{tree-header/SearchBox.css → trees/common/internal/Types.js} +2 -4
- 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/UseActiveTreeWidgetViewport.d.ts +6 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseActiveTreeWidgetViewport.js +24 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseActiveTreeWidgetViewport.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchiesLocalization.d.ts → internal/UseHierarchiesLocalization.d.ts} +3 -2
- 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 -1
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchyFiltering.js → internal/UseHierarchyFiltering.js} +5 -4
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseHierarchyFiltering.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.d.ts +17 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.js +32 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelAccess.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 +70 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js +172 -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/common/internal/VisibilityChangeEventListener.js +60 -0
- 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 +39 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js +160 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useGuid.d.ts +3 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useGuid.js +12 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useGuid.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.d.ts +68 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.js +170 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseCachedVisibility.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.d.ts +20 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js +46 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/useTreeHooks/UseIdsCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseFilteredTree.d.ts +91 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseFilteredTree.js +112 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseFilteredTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.d.ts +236 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.js +600 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/visibility/BaseVisibilityHelper.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/useGuid.d.ts +2 -0
- package/lib/esm/tree-widget-react/components/trees/common/useGuid.js +11 -0
- package/lib/esm/tree-widget-react/components/trees/common/useGuid.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 +29 -20
- 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 +2 -6
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +2 -2
- 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 +5 -6
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js +36 -21
- 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 +48 -36
- 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 +2 -6
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js +2 -2
- 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 -4
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +80 -74
- 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 +7 -10
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +45 -36
- 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 +16 -5
- package/lib/esm/tree-widget-react/components/trees/index.js +16 -4
- 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 +3 -3
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js +3 -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.d.ts +3 -3
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +34 -24
- 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 +14 -7
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js +11 -7
- 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 +24 -20
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +193 -154
- 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 +60 -10
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +97 -238
- 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 +22 -25
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +280 -298
- 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/ModelsTreeNode.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseFilteredPaths.d.ts +41 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseFilteredPaths.js +253 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseFilteredPaths.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/FilteredTree.d.ts +27 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/FilteredTree.js +148 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/FilteredTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.d.ts +76 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js +269 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHandler.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.d.ts +53 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.js +71 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/visibility/ModelsTreeVisibilityHelper.js.map +1 -0
- package/lib/esm/tree-widget-react-internal.d.ts +12 -0
- package/lib/esm/tree-widget-react-internal.js +18 -0
- package/lib/esm/tree-widget-react-internal.js.map +1 -0
- package/lib/public/locales/en/TreeWidget.json +41 -54
- package/package.json +76 -79
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.d.ts +0 -28
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.js +0 -87
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.d.ts +0 -7
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.js +0 -66
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.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 +0 -24
- package/lib/esm/tree-widget-react/components/trees/common/Tooltip.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseActiveViewport.d.ts +0 -7
- package/lib/esm/tree-widget-react/components/trees/common/UseActiveViewport.js +0 -21
- 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/common/UseNodeHighlighting.d.ts +0 -20
- package/lib/esm/tree-widget-react/components/trees/common/UseNodeHighlighting.js +0 -127
- package/lib/esm/tree-widget-react/components/trees/common/UseNodeHighlighting.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTreeContent.d.ts +0 -7
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTreeContent.js +0 -12
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTreeContent.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 +0 -138
- 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/FilteredTree.d.ts +0 -25
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js +0 -173
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +0 -106
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +0 -663
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.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 +0 -48
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.js.map +0 -1
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { defer, forkJoin, from, map, mergeMap, of, reduce, shareReplay } from "rxjs";
|
|
6
|
+
import { Guid, Id64 } from "@itwin/core-bentley";
|
|
7
|
+
import { CLASS_NAME_Classification, CLASS_NAME_ClassificationSystem, CLASS_NAME_ClassificationTable, CLASS_NAME_DrawingCategory, CLASS_NAME_ElementHasClassifications, CLASS_NAME_GeometricElement2d, CLASS_NAME_GeometricElement3d, CLASS_NAME_SpatialCategory, } from "../../common/internal/ClassNameDefinitions.js";
|
|
8
|
+
import { ModelCategoryElementsCountCache } from "../../common/internal/ModelCategoryElementsCountCache.js";
|
|
9
|
+
import { getDistinctMapValues, joinId64Arg } from "../../common/internal/Utils.js";
|
|
10
|
+
/** @internal */
|
|
11
|
+
export class ClassificationsTreeIdsCache {
|
|
12
|
+
#categoryElementCounts;
|
|
13
|
+
#elementModelsCategories;
|
|
14
|
+
#modelWithCategoryModeledElements;
|
|
15
|
+
#classificationInfos;
|
|
16
|
+
#filteredElementsData;
|
|
17
|
+
#queryExecutor;
|
|
18
|
+
#hierarchyConfig;
|
|
19
|
+
#componentId;
|
|
20
|
+
#componentName;
|
|
21
|
+
constructor(queryExecutor, hierarchyConfig, componentId) {
|
|
22
|
+
this.#queryExecutor = queryExecutor;
|
|
23
|
+
this.#hierarchyConfig = hierarchyConfig;
|
|
24
|
+
this.#componentId = componentId ?? Guid.createValue();
|
|
25
|
+
this.#componentName = "ClassificationsTreeIdsCache";
|
|
26
|
+
this.#categoryElementCounts = new ModelCategoryElementsCountCache(this.#queryExecutor, ["BisCore.GeometricElement2d", "BisCore.GeometricElement3d"], this.#componentId);
|
|
27
|
+
}
|
|
28
|
+
[Symbol.dispose]() {
|
|
29
|
+
this.#categoryElementCounts[Symbol.dispose]();
|
|
30
|
+
}
|
|
31
|
+
queryElementModelCategories() {
|
|
32
|
+
return defer(() => {
|
|
33
|
+
const query = `
|
|
34
|
+
SELECT * FROM (
|
|
35
|
+
SELECT '3d' type, this.Model.Id modelId, this.Category.Id categoryId
|
|
36
|
+
FROM BisCore.GeometricModel m
|
|
37
|
+
JOIN BisCore.GeometricElement3d this ON m.ECInstanceId = this.Model.Id
|
|
38
|
+
WHERE this.Parent.Id IS NULL AND m.IsPrivate = false
|
|
39
|
+
GROUP BY modelId, categoryId
|
|
40
|
+
)
|
|
41
|
+
UNION ALL
|
|
42
|
+
SELECT * FROM (
|
|
43
|
+
SELECT '2d' type, this.Model.Id modelId, this.Category.Id categoryId
|
|
44
|
+
FROM BisCore.GeometricModel m
|
|
45
|
+
JOIN BisCore.GeometricElement2d this ON m.ECInstanceId = this.Model.Id
|
|
46
|
+
WHERE this.Parent.Id IS NULL AND m.IsPrivate = false
|
|
47
|
+
GROUP BY modelId, categoryId
|
|
48
|
+
)
|
|
49
|
+
`;
|
|
50
|
+
return this.#queryExecutor.createQueryReader({ ecsql: query }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded", restartToken: `${this.#componentName}/${this.#componentId}/element-models-and-categories` });
|
|
51
|
+
}).pipe(map((row) => {
|
|
52
|
+
return { modelId: row.modelId, categoryId: row.categoryId, type: row.type };
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
getElementModelsCategories() {
|
|
56
|
+
this.#elementModelsCategories ??= forkJoin({
|
|
57
|
+
modelCategories: this.queryElementModelCategories().pipe(reduce((acc, queriedCategory) => {
|
|
58
|
+
let modelEntry = acc.get(queriedCategory.modelId);
|
|
59
|
+
if (modelEntry === undefined) {
|
|
60
|
+
modelEntry = { category2dIds: new Set(), category3dIds: new Set() };
|
|
61
|
+
acc.set(queriedCategory.modelId, modelEntry);
|
|
62
|
+
}
|
|
63
|
+
switch (queriedCategory.type) {
|
|
64
|
+
case "2d":
|
|
65
|
+
modelEntry.category2dIds.add(queriedCategory.categoryId);
|
|
66
|
+
break;
|
|
67
|
+
case "3d":
|
|
68
|
+
modelEntry.category3dIds.add(queriedCategory.categoryId);
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
return acc;
|
|
72
|
+
}, new Map())),
|
|
73
|
+
modelWithCategoryModeledElements: this.getModelWithCategoryModeledElements(),
|
|
74
|
+
}).pipe(map(({ modelCategories, modelWithCategoryModeledElements }) => {
|
|
75
|
+
const result = new Map();
|
|
76
|
+
const subModels = getDistinctMapValues(modelWithCategoryModeledElements);
|
|
77
|
+
for (const [modelId, modelEntry] of modelCategories) {
|
|
78
|
+
const isSubModel = subModels.has(modelId);
|
|
79
|
+
result.set(modelId, { category2dIds: modelEntry.category2dIds, category3dIds: modelEntry.category3dIds, isSubModel });
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
}), shareReplay());
|
|
83
|
+
return this.#elementModelsCategories;
|
|
84
|
+
}
|
|
85
|
+
queryModeledElements() {
|
|
86
|
+
return defer(() => {
|
|
87
|
+
const query = `
|
|
88
|
+
SELECT
|
|
89
|
+
pe.ECInstanceId modeledElementId,
|
|
90
|
+
pe.Category.Id categoryId,
|
|
91
|
+
pe.Model.Id modelId
|
|
92
|
+
FROM BisCore.GeometricModel m
|
|
93
|
+
JOIN BisCore.GeometricElement3d pe ON pe.ECInstanceId = m.ModeledElement.Id
|
|
94
|
+
WHERE
|
|
95
|
+
m.IsPrivate = false
|
|
96
|
+
AND m.ECInstanceId IN (SELECT Model.Id FROM BisCore.Element)
|
|
97
|
+
UNION ALL
|
|
98
|
+
SELECT
|
|
99
|
+
pe.ECInstanceId modeledElementId,
|
|
100
|
+
pe.Category.Id categoryId,
|
|
101
|
+
pe.Model.Id modelId
|
|
102
|
+
FROM BisCore.GeometricModel m
|
|
103
|
+
JOIN BisCore.GeometricElement2d pe ON pe.ECInstanceId = m.ModeledElement.Id
|
|
104
|
+
WHERE
|
|
105
|
+
m.IsPrivate = false
|
|
106
|
+
AND m.ECInstanceId IN (SELECT Model.Id FROM BisCore.Element)
|
|
107
|
+
`;
|
|
108
|
+
return this.#queryExecutor.createQueryReader({ ecsql: query }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded", restartToken: `${this.#componentName}/${this.#componentId}/modeled-elements` });
|
|
109
|
+
}).pipe(map((row) => {
|
|
110
|
+
return { modelId: row.modelId, categoryId: row.categoryId, modeledElementId: row.modeledElementId, rootCategoryId: row.rootCategoryId };
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
getModelWithCategoryModeledElements() {
|
|
114
|
+
this.#modelWithCategoryModeledElements ??= this.queryModeledElements().pipe(reduce((acc, { modelId, categoryId, modeledElementId }) => {
|
|
115
|
+
const key = `${modelId}-${categoryId}`;
|
|
116
|
+
const entry = acc.get(key);
|
|
117
|
+
if (entry === undefined) {
|
|
118
|
+
acc.set(key, new Set([modeledElementId]));
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
entry.add(modeledElementId);
|
|
122
|
+
}
|
|
123
|
+
return acc;
|
|
124
|
+
}, new Map()), shareReplay());
|
|
125
|
+
return this.#modelWithCategoryModeledElements;
|
|
126
|
+
}
|
|
127
|
+
getCategoriesModeledElements(modelId, categoryIds) {
|
|
128
|
+
return this.getModelWithCategoryModeledElements().pipe(mergeMap((modelWithCategoryModeledElements) => from(Id64.iterable(categoryIds)).pipe(reduce((acc, categoryId) => {
|
|
129
|
+
const entry = modelWithCategoryModeledElements.get(`${modelId}-${categoryId}`);
|
|
130
|
+
if (entry !== undefined) {
|
|
131
|
+
acc.push(...entry);
|
|
132
|
+
}
|
|
133
|
+
return acc;
|
|
134
|
+
}, new Array()))));
|
|
135
|
+
}
|
|
136
|
+
getCategoriesElementModels(categoryIds, includeSubModels) {
|
|
137
|
+
return this.getElementModelsCategories().pipe(mergeMap((elementModelsCategories) => from(Id64.iterable(categoryIds)).pipe(reduce((acc, categoryId) => {
|
|
138
|
+
for (const [modelId, { category2dIds, category3dIds, isSubModel }] of elementModelsCategories) {
|
|
139
|
+
if ((includeSubModels || !isSubModel) && (category2dIds.has(categoryId) || category3dIds.has(categoryId))) {
|
|
140
|
+
let categoryModels = acc.get(categoryId);
|
|
141
|
+
if (!categoryModels) {
|
|
142
|
+
categoryModels = new Set();
|
|
143
|
+
acc.set(categoryId, categoryModels);
|
|
144
|
+
}
|
|
145
|
+
categoryModels.add(modelId);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return acc;
|
|
149
|
+
}, new Map()))));
|
|
150
|
+
}
|
|
151
|
+
getModelCategoryIds(modelId) {
|
|
152
|
+
return this.getElementModelsCategories().pipe(map((elementModelsCategories) => {
|
|
153
|
+
return {
|
|
154
|
+
drawing: Array.from(elementModelsCategories.get(modelId)?.category2dIds ?? []),
|
|
155
|
+
spatial: Array.from(elementModelsCategories.get(modelId)?.category3dIds ?? []),
|
|
156
|
+
};
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
getAllCategories() {
|
|
160
|
+
return this.getElementModelsCategories().pipe(mergeMap((modelsCategoriesInfo) => modelsCategoriesInfo.values()), reduce((acc, { category2dIds, category3dIds }) => {
|
|
161
|
+
category2dIds.forEach((id) => acc.drawing.add(id));
|
|
162
|
+
category3dIds.forEach((id) => acc.spatial.add(id));
|
|
163
|
+
return acc;
|
|
164
|
+
}, { drawing: new Set(), spatial: new Set() }));
|
|
165
|
+
}
|
|
166
|
+
hasSubModel(elementId) {
|
|
167
|
+
return this.getElementModelsCategories().pipe(map((elementModelsCategories) => elementModelsCategories.has(elementId)));
|
|
168
|
+
}
|
|
169
|
+
getCategoryElementsCount(modelId, categoryId) {
|
|
170
|
+
return this.#categoryElementCounts.getCategoryElementsCount(modelId, categoryId);
|
|
171
|
+
}
|
|
172
|
+
queryClassifications() {
|
|
173
|
+
return defer(() => {
|
|
174
|
+
const CLASSIFICATIONS_CTE = "Classifications";
|
|
175
|
+
const ctes = [
|
|
176
|
+
`
|
|
177
|
+
${CLASSIFICATIONS_CTE}(ClassificationId, ClassificationTableId, ParentClassificationId) AS (
|
|
178
|
+
SELECT
|
|
179
|
+
cl.ECInstanceId,
|
|
180
|
+
ct.ECInstanceId,
|
|
181
|
+
NULL
|
|
182
|
+
FROM ${CLASS_NAME_Classification} cl
|
|
183
|
+
JOIN ${CLASS_NAME_ClassificationTable} ct ON ct.ECInstanceId = cl.Model.Id
|
|
184
|
+
JOIN ${CLASS_NAME_ClassificationSystem} cs ON cs.ECInstanceId = ct.Parent.Id
|
|
185
|
+
WHERE
|
|
186
|
+
cs.CodeValue = '${this.#hierarchyConfig.rootClassificationSystemCode}'
|
|
187
|
+
AND NOT ct.IsPrivate
|
|
188
|
+
AND NOT cl.IsPrivate
|
|
189
|
+
AND cl.Parent.Id IS NULL
|
|
190
|
+
|
|
191
|
+
UNION ALL
|
|
192
|
+
|
|
193
|
+
SELECT
|
|
194
|
+
cl.ECInstanceId,
|
|
195
|
+
NULL,
|
|
196
|
+
cl.Parent.Id
|
|
197
|
+
FROM
|
|
198
|
+
${CLASSIFICATIONS_CTE} cte
|
|
199
|
+
JOIN ${CLASS_NAME_Classification} cl ON cl.Parent.Id = cte.ClassificationId
|
|
200
|
+
WHERE
|
|
201
|
+
NOT cl.IsPrivate
|
|
202
|
+
)
|
|
203
|
+
`,
|
|
204
|
+
];
|
|
205
|
+
const ecsql = `
|
|
206
|
+
SELECT
|
|
207
|
+
cl.ClassificationId id,
|
|
208
|
+
cl.ClassificationTableId tableId,
|
|
209
|
+
cl.ParentClassificationId parentId,
|
|
210
|
+
(
|
|
211
|
+
SELECT group_concat(IdToHex(cat.ECInstanceId))
|
|
212
|
+
FROM ${CLASS_NAME_GeometricElement2d} e
|
|
213
|
+
JOIN ${CLASS_NAME_DrawingCategory} cat ON cat.ECInstanceId = e.Category.Id
|
|
214
|
+
JOIN ${CLASS_NAME_ElementHasClassifications} ehc ON ehc.SourceECInstanceId = e.ECInstanceId
|
|
215
|
+
WHERE e.Parent.Id IS NULL AND NOT cat.IsPrivate AND ehc.TargetECInstanceId = cl.ClassificationId
|
|
216
|
+
GROUP BY ehc.TargetECInstanceId
|
|
217
|
+
) relatedCategories2d,
|
|
218
|
+
(
|
|
219
|
+
SELECT group_concat(IdToHex(cat.ECInstanceId))
|
|
220
|
+
FROM ${CLASS_NAME_GeometricElement3d} e
|
|
221
|
+
JOIN ${CLASS_NAME_SpatialCategory} cat ON cat.ECInstanceId = e.Category.Id
|
|
222
|
+
JOIN ${CLASS_NAME_ElementHasClassifications} ehc ON ehc.SourceECInstanceId = e.ECInstanceId
|
|
223
|
+
WHERE e.Parent.Id IS NULL AND NOT cat.IsPrivate AND ehc.TargetECInstanceId = cl.ClassificationId
|
|
224
|
+
GROUP BY ehc.TargetECInstanceId
|
|
225
|
+
) relatedCategories3d
|
|
226
|
+
FROM ${CLASSIFICATIONS_CTE} cl
|
|
227
|
+
`;
|
|
228
|
+
return this.#queryExecutor.createQueryReader({ ctes, ecsql }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded", restartToken: `${this.#componentName}/${this.#componentId}/classifications` });
|
|
229
|
+
}).pipe(map((row) => {
|
|
230
|
+
return {
|
|
231
|
+
id: row.id,
|
|
232
|
+
tableId: row.tableId,
|
|
233
|
+
parentId: row.parentId,
|
|
234
|
+
relatedCategories2d: row.relatedCategories2d ? row.relatedCategories2d.split(",") : [],
|
|
235
|
+
relatedCategories3d: row.relatedCategories3d ? row.relatedCategories3d.split(",") : [],
|
|
236
|
+
};
|
|
237
|
+
}));
|
|
238
|
+
}
|
|
239
|
+
getClassificationsInfo() {
|
|
240
|
+
this.#classificationInfos ??= this.queryClassifications().pipe(reduce((acc, { id, tableId, parentId, relatedCategories2d, relatedCategories3d }) => {
|
|
241
|
+
const tableOrParentId = tableId ?? parentId;
|
|
242
|
+
let parentInfo = acc.get(tableOrParentId);
|
|
243
|
+
if (!parentInfo) {
|
|
244
|
+
parentInfo = { childClassificationIds: [], relatedCategories2d: [], relatedCategories3d: [], parentClassificationOrTableId: undefined };
|
|
245
|
+
acc.set(tableOrParentId, parentInfo);
|
|
246
|
+
}
|
|
247
|
+
parentInfo.childClassificationIds.push(id);
|
|
248
|
+
let classificationEntry = acc.get(id);
|
|
249
|
+
if (!classificationEntry) {
|
|
250
|
+
classificationEntry = { childClassificationIds: [], relatedCategories2d, relatedCategories3d, parentClassificationOrTableId: tableOrParentId };
|
|
251
|
+
acc.set(id, classificationEntry);
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
classificationEntry.parentClassificationOrTableId = tableOrParentId;
|
|
255
|
+
}
|
|
256
|
+
return acc;
|
|
257
|
+
}, new Map()), shareReplay());
|
|
258
|
+
return this.#classificationInfos;
|
|
259
|
+
}
|
|
260
|
+
getAllContainedCategories(classificationOrTableIds) {
|
|
261
|
+
const result = { drawing: new Array(), spatial: new Array() };
|
|
262
|
+
if (Id64.sizeOf(classificationOrTableIds) === 0) {
|
|
263
|
+
return of(result);
|
|
264
|
+
}
|
|
265
|
+
return this.getClassificationsInfo().pipe(mergeMap((classificationsInfo) => from(Id64.iterable(classificationOrTableIds)).pipe(reduce((acc, classificationOrTableId) => {
|
|
266
|
+
const classificationInfo = classificationsInfo.get(classificationOrTableId);
|
|
267
|
+
if (classificationInfo === undefined) {
|
|
268
|
+
return acc;
|
|
269
|
+
}
|
|
270
|
+
acc.drawing.push(...classificationInfo.relatedCategories2d);
|
|
271
|
+
acc.spatial.push(...classificationInfo.relatedCategories3d);
|
|
272
|
+
acc.childClassifications.push(...classificationInfo.childClassificationIds);
|
|
273
|
+
return acc;
|
|
274
|
+
}, { drawing: new Array(), spatial: new Array(), childClassifications: new Array() }), mergeMap(({ drawing, spatial, childClassifications }) => {
|
|
275
|
+
if (childClassifications.length === 0) {
|
|
276
|
+
return of({ drawing, spatial });
|
|
277
|
+
}
|
|
278
|
+
return this.getAllContainedCategories(childClassifications).pipe(map((childResult) => {
|
|
279
|
+
drawing.push(...childResult.drawing);
|
|
280
|
+
spatial.push(...childResult.spatial);
|
|
281
|
+
return { drawing, spatial };
|
|
282
|
+
}));
|
|
283
|
+
}))));
|
|
284
|
+
}
|
|
285
|
+
getDirectChildClassifications(classificationOrTableIds) {
|
|
286
|
+
const result = new Array();
|
|
287
|
+
if (Id64.sizeOf(classificationOrTableIds) === 0) {
|
|
288
|
+
return of(result);
|
|
289
|
+
}
|
|
290
|
+
return this.getClassificationsInfo().pipe(mergeMap((classificationsInfo) => from(Id64.iterable(classificationOrTableIds)).pipe(reduce((acc, classificationOrTableId) => {
|
|
291
|
+
const classificationInfo = classificationsInfo.get(classificationOrTableId);
|
|
292
|
+
if (classificationInfo !== undefined) {
|
|
293
|
+
acc.push(...classificationInfo.childClassificationIds);
|
|
294
|
+
}
|
|
295
|
+
return acc;
|
|
296
|
+
}, result))));
|
|
297
|
+
}
|
|
298
|
+
getClassificationsPathObs(classificationIds) {
|
|
299
|
+
return from(this.getClassificationsInfo()).pipe(mergeMap((classificationsInfo) => {
|
|
300
|
+
return from(Id64.iterable(classificationIds)).pipe(map((classificationId) => {
|
|
301
|
+
const path = [{ id: classificationId, className: CLASS_NAME_Classification }];
|
|
302
|
+
let parentId = classificationsInfo.get(classificationId)?.parentClassificationOrTableId;
|
|
303
|
+
while (parentId !== undefined) {
|
|
304
|
+
const parentIdOfParent = classificationsInfo.get(parentId)?.parentClassificationOrTableId;
|
|
305
|
+
if (parentIdOfParent) {
|
|
306
|
+
path.push({ className: CLASS_NAME_Classification, id: parentId });
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
path.push({ className: CLASS_NAME_ClassificationTable, id: parentId });
|
|
310
|
+
}
|
|
311
|
+
parentId = parentIdOfParent;
|
|
312
|
+
}
|
|
313
|
+
return path.reverse();
|
|
314
|
+
}));
|
|
315
|
+
}));
|
|
316
|
+
}
|
|
317
|
+
getAllClassifications() {
|
|
318
|
+
return this.getClassificationsInfo().pipe(map((classificationsInfo) => [...classificationsInfo.keys()]));
|
|
319
|
+
}
|
|
320
|
+
queryFilteredElementsData({ element2dIds, element3dIds }) {
|
|
321
|
+
return defer(() => {
|
|
322
|
+
const queries = new Array();
|
|
323
|
+
if (Id64.sizeOf(element2dIds) > 0) {
|
|
324
|
+
queries.push(`
|
|
325
|
+
SELECT Model.Id modelId, Category.Id categoryId, ECInstanceId id
|
|
326
|
+
FROM ${CLASS_NAME_GeometricElement2d}
|
|
327
|
+
WHERE ECInstanceId IN (${joinId64Arg(element2dIds, ",")})
|
|
328
|
+
`);
|
|
329
|
+
}
|
|
330
|
+
if (Id64.sizeOf(element3dIds) > 0) {
|
|
331
|
+
queries.push(`
|
|
332
|
+
SELECT Model.Id modelId, Category.Id categoryId, ECInstanceId id
|
|
333
|
+
FROM ${CLASS_NAME_GeometricElement3d}
|
|
334
|
+
WHERE ECInstanceId IN (${joinId64Arg(element3dIds, ",")})
|
|
335
|
+
`);
|
|
336
|
+
}
|
|
337
|
+
return this.#queryExecutor.createQueryReader({ ecsql: queries.join(" UNION ALL ") }, {
|
|
338
|
+
rowFormat: "ECSqlPropertyNames",
|
|
339
|
+
limit: "unbounded",
|
|
340
|
+
restartToken: `${this.#componentName}/${this.#componentId}/filtered-elements/${Guid.createValue()}`,
|
|
341
|
+
});
|
|
342
|
+
}).pipe(map((row) => {
|
|
343
|
+
return { modelId: row.modelId, id: row.id, categoryId: row.categoryId };
|
|
344
|
+
}));
|
|
345
|
+
}
|
|
346
|
+
getFilteredElementsData({ element2dIds, element3dIds, }) {
|
|
347
|
+
const result = new Map();
|
|
348
|
+
if (Id64.sizeOf(element2dIds) === 0 && Id64.sizeOf(element3dIds) === 0) {
|
|
349
|
+
return of(result);
|
|
350
|
+
}
|
|
351
|
+
this.#filteredElementsData ??= this.queryFilteredElementsData({
|
|
352
|
+
element2dIds,
|
|
353
|
+
element3dIds,
|
|
354
|
+
}).pipe(reduce((acc, { modelId, id, categoryId }) => {
|
|
355
|
+
acc.set(id, { modelId, categoryId });
|
|
356
|
+
return acc;
|
|
357
|
+
}, result), shareReplay());
|
|
358
|
+
return this.#filteredElementsData;
|
|
359
|
+
}
|
|
360
|
+
clearFilteredElementsData() {
|
|
361
|
+
this.#filteredElementsData = undefined;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
//# sourceMappingURL=ClassificationsTreeIdsCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClassificationsTreeIdsCache.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeIdsCache.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AACrF,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACL,yBAAyB,EACzB,+BAA+B,EAC/B,8BAA8B,EAC9B,0BAA0B,EAC1B,oCAAoC,EACpC,6BAA6B,EAC7B,6BAA6B,EAC7B,0BAA0B,GAC3B,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAAE,+BAA+B,EAAE,MAAM,0DAA0D,CAAC;AAC3G,OAAO,EAAE,oBAAoB,EAAE,WAAW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AAI,CAAC,qBAAqB,GAAG,SAAS,CAAC;IACzC,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { defer, forkJoin, from, map, mergeMap, of, reduce, shareReplay } from \"rxjs\";\nimport { Guid, Id64 } from \"@itwin/core-bentley\";\nimport {\n CLASS_NAME_Classification,\n CLASS_NAME_ClassificationSystem,\n CLASS_NAME_ClassificationTable,\n CLASS_NAME_DrawingCategory,\n CLASS_NAME_ElementHasClassifications,\n CLASS_NAME_GeometricElement2d,\n CLASS_NAME_GeometricElement3d,\n CLASS_NAME_SpatialCategory,\n} from \"../../common/internal/ClassNameDefinitions.js\";\nimport { ModelCategoryElementsCountCache } from \"../../common/internal/ModelCategoryElementsCountCache.js\";\nimport { getDistinctMapValues, joinId64Arg } from \"../../common/internal/Utils.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type { GuidString, Id64Arg, Id64Array, Id64Set, Id64String } from \"@itwin/core-bentley\";\nimport type { HierarchyNodeIdentifiersPath, LimitingECSqlQueryExecutor } from \"@itwin/presentation-hierarchies\";\nimport type { CategoryId, ElementId, ModelId } from \"../../common/internal/Types.js\";\nimport type { ClassificationsTreeHierarchyConfiguration } from \"../ClassificationsTreeDefinition.js\";\n\n/** @internal */\nexport type ClassificationId = Id64String;\n/** @internal */\nexport type ClassificationTableId = Id64String;\n\ninterface ClassificationInfo {\n parentClassificationOrTableId: ClassificationId | ClassificationTableId | undefined;\n childClassificationIds: ClassificationId[];\n relatedCategories2d: CategoryId[];\n relatedCategories3d: CategoryId[];\n}\n\ntype ModelCategoryKey = `${ModelId}-${CategoryId}`;\n\n/** @internal */\nexport class ClassificationsTreeIdsCache implements Disposable {\n readonly #categoryElementCounts: ModelCategoryElementsCountCache;\n #elementModelsCategories: Observable<Map<ModelId, { category2dIds: Id64Set; category3dIds: Id64Set; isSubModel: boolean }>> | undefined;\n #modelWithCategoryModeledElements: Observable<Map<ModelCategoryKey, Set<ElementId>>> | undefined;\n #classificationInfos: Observable<Map<ClassificationId | ClassificationTableId, ClassificationInfo>> | undefined;\n #filteredElementsData: Observable<Map<ElementId, { modelId: Id64String; categoryId: Id64String }>> | undefined;\n #queryExecutor: LimitingECSqlQueryExecutor;\n #hierarchyConfig: ClassificationsTreeHierarchyConfiguration;\n #componentId: GuidString;\n #componentName: string;\n\n constructor(queryExecutor: LimitingECSqlQueryExecutor, hierarchyConfig: ClassificationsTreeHierarchyConfiguration, componentId?: GuidString) {\n this.#queryExecutor = queryExecutor;\n this.#hierarchyConfig = hierarchyConfig;\n this.#componentId = componentId ?? Guid.createValue();\n this.#componentName = \"ClassificationsTreeIdsCache\";\n this.#categoryElementCounts = new ModelCategoryElementsCountCache(\n this.#queryExecutor,\n [\"BisCore.GeometricElement2d\", \"BisCore.GeometricElement3d\"],\n this.#componentId,\n );\n }\n\n public [Symbol.dispose]() {\n this.#categoryElementCounts[Symbol.dispose]();\n }\n\n private queryElementModelCategories(): Observable<{\n modelId: Id64String;\n categoryId: Id64String;\n type: \"2d\" | \"3d\";\n }> {\n return defer(() => {\n const query = `\n SELECT * FROM (\n SELECT '3d' type, this.Model.Id modelId, this.Category.Id categoryId\n FROM BisCore.GeometricModel m\n JOIN BisCore.GeometricElement3d this ON m.ECInstanceId = this.Model.Id\n WHERE this.Parent.Id IS NULL AND m.IsPrivate = false\n GROUP BY modelId, categoryId\n )\n UNION ALL\n SELECT * FROM (\n SELECT '2d' type, this.Model.Id modelId, this.Category.Id categoryId\n FROM BisCore.GeometricModel m\n JOIN BisCore.GeometricElement2d this ON m.ECInstanceId = this.Model.Id\n WHERE this.Parent.Id IS NULL AND m.IsPrivate = false\n GROUP BY modelId, categoryId\n )\n `;\n return this.#queryExecutor.createQueryReader(\n { ecsql: query },\n { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\", restartToken: `${this.#componentName}/${this.#componentId}/element-models-and-categories` },\n );\n }).pipe(\n map((row) => {\n return { modelId: row.modelId, categoryId: row.categoryId, type: row.type };\n }),\n );\n }\n\n private getElementModelsCategories() {\n this.#elementModelsCategories ??= forkJoin({\n modelCategories: this.queryElementModelCategories().pipe(\n reduce((acc, queriedCategory) => {\n let modelEntry = acc.get(queriedCategory.modelId);\n if (modelEntry === undefined) {\n modelEntry = { category2dIds: new Set(), category3dIds: new Set() };\n acc.set(queriedCategory.modelId, modelEntry);\n }\n switch (queriedCategory.type) {\n case \"2d\":\n modelEntry.category2dIds.add(queriedCategory.categoryId);\n break;\n case \"3d\":\n modelEntry.category3dIds.add(queriedCategory.categoryId);\n break;\n }\n return acc;\n }, new Map<ModelId, { category2dIds: Id64Set; category3dIds: Id64Set }>()),\n ),\n modelWithCategoryModeledElements: this.getModelWithCategoryModeledElements(),\n }).pipe(\n map(({ modelCategories, modelWithCategoryModeledElements }) => {\n const result = new Map<ModelId, { category2dIds: Id64Set; category3dIds: Id64Set; isSubModel: boolean }>();\n const subModels = getDistinctMapValues(modelWithCategoryModeledElements);\n for (const [modelId, modelEntry] of modelCategories) {\n const isSubModel = subModels.has(modelId);\n result.set(modelId, { category2dIds: modelEntry.category2dIds, category3dIds: modelEntry.category3dIds, isSubModel });\n }\n return result;\n }),\n shareReplay(),\n );\n return this.#elementModelsCategories;\n }\n\n private queryModeledElements(): Observable<{\n modelId: Id64String;\n modeledElementId: Id64String;\n categoryId: Id64String;\n rootCategoryId: Id64String;\n }> {\n return defer(() => {\n const query = `\n SELECT\n pe.ECInstanceId modeledElementId,\n pe.Category.Id categoryId,\n pe.Model.Id modelId\n FROM BisCore.GeometricModel m\n JOIN BisCore.GeometricElement3d pe ON pe.ECInstanceId = m.ModeledElement.Id\n WHERE\n m.IsPrivate = false\n AND m.ECInstanceId IN (SELECT Model.Id FROM BisCore.Element)\n UNION ALL\n SELECT\n pe.ECInstanceId modeledElementId,\n pe.Category.Id categoryId,\n pe.Model.Id modelId\n FROM BisCore.GeometricModel m\n JOIN BisCore.GeometricElement2d pe ON pe.ECInstanceId = m.ModeledElement.Id\n WHERE\n m.IsPrivate = false\n AND m.ECInstanceId IN (SELECT Model.Id FROM BisCore.Element)\n `;\n return this.#queryExecutor.createQueryReader(\n { ecsql: query },\n { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\", restartToken: `${this.#componentName}/${this.#componentId}/modeled-elements` },\n );\n }).pipe(\n map((row) => {\n return { modelId: row.modelId, categoryId: row.categoryId, modeledElementId: row.modeledElementId, rootCategoryId: row.rootCategoryId };\n }),\n );\n }\n\n private getModelWithCategoryModeledElements() {\n this.#modelWithCategoryModeledElements ??= this.queryModeledElements().pipe(\n reduce((acc, { modelId, categoryId, modeledElementId }) => {\n const key: ModelCategoryKey = `${modelId}-${categoryId}`;\n const entry = acc.get(key);\n if (entry === undefined) {\n acc.set(key, new Set([modeledElementId]));\n } else {\n entry.add(modeledElementId);\n }\n return acc;\n }, new Map<ModelCategoryKey, Set<ElementId>>()),\n shareReplay(),\n );\n return this.#modelWithCategoryModeledElements;\n }\n\n public getCategoriesModeledElements(modelId: Id64String, categoryIds: Id64Arg): Observable<Id64Array> {\n return this.getModelWithCategoryModeledElements().pipe(\n mergeMap((modelWithCategoryModeledElements) =>\n from(Id64.iterable(categoryIds)).pipe(\n reduce((acc, categoryId) => {\n const entry = modelWithCategoryModeledElements.get(`${modelId}-${categoryId}`);\n if (entry !== undefined) {\n acc.push(...entry);\n }\n return acc;\n }, new Array<ElementId>()),\n ),\n ),\n );\n }\n\n public getCategoriesElementModels(categoryIds: Id64Arg, includeSubModels?: boolean): Observable<Map<CategoryId, Set<ModelId>>> {\n return this.getElementModelsCategories().pipe(\n mergeMap((elementModelsCategories) =>\n from(Id64.iterable(categoryIds)).pipe(\n reduce((acc, categoryId) => {\n for (const [modelId, { category2dIds, category3dIds, isSubModel }] of elementModelsCategories) {\n if ((includeSubModels || !isSubModel) && (category2dIds.has(categoryId) || category3dIds.has(categoryId))) {\n let categoryModels = acc.get(categoryId);\n if (!categoryModels) {\n categoryModels = new Set<ModelId>();\n acc.set(categoryId, categoryModels);\n }\n categoryModels.add(modelId);\n }\n }\n return acc;\n }, new Map<CategoryId, Set<ModelId>>()),\n ),\n ),\n );\n }\n\n public getModelCategoryIds(modelId: Id64String): Observable<{ drawing: Id64Array; spatial: Id64Array }> {\n return this.getElementModelsCategories().pipe(\n map((elementModelsCategories) => {\n return {\n drawing: Array.from(elementModelsCategories.get(modelId)?.category2dIds ?? []),\n spatial: Array.from(elementModelsCategories.get(modelId)?.category3dIds ?? []),\n };\n }),\n );\n }\n\n public getAllCategories(): Observable<{ drawing: Id64Set; spatial: Id64Set }> {\n return this.getElementModelsCategories().pipe(\n mergeMap((modelsCategoriesInfo) => modelsCategoriesInfo.values()),\n reduce(\n (acc, { category2dIds, category3dIds }) => {\n category2dIds.forEach((id) => acc.drawing.add(id));\n category3dIds.forEach((id) => acc.spatial.add(id));\n return acc;\n },\n { drawing: new Set<Id64String>(), spatial: new Set<Id64String>() },\n ),\n );\n }\n\n public hasSubModel(elementId: Id64String): Observable<boolean> {\n return this.getElementModelsCategories().pipe(map((elementModelsCategories) => elementModelsCategories.has(elementId)));\n }\n\n public getCategoryElementsCount(modelId: Id64String, categoryId: Id64String): Observable<number> {\n return this.#categoryElementCounts.getCategoryElementsCount(modelId, categoryId);\n }\n\n private queryClassifications(): Observable<\n {\n id: Id64String;\n relatedCategories2d: CategoryId[];\n relatedCategories3d: CategoryId[];\n } & ({ tableId: ClassificationTableId; parentId: undefined } | { tableId: undefined; parentId: ClassificationId })\n > {\n return defer(() => {\n const CLASSIFICATIONS_CTE = \"Classifications\";\n const ctes = [\n `\n ${CLASSIFICATIONS_CTE}(ClassificationId, ClassificationTableId, ParentClassificationId) AS (\n SELECT\n cl.ECInstanceId,\n ct.ECInstanceId,\n NULL\n FROM ${CLASS_NAME_Classification} cl\n JOIN ${CLASS_NAME_ClassificationTable} ct ON ct.ECInstanceId = cl.Model.Id\n JOIN ${CLASS_NAME_ClassificationSystem} cs ON cs.ECInstanceId = ct.Parent.Id\n WHERE\n cs.CodeValue = '${this.#hierarchyConfig.rootClassificationSystemCode}'\n AND NOT ct.IsPrivate\n AND NOT cl.IsPrivate\n AND cl.Parent.Id IS NULL\n\n UNION ALL\n\n SELECT\n cl.ECInstanceId,\n NULL,\n cl.Parent.Id\n FROM\n ${CLASSIFICATIONS_CTE} cte\n JOIN ${CLASS_NAME_Classification} cl ON cl.Parent.Id = cte.ClassificationId\n WHERE\n NOT cl.IsPrivate\n )\n `,\n ];\n const ecsql = `\n SELECT\n cl.ClassificationId id,\n cl.ClassificationTableId tableId,\n cl.ParentClassificationId parentId,\n (\n SELECT group_concat(IdToHex(cat.ECInstanceId))\n FROM ${CLASS_NAME_GeometricElement2d} e\n JOIN ${CLASS_NAME_DrawingCategory} cat ON cat.ECInstanceId = e.Category.Id\n JOIN ${CLASS_NAME_ElementHasClassifications} ehc ON ehc.SourceECInstanceId = e.ECInstanceId\n WHERE e.Parent.Id IS NULL AND NOT cat.IsPrivate AND ehc.TargetECInstanceId = cl.ClassificationId\n GROUP BY ehc.TargetECInstanceId\n ) relatedCategories2d,\n (\n SELECT group_concat(IdToHex(cat.ECInstanceId))\n FROM ${CLASS_NAME_GeometricElement3d} e\n JOIN ${CLASS_NAME_SpatialCategory} cat ON cat.ECInstanceId = e.Category.Id\n JOIN ${CLASS_NAME_ElementHasClassifications} ehc ON ehc.SourceECInstanceId = e.ECInstanceId\n WHERE e.Parent.Id IS NULL AND NOT cat.IsPrivate AND ehc.TargetECInstanceId = cl.ClassificationId\n GROUP BY ehc.TargetECInstanceId\n ) relatedCategories3d\n FROM ${CLASSIFICATIONS_CTE} cl\n `;\n return this.#queryExecutor.createQueryReader(\n { ctes, ecsql },\n { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\", restartToken: `${this.#componentName}/${this.#componentId}/classifications` },\n );\n }).pipe(\n map((row) => {\n return {\n id: row.id,\n tableId: row.tableId,\n parentId: row.parentId,\n relatedCategories2d: row.relatedCategories2d ? (row.relatedCategories2d as string).split(\",\") : [],\n relatedCategories3d: row.relatedCategories3d ? (row.relatedCategories3d as string).split(\",\") : [],\n };\n }),\n );\n }\n\n private getClassificationsInfo() {\n this.#classificationInfos ??= this.queryClassifications().pipe(\n reduce((acc, { id, tableId, parentId, relatedCategories2d, relatedCategories3d }) => {\n const tableOrParentId = tableId ?? parentId;\n let parentInfo = acc.get(tableOrParentId);\n if (!parentInfo) {\n parentInfo = { childClassificationIds: [], relatedCategories2d: [], relatedCategories3d: [], parentClassificationOrTableId: undefined };\n acc.set(tableOrParentId, parentInfo);\n }\n parentInfo.childClassificationIds.push(id);\n let classificationEntry = acc.get(id);\n if (!classificationEntry) {\n classificationEntry = { childClassificationIds: [], relatedCategories2d, relatedCategories3d, parentClassificationOrTableId: tableOrParentId };\n acc.set(id, classificationEntry);\n } else {\n classificationEntry.parentClassificationOrTableId = tableOrParentId;\n }\n return acc;\n }, new Map<ClassificationId | ClassificationTableId, ClassificationInfo>()),\n shareReplay(),\n );\n return this.#classificationInfos;\n }\n\n public getAllContainedCategories(classificationOrTableIds: Id64Arg): Observable<{ drawing: Id64Array; spatial: Id64Array }> {\n const result = { drawing: new Array<CategoryId>(), spatial: new Array<CategoryId>() };\n if (Id64.sizeOf(classificationOrTableIds) === 0) {\n return of(result);\n }\n return this.getClassificationsInfo().pipe(\n mergeMap((classificationsInfo) =>\n from(Id64.iterable(classificationOrTableIds)).pipe(\n reduce(\n (acc, classificationOrTableId) => {\n const classificationInfo = classificationsInfo.get(classificationOrTableId);\n if (classificationInfo === undefined) {\n return acc;\n }\n acc.drawing.push(...classificationInfo.relatedCategories2d);\n acc.spatial.push(...classificationInfo.relatedCategories3d);\n acc.childClassifications.push(...classificationInfo.childClassificationIds);\n return acc;\n },\n { drawing: new Array<Id64String>(), spatial: new Array<Id64String>(), childClassifications: new Array<Id64String>() },\n ),\n mergeMap(({ drawing, spatial, childClassifications }) => {\n if (childClassifications.length === 0) {\n return of({ drawing, spatial });\n }\n return this.getAllContainedCategories(childClassifications).pipe(\n map((childResult) => {\n drawing.push(...childResult.drawing);\n spatial.push(...childResult.spatial);\n return { drawing, spatial };\n }),\n );\n }),\n ),\n ),\n );\n }\n\n public getDirectChildClassifications(classificationOrTableIds: Id64Arg): Observable<ClassificationId[]> {\n const result = new Array<ClassificationId>();\n if (Id64.sizeOf(classificationOrTableIds) === 0) {\n return of(result);\n }\n return this.getClassificationsInfo().pipe(\n mergeMap((classificationsInfo) =>\n from(Id64.iterable(classificationOrTableIds)).pipe(\n reduce((acc, classificationOrTableId) => {\n const classificationInfo = classificationsInfo.get(classificationOrTableId);\n if (classificationInfo !== undefined) {\n acc.push(...classificationInfo.childClassificationIds);\n }\n return acc;\n }, result),\n ),\n ),\n );\n }\n\n public getClassificationsPathObs(classificationIds: Id64Arg): Observable<HierarchyNodeIdentifiersPath> {\n return from(this.getClassificationsInfo()).pipe(\n mergeMap((classificationsInfo) => {\n return from(Id64.iterable(classificationIds)).pipe(\n map((classificationId) => {\n const path: HierarchyNodeIdentifiersPath = [{ id: classificationId, className: CLASS_NAME_Classification }];\n let parentId = classificationsInfo.get(classificationId)?.parentClassificationOrTableId;\n while (parentId !== undefined) {\n const parentIdOfParent = classificationsInfo.get(parentId)?.parentClassificationOrTableId;\n if (parentIdOfParent) {\n path.push({ className: CLASS_NAME_Classification, id: parentId });\n } else {\n path.push({ className: CLASS_NAME_ClassificationTable, id: parentId });\n }\n parentId = parentIdOfParent;\n }\n return path.reverse();\n }),\n );\n }),\n );\n }\n\n public getAllClassifications(): Observable<ClassificationId[]> {\n return this.getClassificationsInfo().pipe(map((classificationsInfo) => [...classificationsInfo.keys()]));\n }\n\n private queryFilteredElementsData({ element2dIds, element3dIds }: { element2dIds: Id64Arg; element3dIds: Id64Arg }): Observable<{\n modelId: Id64String;\n id: ElementId;\n categoryId: Id64String;\n }> {\n return defer(() => {\n const queries = new Array<string>();\n if (Id64.sizeOf(element2dIds) > 0) {\n queries.push(`\n SELECT Model.Id modelId, Category.Id categoryId, ECInstanceId id\n FROM ${CLASS_NAME_GeometricElement2d}\n WHERE ECInstanceId IN (${joinId64Arg(element2dIds, \",\")})\n `);\n }\n if (Id64.sizeOf(element3dIds) > 0) {\n queries.push(`\n SELECT Model.Id modelId, Category.Id categoryId, ECInstanceId id\n FROM ${CLASS_NAME_GeometricElement3d}\n WHERE ECInstanceId IN (${joinId64Arg(element3dIds, \",\")})\n `);\n }\n return this.#queryExecutor.createQueryReader(\n { ecsql: queries.join(\" UNION ALL \") },\n {\n rowFormat: \"ECSqlPropertyNames\",\n limit: \"unbounded\",\n restartToken: `${this.#componentName}/${this.#componentId}/filtered-elements/${Guid.createValue()}`,\n },\n );\n }).pipe(\n map((row) => {\n return { modelId: row.modelId, id: row.id, categoryId: row.categoryId };\n }),\n );\n }\n\n public getFilteredElementsData({\n element2dIds,\n element3dIds,\n }: {\n element2dIds: Id64Arg;\n element3dIds: Id64Arg;\n }): Observable<Map<ElementId, { categoryId: Id64String; modelId: Id64String }>> {\n const result = new Map<ElementId, { categoryId: Id64String; modelId: Id64String }>();\n if (Id64.sizeOf(element2dIds) === 0 && Id64.sizeOf(element3dIds) === 0) {\n return of(result);\n }\n this.#filteredElementsData ??= this.queryFilteredElementsData({\n element2dIds,\n element3dIds,\n }).pipe(\n reduce((acc, { modelId, id, categoryId }) => {\n acc.set(id, { modelId, categoryId });\n return acc;\n }, result),\n shareReplay(),\n );\n return this.#filteredElementsData;\n }\n\n public clearFilteredElementsData() {\n this.#filteredElementsData = undefined;\n }\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Id64Array, Id64String } from "@itwin/core-bentley";
|
|
2
|
+
import type { HierarchyNodeKey } from "@itwin/presentation-hierarchies";
|
|
3
|
+
interface ClassificationsTreeNode {
|
|
4
|
+
key: HierarchyNodeKey;
|
|
5
|
+
extendedData?: {
|
|
6
|
+
[id: string]: any;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare namespace ClassificationsTreeNode {
|
|
11
|
+
const isClassificationTableNode: (node: Pick<ClassificationsTreeNode, "extendedData">) => boolean;
|
|
12
|
+
const isClassificationNode: (node: Pick<ClassificationsTreeNode, "extendedData">) => boolean;
|
|
13
|
+
const isGeometricElementNode: (node: Pick<ClassificationsTreeNode, "extendedData">) => boolean;
|
|
14
|
+
const getClassificationIds: (node: Pick<ClassificationsTreeNode, "extendedData">) => Id64Array;
|
|
15
|
+
const getModelId: (node: Pick<ClassificationsTreeNode, "extendedData">) => Id64String;
|
|
16
|
+
const getCategoryId: (node: Pick<ClassificationsTreeNode, "extendedData">) => Id64String;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=ClassificationsTreeNode.d.ts.map
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { assert } from "@itwin/core-bentley";
|
|
6
|
+
import { parseIdsSelectorResult } from "../../common/internal/Utils.js";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export var ClassificationsTreeNode;
|
|
9
|
+
(function (ClassificationsTreeNode) {
|
|
10
|
+
ClassificationsTreeNode.isClassificationTableNode = (node) => getNodeType(node) === "ClassificationTable";
|
|
11
|
+
ClassificationsTreeNode.isClassificationNode = (node) => getNodeType(node) === "Classification";
|
|
12
|
+
ClassificationsTreeNode.isGeometricElementNode = (node) => {
|
|
13
|
+
const type = getNodeType(node);
|
|
14
|
+
return type === "GeometricElement3d" || type === "GeometricElement2d";
|
|
15
|
+
};
|
|
16
|
+
ClassificationsTreeNode.getClassificationIds = (node) => {
|
|
17
|
+
assert(!!node.extendedData && "classificationIds" in node.extendedData);
|
|
18
|
+
return parseIdsSelectorResult(node.extendedData.classificationIds);
|
|
19
|
+
};
|
|
20
|
+
ClassificationsTreeNode.getModelId = (node) => {
|
|
21
|
+
assert(typeof node.extendedData?.modelId === "string");
|
|
22
|
+
return node.extendedData.modelId;
|
|
23
|
+
};
|
|
24
|
+
ClassificationsTreeNode.getCategoryId = (node) => {
|
|
25
|
+
assert(typeof node.extendedData?.categoryId === "string");
|
|
26
|
+
return node.extendedData.categoryId;
|
|
27
|
+
};
|
|
28
|
+
})(ClassificationsTreeNode || (ClassificationsTreeNode = {}));
|
|
29
|
+
function getNodeType(node) {
|
|
30
|
+
return node.extendedData && "type" in node.extendedData ? node.extendedData.type : undefined;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=ClassificationsTreeNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClassificationsTreeNode.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/classifications-tree/internal/ClassificationsTreeNode.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAUxE,gBAAgB;AAChB,MAAM,KAAW,uBAAuB,CAwBvC;AAxBD,WAAiB,uBAAuB;IACzB,iDAAyB,GAAG,CAAC,IAAmD,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,qBAAqB,CAAC;IAEjI,4CAAoB,GAAG,CAAC,IAAmD,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,gBAAgB,CAAC;IAEvH,8CAAsB,GAAG,CAAC,IAAmD,EAAE,EAAE;QAC5F,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QAC/B,OAAO,IAAI,KAAK,oBAAoB,IAAI,IAAI,KAAK,oBAAoB,CAAC;IACxE,CAAC,CAAC;IAEW,4CAAoB,GAAG,CAAC,IAAmD,EAAa,EAAE;QACrG,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,IAAI,mBAAmB,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC;QACxE,OAAO,sBAAsB,CAAC,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;IACrE,CAAC,CAAC;IAEW,kCAAU,GAAG,CAAC,IAAmD,EAAc,EAAE;QAC5F,MAAM,CAAC,OAAO,IAAI,CAAC,YAAY,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC;QACvD,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;IACnC,CAAC,CAAC;IAEW,qCAAa,GAAG,CAAC,IAAmD,EAAc,EAAE;QAC/F,MAAM,CAAC,OAAO,IAAI,CAAC,YAAY,EAAE,UAAU,KAAK,QAAQ,CAAC,CAAC;QAC1D,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC,EAxBgB,uBAAuB,KAAvB,uBAAuB,QAwBvC;AAED,SAAS,WAAW,CAAC,IAAmD;IACtE,OAAO,IAAI,CAAC,YAAY,IAAI,MAAM,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAC/F,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 { assert } from \"@itwin/core-bentley\";\nimport { parseIdsSelectorResult } from \"../../common/internal/Utils.js\";\n\nimport type { Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport type { HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\n\ninterface ClassificationsTreeNode {\n key: HierarchyNodeKey;\n extendedData?: { [id: string]: any };\n}\n\n/** @internal */\nexport namespace ClassificationsTreeNode {\n export const isClassificationTableNode = (node: Pick<ClassificationsTreeNode, \"extendedData\">) => getNodeType(node) === \"ClassificationTable\";\n\n export const isClassificationNode = (node: Pick<ClassificationsTreeNode, \"extendedData\">) => getNodeType(node) === \"Classification\";\n\n export const isGeometricElementNode = (node: Pick<ClassificationsTreeNode, \"extendedData\">) => {\n const type = getNodeType(node);\n return type === \"GeometricElement3d\" || type === \"GeometricElement2d\";\n };\n\n export const getClassificationIds = (node: Pick<ClassificationsTreeNode, \"extendedData\">): Id64Array => {\n assert(!!node.extendedData && \"classificationIds\" in node.extendedData);\n return parseIdsSelectorResult(node.extendedData.classificationIds);\n };\n\n export const getModelId = (node: Pick<ClassificationsTreeNode, \"extendedData\">): Id64String => {\n assert(typeof node.extendedData?.modelId === \"string\");\n return node.extendedData.modelId;\n };\n\n export const getCategoryId = (node: Pick<ClassificationsTreeNode, \"extendedData\">): Id64String => {\n assert(typeof node.extendedData?.categoryId === \"string\");\n return node.extendedData.categoryId;\n };\n}\n\nfunction getNodeType(node: Pick<ClassificationsTreeNode, \"extendedData\">) {\n return node.extendedData && \"type\" in node.extendedData ? node.extendedData.type : undefined;\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { GuidString } from "@itwin/core-bentley";
|
|
2
|
+
import type { VisibilityTreeProps } from "../../common/components/VisibilityTree.js";
|
|
3
|
+
import type { ClassificationsTreeHierarchyConfiguration } from "../ClassificationsTreeDefinition.js";
|
|
4
|
+
import type { ClassificationsTreeIdsCache } from "./ClassificationsTreeIdsCache.js";
|
|
5
|
+
/** @internal */
|
|
6
|
+
export type ClassificationsTreeFilteringError = "tooManyFilterMatches" | "unknownFilterError";
|
|
7
|
+
type HierarchyFilteringPaths = Awaited<ReturnType<Required<VisibilityTreeProps>["getFilteredPaths"]>>;
|
|
8
|
+
/** @internal */
|
|
9
|
+
export declare function useFilteredPaths({ filter, hierarchyConfiguration, getClassificationsTreeIdsCache, onFilteredPathsChanged, componentId, }: {
|
|
10
|
+
filter?: string;
|
|
11
|
+
hierarchyConfiguration: ClassificationsTreeHierarchyConfiguration;
|
|
12
|
+
getClassificationsTreeIdsCache: () => ClassificationsTreeIdsCache;
|
|
13
|
+
onFilteredPathsChanged: (paths: HierarchyFilteringPaths | undefined) => void;
|
|
14
|
+
componentId: GuidString;
|
|
15
|
+
}): {
|
|
16
|
+
getPaths: VisibilityTreeProps["getFilteredPaths"] | undefined;
|
|
17
|
+
filteringError: ClassificationsTreeFilteringError | undefined;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=UseFilteredPaths.d.ts.map
|
package/lib/esm/tree-widget-react/components/trees/classifications-tree/internal/UseFilteredPaths.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { useEffect, useMemo, useState } from "react";
|
|
6
|
+
import { FilterLimitExceededError } from "../../common/TreeErrors.js";
|
|
7
|
+
import { useTelemetryContext } from "../../common/UseTelemetryContext.js";
|
|
8
|
+
import { ClassificationsTreeDefinition } from "../ClassificationsTreeDefinition.js";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export function useFilteredPaths({ filter, hierarchyConfiguration, getClassificationsTreeIdsCache, onFilteredPathsChanged, componentId, }) {
|
|
11
|
+
const [filteringError, setFilteringError] = useState();
|
|
12
|
+
const { onFeatureUsed } = useTelemetryContext();
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
setFilteringError(undefined);
|
|
15
|
+
if (!filter) {
|
|
16
|
+
onFilteredPathsChanged(undefined);
|
|
17
|
+
}
|
|
18
|
+
}, [filter, onFilteredPathsChanged]);
|
|
19
|
+
const getFilteredPaths = useMemo(() => {
|
|
20
|
+
if (!filter) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
return async ({ imodelAccess, abortSignal }) => {
|
|
24
|
+
onFeatureUsed({ featureId: "filtering", reportInteraction: true });
|
|
25
|
+
try {
|
|
26
|
+
const paths = await ClassificationsTreeDefinition.createInstanceKeyPaths({
|
|
27
|
+
imodelAccess,
|
|
28
|
+
label: filter,
|
|
29
|
+
idsCache: getClassificationsTreeIdsCache(),
|
|
30
|
+
hierarchyConfig: hierarchyConfiguration,
|
|
31
|
+
componentId,
|
|
32
|
+
abortSignal,
|
|
33
|
+
});
|
|
34
|
+
onFilteredPathsChanged(paths);
|
|
35
|
+
return paths;
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
const newError = e instanceof FilterLimitExceededError ? "tooManyFilterMatches" : "unknownFilterError";
|
|
39
|
+
if (newError !== "tooManyFilterMatches") {
|
|
40
|
+
const feature = e instanceof Error && e.message.includes("query too long to execute or server is too busy") ? "error-timeout" : "error-unknown";
|
|
41
|
+
onFeatureUsed({ featureId: feature, reportInteraction: false });
|
|
42
|
+
}
|
|
43
|
+
setFilteringError(newError);
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}, [filter, onFilteredPathsChanged, onFeatureUsed, getClassificationsTreeIdsCache, hierarchyConfiguration, componentId]);
|
|
48
|
+
return {
|
|
49
|
+
getPaths: getFilteredPaths,
|
|
50
|
+
filteringError,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=UseFilteredPaths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UseFilteredPaths.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/classifications-tree/internal/UseFilteredPaths.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,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CAAC,oBAAoB,CAAC;gBACvG,IAAI,QAAQ,KAAK,sBAAsB,EAAE,CAAC;oBACxC,MAAM,OAAO,GAAG,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,iDAAiD,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC;oBAChJ,aAAa,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC,CAAC;gBAClE,CAAC;gBACD,iBAAiB,CAAC,QAAQ,CAAC,CAAC;gBAC5B,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,EAAE,aAAa,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,WAAW,CAAC,CAAC,CAAC;IAEzH,OAAO;QACL,QAAQ,EAAE,gBAAgB;QAC1B,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, useState } from \"react\";\nimport { FilterLimitExceededError } from \"../../common/TreeErrors.js\";\nimport { useTelemetryContext } from \"../../common/UseTelemetryContext.js\";\nimport { ClassificationsTreeDefinition } from \"../ClassificationsTreeDefinition.js\";\n\nimport type { GuidString } from \"@itwin/core-bentley\";\nimport type { VisibilityTreeProps } from \"../../common/components/VisibilityTree.js\";\nimport type { ClassificationsTreeHierarchyConfiguration } from \"../ClassificationsTreeDefinition.js\";\nimport type { ClassificationsTreeIdsCache } from \"./ClassificationsTreeIdsCache.js\";\n\n/** @internal */\nexport type ClassificationsTreeFilteringError = \"tooManyFilterMatches\" | \"unknownFilterError\";\n\ntype HierarchyFilteringPaths = Awaited<ReturnType<Required<VisibilityTreeProps>[\"getFilteredPaths\"]>>;\n\n/** @internal */\nexport function useFilteredPaths({\n filter,\n hierarchyConfiguration,\n getClassificationsTreeIdsCache,\n onFilteredPathsChanged,\n componentId,\n}: {\n filter?: string;\n hierarchyConfiguration: ClassificationsTreeHierarchyConfiguration;\n getClassificationsTreeIdsCache: () => ClassificationsTreeIdsCache;\n onFilteredPathsChanged: (paths: HierarchyFilteringPaths | undefined) => void;\n componentId: GuidString;\n}): {\n getPaths: VisibilityTreeProps[\"getFilteredPaths\"] | undefined;\n filteringError: ClassificationsTreeFilteringError | undefined;\n} {\n const [filteringError, setFilteringError] = useState<ClassificationsTreeFilteringError | undefined>();\n const { onFeatureUsed } = useTelemetryContext();\n useEffect(() => {\n setFilteringError(undefined);\n if (!filter) {\n onFilteredPathsChanged(undefined);\n }\n }, [filter, onFilteredPathsChanged]);\n\n const getFilteredPaths = useMemo<VisibilityTreeProps[\"getFilteredPaths\"] | undefined>(() => {\n if (!filter) {\n return undefined;\n }\n\n return async ({ imodelAccess, abortSignal }) => {\n onFeatureUsed({ featureId: \"filtering\", reportInteraction: true });\n try {\n const paths = await ClassificationsTreeDefinition.createInstanceKeyPaths({\n imodelAccess,\n label: filter,\n idsCache: getClassificationsTreeIdsCache(),\n hierarchyConfig: hierarchyConfiguration,\n componentId,\n abortSignal,\n });\n onFilteredPathsChanged(paths);\n return paths;\n } catch (e) {\n const newError = e instanceof FilterLimitExceededError ? \"tooManyFilterMatches\" : \"unknownFilterError\";\n if (newError !== \"tooManyFilterMatches\") {\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 setFilteringError(newError);\n return [];\n }\n };\n }, [filter, onFilteredPathsChanged, onFeatureUsed, getClassificationsTreeIdsCache, hierarchyConfiguration, componentId]);\n\n return {\n getPaths: getFilteredPaths,\n filteringError,\n };\n}\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { HierarchyNode } from "@itwin/presentation-hierarchies";
|
|
2
|
+
import type { Observable } from "rxjs";
|
|
3
|
+
import type { AlwaysAndNeverDrawnElementInfo } from "../../../common/internal/AlwaysAndNeverDrawnElementInfo.js";
|
|
4
|
+
import type { TreeSpecificVisibilityHandler } from "../../../common/internal/visibility/BaseVisibilityHelper.js";
|
|
5
|
+
import type { TreeWidgetViewport } from "../../../common/TreeWidgetViewport.js";
|
|
6
|
+
import type { VisibilityStatus } from "../../../common/UseHierarchyVisibility.js";
|
|
7
|
+
import type { ClassificationsTreeIdsCache } from "../ClassificationsTreeIdsCache.js";
|
|
8
|
+
import type { ClassificationsTreeFilterTargets } from "./FilteredTree.js";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export interface ClassificationsTreeVisibilityHandlerProps {
|
|
11
|
+
idsCache: ClassificationsTreeIdsCache;
|
|
12
|
+
viewport: TreeWidgetViewport;
|
|
13
|
+
alwaysAndNeverDrawnElementInfo: AlwaysAndNeverDrawnElementInfo;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Handles visibility status of classifications tree nodes.
|
|
17
|
+
*
|
|
18
|
+
* This handler knows how to get and change visibility status of nodes created by hierarchy definition.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare class ClassificationsTreeVisibilityHandler implements Disposable, TreeSpecificVisibilityHandler<ClassificationsTreeFilterTargets> {
|
|
22
|
+
#private;
|
|
23
|
+
constructor(constructorProps: ClassificationsTreeVisibilityHandlerProps);
|
|
24
|
+
[Symbol.dispose](): void;
|
|
25
|
+
changeFilterTargetsVisibilityStatus(targets: ClassificationsTreeFilterTargets, on: boolean): Observable<void>;
|
|
26
|
+
getVisibilityStatus(node: HierarchyNode): Observable<VisibilityStatus>;
|
|
27
|
+
/** Changes visibility of the items represented by the tree node. */
|
|
28
|
+
changeVisibilityStatus(node: HierarchyNode, on: boolean): Observable<void>;
|
|
29
|
+
getFilterTargetsVisibilityStatus(targets: ClassificationsTreeFilterTargets): Observable<VisibilityStatus>;
|
|
30
|
+
private getCategories;
|
|
31
|
+
private getAllCategories;
|
|
32
|
+
private getElementsCount;
|
|
33
|
+
private getModels;
|
|
34
|
+
private getSubCategories;
|
|
35
|
+
private getSubModels;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=ClassificationsTreeVisibilityHandler.d.ts.map
|