@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
package/lib/esm/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.js
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
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 { BehaviorSubject, bufferCount, debounceTime, defer, EMPTY, filter, first, forkJoin, from, fromEventPattern, map, mergeMap, of, reduce, scan, share, shareReplay, startWith, Subject, switchMap, take, takeUntil, tap, } from "rxjs";
|
|
6
|
+
import { Guid, Id64 } from "@itwin/core-bentley";
|
|
7
|
+
import { createECSqlQueryExecutor } from "@itwin/presentation-core-interop";
|
|
8
|
+
import { getClassesByView, getIdsFromChildrenTree, getOptimalBatchSize, releaseMainThreadOnItemsCount, setDifference, updateChildrenTree } from "./Utils.js";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export const SET_CHANGE_DEBOUNCE_TIME = 20;
|
|
11
|
+
/** @internal */
|
|
12
|
+
export class AlwaysAndNeverDrawnElementInfo {
|
|
13
|
+
#subscriptions;
|
|
14
|
+
#alwaysDrawn;
|
|
15
|
+
#neverDrawn;
|
|
16
|
+
#disposeSubject = new Subject();
|
|
17
|
+
#viewport;
|
|
18
|
+
#elementClassName;
|
|
19
|
+
#componentId;
|
|
20
|
+
#componentName;
|
|
21
|
+
#suppressors;
|
|
22
|
+
#suppress = new Subject();
|
|
23
|
+
constructor(props) {
|
|
24
|
+
this.#elementClassName = props.elementClassName;
|
|
25
|
+
this.#viewport = props.viewport;
|
|
26
|
+
this.#alwaysDrawn = { cacheEntryObs: this.createCacheEntryObservable("always") };
|
|
27
|
+
this.#neverDrawn = { cacheEntryObs: this.createCacheEntryObservable("never") };
|
|
28
|
+
this.#suppressors = this.#suppress.pipe(scan((acc, suppress) => acc + (suppress ? 1 : -1), 0), startWith(0), shareReplay(1));
|
|
29
|
+
this.#subscriptions = [this.#alwaysDrawn.cacheEntryObs.subscribe(), this.#neverDrawn.cacheEntryObs.subscribe()];
|
|
30
|
+
this.#componentId = props.componentId ?? Guid.createValue();
|
|
31
|
+
this.#componentName = "AlwaysAndNeverDrawnElementInfo";
|
|
32
|
+
}
|
|
33
|
+
suppressChangeEvents() {
|
|
34
|
+
this.#suppress.next(true);
|
|
35
|
+
}
|
|
36
|
+
resumeChangeEvents() {
|
|
37
|
+
this.#suppress.next(false);
|
|
38
|
+
}
|
|
39
|
+
getElementsTree({ setType, modelIds, ...props }) {
|
|
40
|
+
const cache = setType === "always" ? this.#alwaysDrawn : this.#neverDrawn;
|
|
41
|
+
const getElements = (rootTreeNodes) => {
|
|
42
|
+
if (!rootTreeNodes) {
|
|
43
|
+
return new Map();
|
|
44
|
+
}
|
|
45
|
+
const pathToElements = [modelIds];
|
|
46
|
+
if ("categoryIds" in props && props.categoryIds) {
|
|
47
|
+
pathToElements.push(props.categoryIds);
|
|
48
|
+
if ("parentElementIdsPath" in props && props.parentElementIdsPath) {
|
|
49
|
+
props.parentElementIdsPath.forEach((parentElementIds) => pathToElements.push(parentElementIds));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return this.getChildrenTree({ currentChildrenTree: rootTreeNodes, pathToElements, currentIdsIndex: 0 });
|
|
53
|
+
};
|
|
54
|
+
return !cache.latestCacheEntryValue
|
|
55
|
+
? cache.cacheEntryObs.pipe(map(getElements))
|
|
56
|
+
: this.#suppressors.pipe(take(1), mergeMap((suppressionCount) => suppressionCount > 0 ? of(cache.latestCacheEntryValue).pipe(map(getElements)) : cache.cacheEntryObs.pipe(map(getElements))));
|
|
57
|
+
}
|
|
58
|
+
getChildrenTree({ currentChildrenTree, pathToElements, currentIdsIndex, }) {
|
|
59
|
+
if (currentIdsIndex >= pathToElements.length) {
|
|
60
|
+
return currentChildrenTree;
|
|
61
|
+
}
|
|
62
|
+
const result = new Map();
|
|
63
|
+
const currentParentIds = pathToElements[currentIdsIndex];
|
|
64
|
+
// currentParentIds is undefined - it means that we are getting children for categories that don't have model as parent
|
|
65
|
+
if (!currentParentIds) {
|
|
66
|
+
for (const entry of currentChildrenTree.values()) {
|
|
67
|
+
if (entry.children) {
|
|
68
|
+
const childrenTreeOfChildren = this.getChildrenTree({
|
|
69
|
+
currentChildrenTree: entry.children,
|
|
70
|
+
pathToElements,
|
|
71
|
+
currentIdsIndex: currentIdsIndex + 1,
|
|
72
|
+
});
|
|
73
|
+
childrenTreeOfChildren.forEach((val, childId) => result.set(childId, val));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
for (const parentId of Id64.iterable(currentParentIds)) {
|
|
79
|
+
const entry = currentChildrenTree.get(parentId);
|
|
80
|
+
if (entry?.children) {
|
|
81
|
+
const childrenTreeOfChildren = this.getChildrenTree({
|
|
82
|
+
currentChildrenTree: entry.children,
|
|
83
|
+
pathToElements,
|
|
84
|
+
currentIdsIndex: currentIdsIndex + 1,
|
|
85
|
+
});
|
|
86
|
+
childrenTreeOfChildren.forEach((val, childId) => result.set(childId, val));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
createCacheEntryObservable(setType) {
|
|
92
|
+
const event = setType === "always" ? this.#viewport.onAlwaysDrawnChanged : this.#viewport.onNeverDrawnChanged;
|
|
93
|
+
const getIds = setType === "always" ? () => this.#viewport.alwaysDrawn : () => this.#viewport.neverDrawn;
|
|
94
|
+
const resultSubject = new BehaviorSubject(undefined);
|
|
95
|
+
const obs = fromEventPattern((handler) => event.addListener(handler), (handler) => event.removeListener(handler)).pipe(
|
|
96
|
+
// Fire the observable once at the beginning
|
|
97
|
+
startWith(undefined),
|
|
98
|
+
// Reset result subject as soon as a new event is emitted.
|
|
99
|
+
// This will make newly subscribed observers wait for the debounce period to pass
|
|
100
|
+
// instead of consuming the cached value which at this point becomes invalid.
|
|
101
|
+
tap(() => resultSubject.next(undefined)),
|
|
102
|
+
// Check if cache updates are not suppressed.
|
|
103
|
+
switchMap(() => this.#suppressors.pipe(filter((suppressors) => suppressors === 0), take(1))), debounceTime(SET_CHANGE_DEBOUNCE_TIME),
|
|
104
|
+
// Cancel pending request if dispose() is called.
|
|
105
|
+
takeUntil(this.#disposeSubject),
|
|
106
|
+
// If multiple requests are sent at once, preserve only the result of the newest.
|
|
107
|
+
switchMap(() => this.queryAlwaysOrNeverDrawnElementInfo(getIds(), `${setType}Drawn`)), tap((cacheEntry) => {
|
|
108
|
+
const value = setType === "always" ? this.#alwaysDrawn : this.#neverDrawn;
|
|
109
|
+
value.latestCacheEntryValue = cacheEntry;
|
|
110
|
+
}),
|
|
111
|
+
// Share the result by using a subject which always emits the saved result.
|
|
112
|
+
share({
|
|
113
|
+
connector: () => resultSubject,
|
|
114
|
+
resetOnRefCountZero: false,
|
|
115
|
+
}),
|
|
116
|
+
// Wait until the result is available.
|
|
117
|
+
first((x) => !!x, new Map()));
|
|
118
|
+
return obs;
|
|
119
|
+
}
|
|
120
|
+
[Symbol.dispose]() {
|
|
121
|
+
this.#subscriptions.forEach((x) => x.unsubscribe());
|
|
122
|
+
this.#subscriptions = [];
|
|
123
|
+
this.#disposeSubject.next();
|
|
124
|
+
}
|
|
125
|
+
queryAlwaysOrNeverDrawnElementInfo(set, requestId) {
|
|
126
|
+
const elementInfo = set?.size
|
|
127
|
+
? from(set).pipe(bufferCount(getOptimalBatchSize({ totalSize: set.size, maximumBatchSize: 5000 })), releaseMainThreadOnItemsCount(2), mergeMap((block, index) => this.queryElementInfo(block, `${requestId}-${index}`), 10))
|
|
128
|
+
: EMPTY;
|
|
129
|
+
return elementInfo.pipe(releaseMainThreadOnItemsCount(500), reduce((acc, { categoryId, rootCategoryId, modelId, elementsPath }) => {
|
|
130
|
+
const elementIdInList = elementsPath[elementsPath.length - 1];
|
|
131
|
+
const additionalPropsGetter = (id, additionalProps) => {
|
|
132
|
+
if (id === elementIdInList) {
|
|
133
|
+
// Last element in elementsPath is in always/never drawn set. We want to mark, that it is in the set, and save it's categoryId.
|
|
134
|
+
return { isInAlwaysOrNeverDrawnSet: true, categoryId };
|
|
135
|
+
}
|
|
136
|
+
// Existing entries can keep their value, if it's a new entry it's not in the list.
|
|
137
|
+
return additionalProps ?? { isInAlwaysOrNeverDrawnSet: false };
|
|
138
|
+
};
|
|
139
|
+
updateChildrenTree({ tree: acc, idsToAdd: [modelId, rootCategoryId, ...elementsPath], additionalPropsGetter });
|
|
140
|
+
return acc;
|
|
141
|
+
}, (() => new Map())()));
|
|
142
|
+
}
|
|
143
|
+
queryElementInfo(elementIds, requestId) {
|
|
144
|
+
return defer(() => {
|
|
145
|
+
const executor = createECSqlQueryExecutor(this.#viewport.iModel);
|
|
146
|
+
const { elementClass } = this.#elementClassName
|
|
147
|
+
? { elementClass: this.#elementClassName }
|
|
148
|
+
: getClassesByView(this.#viewport.viewType === "2d" ? "2d" : "3d");
|
|
149
|
+
return executor.createQueryReader({
|
|
150
|
+
ctes: [
|
|
151
|
+
`
|
|
152
|
+
ElementInfo(modelId, rootCategoryId, categoryId, parentId, elementsPath) AS (
|
|
153
|
+
SELECT
|
|
154
|
+
Model.Id modelId,
|
|
155
|
+
Category.Id rootCategoryId,
|
|
156
|
+
Category.Id categoryId,
|
|
157
|
+
Parent.Id parentId,
|
|
158
|
+
CAST(IdToHex(ECInstanceId) AS TEXT) elementsPath
|
|
159
|
+
FROM ${elementClass}
|
|
160
|
+
WHERE InVirtualSet(?, ECInstanceId)
|
|
161
|
+
|
|
162
|
+
UNION ALL
|
|
163
|
+
|
|
164
|
+
SELECT
|
|
165
|
+
e.modelId modelId,
|
|
166
|
+
p.Category.Id rootCategoryId,
|
|
167
|
+
e.categoryId categoryId,
|
|
168
|
+
p.Parent.Id parentId,
|
|
169
|
+
CAST(IdToHex(p.ECInstanceId) AS TEXT) || ';' || e.elementsPath
|
|
170
|
+
FROM ${elementClass} p
|
|
171
|
+
JOIN ElementInfo e ON p.ECInstanceId = e.parentId
|
|
172
|
+
)
|
|
173
|
+
`,
|
|
174
|
+
],
|
|
175
|
+
ecsql: `
|
|
176
|
+
SELECT elementsPath elementsPath, modelId modelId, categoryId categoryId, rootCategoryId rootCategoryId
|
|
177
|
+
FROM ElementInfo
|
|
178
|
+
WHERE parentId IS NULL
|
|
179
|
+
`,
|
|
180
|
+
bindings: [{ type: "idset", value: elementIds }],
|
|
181
|
+
}, {
|
|
182
|
+
rowFormat: "ECSqlPropertyNames",
|
|
183
|
+
restartToken: `${this.#componentName}/${this.#componentId}/${requestId}`,
|
|
184
|
+
});
|
|
185
|
+
}).pipe(map((row) => {
|
|
186
|
+
return { elementsPath: row.elementsPath.split(";"), modelId: row.modelId, categoryId: row.categoryId, rootCategoryId: row.rootCategoryId };
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
189
|
+
getAlwaysOrNeverDrawnElements(props) {
|
|
190
|
+
return this.getElementsTree(props).pipe(map((childrenTree) => getIdsFromChildrenTree({ tree: childrenTree, predicate: ({ treeEntry }) => treeEntry.isInAlwaysOrNeverDrawnSet })));
|
|
191
|
+
}
|
|
192
|
+
clearAlwaysAndNeverDrawnElements(props) {
|
|
193
|
+
return forkJoin({
|
|
194
|
+
alwaysDrawn: this.getAlwaysOrNeverDrawnElements({ modelIds: props.modelId, categoryIds: props.categoryIds, setType: "always" }),
|
|
195
|
+
neverDrawn: this.getAlwaysOrNeverDrawnElements({ modelIds: props.modelId, categoryIds: props.categoryIds, setType: "never" }),
|
|
196
|
+
}).pipe(map(({ alwaysDrawn, neverDrawn }) => {
|
|
197
|
+
const viewport = this.#viewport;
|
|
198
|
+
if (viewport.alwaysDrawn?.size && alwaysDrawn.size) {
|
|
199
|
+
viewport.setAlwaysDrawn({ elementIds: setDifference(viewport.alwaysDrawn, alwaysDrawn) });
|
|
200
|
+
}
|
|
201
|
+
if (viewport.neverDrawn?.size && neverDrawn.size) {
|
|
202
|
+
viewport.setNeverDrawn({ elementIds: setDifference(viewport.neverDrawn, neverDrawn) });
|
|
203
|
+
}
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=AlwaysAndNeverDrawnElementInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlwaysAndNeverDrawnElementInfo.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EACL,eAAe,EACf,WAAW,EACX,YAAY,EACZ,KAAK,EACL,KAAK,EACL,MAAM,EACN,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,gBAAgB,EAChB,GAAG,EACH,QAAQ,EACR,EAAE,EACF,MAAM,EACN,IAAI,EACJ,KAAK,EACL,WAAW,EACX,SAAS,EACT,OAAO,EACP,SAAS,EACT,IAAI,EACJ,SAAS,EACT,GAAG,GACJ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,6BAA6B,EAAE,aAAa,EAAE,kB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CAAC,YAAY,EAAE,EAAE,CAAC,sBAAsB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,yBAAyB,EAAE,CAAC,CAAC,CACzI,CAAC;IACJ,CAAC;IAEM,gCAAgC,CAAC,KAAgE;QACtG,OAAO,QAAQ,CAAC;YACd,WAAW,EAAE,IAAI,CAAC,6BAA6B,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;YAC/H,UAAU,EAAE,IAAI,CAAC,6BAA6B,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;SAC9H,CAAC,CAAC,IAAI,CACL,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,EAAE,EAAE;YAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;YAChC,IAAI,QAAQ,CAAC,WAAW,EAAE,IAAI,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC;gBACnD,QAAQ,CAAC,cAAc,CAAC,EAAE,UAAU,EAAE,aAAa,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;YAC5F,CAAC;YACD,IAAI,QAAQ,CAAC,UAAU,EAAE,IAAI,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC;gBACjD,QAAQ,CAAC,aAAa,CAAC,EAAE,UAAU,EAAE,aAAa,CAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;YACzF,CAAC;QACH,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport {\n BehaviorSubject,\n bufferCount,\n debounceTime,\n defer,\n EMPTY,\n filter,\n first,\n forkJoin,\n from,\n fromEventPattern,\n map,\n mergeMap,\n of,\n reduce,\n scan,\n share,\n shareReplay,\n startWith,\n Subject,\n switchMap,\n take,\n takeUntil,\n tap,\n} from \"rxjs\";\nimport { Guid, Id64 } from \"@itwin/core-bentley\";\nimport { createECSqlQueryExecutor } from \"@itwin/presentation-core-interop\";\nimport { getClassesByView, getIdsFromChildrenTree, getOptimalBatchSize, releaseMainThreadOnItemsCount, setDifference, updateChildrenTree } from \"./Utils.js\";\n\nimport type { Observable, Subscription } from \"rxjs\";\nimport type { GuidString, Id64Arg, Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport type { TreeWidgetViewport } from \"../TreeWidgetViewport.js\";\nimport type { ChildrenTree } from \"./Utils.js\";\n\n/** @internal */\nexport const SET_CHANGE_DEBOUNCE_TIME = 20;\n\ntype SetType = \"always\" | \"never\";\n\ninterface GetElementsTreeByModelProps {\n /** Only always/never drawn elements that have the specified models will be returned. */\n modelIds: Id64Arg;\n /**\n * The type of set from which tree should be retrieved.\n * `always` - ChildrenTree will be created from `alwaysDrawn` set.\n * `never` - ChildrenTree will be created from `neverDrawn` set.\n */\n setType: SetType;\n}\ninterface GetElementsTreeByCategoryProps {\n modelIds: Id64Arg | undefined;\n /**\n * Categories of root elements.\n *\n * Elements are filtered by given categories. Children of those elements are also included, no matter their category.\n */\n categoryIds: Id64Arg;\n /**\n * The type of set from which tree should be retrieved.\n * `always` - ChildrenTree will be created from `alwaysDrawn` set.\n * `never` - ChildrenTree will be created from `neverDrawn` set.\n */\n setType: SetType;\n}\ninterface GetElementsTreeByElementProps extends GetElementsTreeByCategoryProps {\n /** Path to element for which to get its' child always/never drawn elements. When undefined, models and categories will be used to get the always/never drawn elements. */\n parentElementIdsPath: Array<Id64Arg>;\n}\n\n/** @internal */\nexport type GetElementsTreeProps = GetElementsTreeByModelProps | GetElementsTreeByCategoryProps | GetElementsTreeByElementProps;\n\n/**\n * - `categoryId` is assigned only to the elements in always/never drawn set.\n * - `isInAlwaysOrNeverDrawnSet` flag determines if key (ECInstanceId) is in always/never set.\n * @internal\n */\nexport type MapEntry = { isInAlwaysOrNeverDrawnSet: true; categoryId: Id64String } | { isInAlwaysOrNeverDrawnSet: false };\n\ntype CachedNodesMap = ChildrenTree<MapEntry>;\n\n/** @internal */\nexport class AlwaysAndNeverDrawnElementInfo implements Disposable {\n #subscriptions: Subscription[];\n #alwaysDrawn: { cacheEntryObs: Observable<CachedNodesMap>; latestCacheEntryValue?: CachedNodesMap };\n #neverDrawn: { cacheEntryObs: Observable<CachedNodesMap>; latestCacheEntryValue?: CachedNodesMap };\n #disposeSubject = new Subject<void>();\n readonly #viewport: TreeWidgetViewport;\n readonly #elementClassName?: string;\n #componentId: GuidString;\n #componentName: string;\n\n #suppressors: Observable<number>;\n #suppress = new Subject<boolean>();\n\n constructor(props: { viewport: TreeWidgetViewport; elementClassName?: string; componentId?: GuidString }) {\n this.#elementClassName = props.elementClassName;\n this.#viewport = props.viewport;\n this.#alwaysDrawn = { cacheEntryObs: this.createCacheEntryObservable(\"always\") };\n this.#neverDrawn = { cacheEntryObs: this.createCacheEntryObservable(\"never\") };\n this.#suppressors = this.#suppress.pipe(\n scan((acc, suppress) => acc + (suppress ? 1 : -1), 0),\n startWith(0),\n shareReplay(1),\n );\n this.#subscriptions = [this.#alwaysDrawn.cacheEntryObs.subscribe(), this.#neverDrawn.cacheEntryObs.subscribe()];\n this.#componentId = props.componentId ?? Guid.createValue();\n this.#componentName = \"AlwaysAndNeverDrawnElementInfo\";\n }\n\n public suppressChangeEvents() {\n this.#suppress.next(true);\n }\n\n public resumeChangeEvents() {\n this.#suppress.next(false);\n }\n\n public getElementsTree({ setType, modelIds, ...props }: GetElementsTreeProps): Observable<CachedNodesMap> {\n const cache = setType === \"always\" ? this.#alwaysDrawn : this.#neverDrawn;\n const getElements = (rootTreeNodes: CachedNodesMap | undefined): CachedNodesMap => {\n if (!rootTreeNodes) {\n return new Map();\n }\n const pathToElements = [modelIds];\n if (\"categoryIds\" in props && props.categoryIds) {\n pathToElements.push(props.categoryIds);\n if (\"parentElementIdsPath\" in props && props.parentElementIdsPath) {\n props.parentElementIdsPath.forEach((parentElementIds) => pathToElements.push(parentElementIds));\n }\n }\n return this.getChildrenTree({ currentChildrenTree: rootTreeNodes, pathToElements, currentIdsIndex: 0 });\n };\n\n return !cache.latestCacheEntryValue\n ? cache.cacheEntryObs.pipe(map(getElements))\n : this.#suppressors.pipe(\n take(1),\n mergeMap((suppressionCount) =>\n suppressionCount > 0 ? of(cache.latestCacheEntryValue).pipe(map(getElements)) : cache.cacheEntryObs.pipe(map(getElements)),\n ),\n );\n }\n\n private getChildrenTree<T extends object>({\n currentChildrenTree,\n pathToElements,\n currentIdsIndex,\n }: {\n currentChildrenTree: ChildrenTree<T>;\n pathToElements: Array<Id64Arg | undefined>;\n currentIdsIndex: number;\n }): ChildrenTree<T> {\n if (currentIdsIndex >= pathToElements.length) {\n return currentChildrenTree;\n }\n const result: ChildrenTree<T> = new Map();\n const currentParentIds = pathToElements[currentIdsIndex];\n // currentParentIds is undefined - it means that we are getting children for categories that don't have model as parent\n if (!currentParentIds) {\n for (const entry of currentChildrenTree.values()) {\n if (entry.children) {\n const childrenTreeOfChildren = this.getChildrenTree({\n currentChildrenTree: entry.children,\n pathToElements,\n currentIdsIndex: currentIdsIndex + 1,\n });\n childrenTreeOfChildren.forEach((val, childId) => result.set(childId, val));\n }\n }\n return result;\n }\n for (const parentId of Id64.iterable(currentParentIds)) {\n const entry = currentChildrenTree.get(parentId);\n if (entry?.children) {\n const childrenTreeOfChildren = this.getChildrenTree({\n currentChildrenTree: entry.children,\n pathToElements,\n currentIdsIndex: currentIdsIndex + 1,\n });\n childrenTreeOfChildren.forEach((val, childId) => result.set(childId, val));\n }\n }\n return result;\n }\n\n private createCacheEntryObservable(setType: SetType): Observable<CachedNodesMap> {\n const event = setType === \"always\" ? this.#viewport.onAlwaysDrawnChanged : this.#viewport.onNeverDrawnChanged;\n const getIds = setType === \"always\" ? () => this.#viewport.alwaysDrawn : () => this.#viewport.neverDrawn;\n\n const resultSubject = new BehaviorSubject<CachedNodesMap | undefined>(undefined);\n\n const obs = fromEventPattern(\n (handler) => event.addListener(handler),\n (handler) => event.removeListener(handler),\n ).pipe(\n // Fire the observable once at the beginning\n startWith(undefined),\n // Reset result subject as soon as a new event is emitted.\n // This will make newly subscribed observers wait for the debounce period to pass\n // instead of consuming the cached value which at this point becomes invalid.\n tap(() => resultSubject.next(undefined)),\n // Check if cache updates are not suppressed.\n switchMap(() =>\n this.#suppressors.pipe(\n filter((suppressors) => suppressors === 0),\n take(1),\n ),\n ),\n debounceTime(SET_CHANGE_DEBOUNCE_TIME),\n // Cancel pending request if dispose() is called.\n takeUntil(this.#disposeSubject),\n // If multiple requests are sent at once, preserve only the result of the newest.\n switchMap(() => this.queryAlwaysOrNeverDrawnElementInfo(getIds(), `${setType}Drawn`)),\n tap((cacheEntry) => {\n const value = setType === \"always\" ? this.#alwaysDrawn : this.#neverDrawn;\n value.latestCacheEntryValue = cacheEntry;\n }),\n // Share the result by using a subject which always emits the saved result.\n share({\n connector: () => resultSubject,\n resetOnRefCountZero: false,\n }),\n // Wait until the result is available.\n first((x): x is CachedNodesMap => !!x, new Map()),\n );\n return obs;\n }\n\n public [Symbol.dispose](): void {\n this.#subscriptions.forEach((x) => x.unsubscribe());\n this.#subscriptions = [];\n this.#disposeSubject.next();\n }\n\n private queryAlwaysOrNeverDrawnElementInfo(set: ReadonlySet<Id64String> | undefined, requestId: string): Observable<CachedNodesMap> {\n const elementInfo = set?.size\n ? from(set).pipe(\n bufferCount(getOptimalBatchSize({ totalSize: set.size, maximumBatchSize: 5000 })),\n releaseMainThreadOnItemsCount(2),\n mergeMap((block, index) => this.queryElementInfo(block, `${requestId}-${index}`), 10),\n )\n : EMPTY;\n return elementInfo.pipe(\n releaseMainThreadOnItemsCount(500),\n reduce(\n (acc, { categoryId, rootCategoryId, modelId, elementsPath }) => {\n const elementIdInList = elementsPath[elementsPath.length - 1];\n const additionalPropsGetter = (id: Id64String, additionalProps?: MapEntry): MapEntry => {\n if (id === elementIdInList) {\n // Last element in elementsPath is in always/never drawn set. We want to mark, that it is in the set, and save it's categoryId.\n return { isInAlwaysOrNeverDrawnSet: true, categoryId };\n }\n // Existing entries can keep their value, if it's a new entry it's not in the list.\n return additionalProps ?? { isInAlwaysOrNeverDrawnSet: false };\n };\n updateChildrenTree({ tree: acc, idsToAdd: [modelId, rootCategoryId, ...elementsPath], additionalPropsGetter });\n return acc;\n },\n ((): CachedNodesMap => new Map())(),\n ),\n );\n }\n\n private queryElementInfo(\n elementIds: Id64Array,\n requestId: string,\n ): Observable<{\n rootCategoryId: Id64String;\n modelId: Id64String;\n categoryId: Id64String;\n elementsPath: Id64Array;\n }> {\n return defer(() => {\n const executor = createECSqlQueryExecutor(this.#viewport.iModel);\n const { elementClass } = this.#elementClassName\n ? { elementClass: this.#elementClassName }\n : getClassesByView(this.#viewport.viewType === \"2d\" ? \"2d\" : \"3d\");\n return executor.createQueryReader(\n {\n ctes: [\n `\n ElementInfo(modelId, rootCategoryId, categoryId, parentId, elementsPath) AS (\n SELECT\n Model.Id modelId,\n Category.Id rootCategoryId,\n Category.Id categoryId,\n Parent.Id parentId,\n CAST(IdToHex(ECInstanceId) AS TEXT) elementsPath\n FROM ${elementClass}\n WHERE InVirtualSet(?, ECInstanceId)\n\n UNION ALL\n\n SELECT\n e.modelId modelId,\n p.Category.Id rootCategoryId,\n e.categoryId categoryId,\n p.Parent.Id parentId,\n CAST(IdToHex(p.ECInstanceId) AS TEXT) || ';' || e.elementsPath\n FROM ${elementClass} p\n JOIN ElementInfo e ON p.ECInstanceId = e.parentId\n )\n `,\n ],\n ecsql: `\n SELECT elementsPath elementsPath, modelId modelId, categoryId categoryId, rootCategoryId rootCategoryId\n FROM ElementInfo\n WHERE parentId IS NULL\n `,\n bindings: [{ type: \"idset\", value: elementIds }],\n },\n {\n rowFormat: \"ECSqlPropertyNames\",\n restartToken: `${this.#componentName}/${this.#componentId}/${requestId}`,\n },\n );\n }).pipe(\n map((row) => {\n return { elementsPath: row.elementsPath.split(\";\"), modelId: row.modelId, categoryId: row.categoryId, rootCategoryId: row.rootCategoryId };\n }),\n );\n }\n\n public getAlwaysOrNeverDrawnElements(props: GetElementsTreeProps) {\n return this.getElementsTree(props).pipe(\n map((childrenTree) => getIdsFromChildrenTree({ tree: childrenTree, predicate: ({ treeEntry }) => treeEntry.isInAlwaysOrNeverDrawnSet })),\n );\n }\n\n public clearAlwaysAndNeverDrawnElements(props: { categoryIds: Id64Arg; modelId: Id64String | undefined }) {\n return forkJoin({\n alwaysDrawn: this.getAlwaysOrNeverDrawnElements({ modelIds: props.modelId, categoryIds: props.categoryIds, setType: \"always\" }),\n neverDrawn: this.getAlwaysOrNeverDrawnElements({ modelIds: props.modelId, categoryIds: props.categoryIds, setType: \"never\" }),\n }).pipe(\n map(({ alwaysDrawn, neverDrawn }) => {\n const viewport = this.#viewport;\n if (viewport.alwaysDrawn?.size && alwaysDrawn.size) {\n viewport.setAlwaysDrawn({ elementIds: setDifference(viewport.alwaysDrawn, alwaysDrawn) });\n }\n if (viewport.neverDrawn?.size && neverDrawn.size) {\n viewport.setNeverDrawn({ elementIds: setDifference(viewport.neverDrawn, neverDrawn) });\n }\n }),\n );\n }\n}\n"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** @internal */
|
|
2
|
+
export declare const CLASS_NAME_Subject = "BisCore.Subject";
|
|
3
|
+
/** @internal */
|
|
4
|
+
export declare const CLASS_NAME_Category = "BisCore.Category";
|
|
5
|
+
/** @internal */
|
|
6
|
+
export declare const CLASS_NAME_SpatialCategory = "BisCore.SpatialCategory";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export declare const CLASS_NAME_DrawingCategory = "BisCore.DrawingCategory";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare const CLASS_NAME_SubCategory = "BisCore.SubCategory";
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare const CLASS_NAME_DefinitionContainer = "BisCore.DefinitionContainer";
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare const CLASS_NAME_DefinitionElement = "BisCore.DefinitionElement";
|
|
15
|
+
/** @internal */
|
|
16
|
+
export declare const CLASS_NAME_DefinitionModel = "BisCore.DefinitionModel";
|
|
17
|
+
/** @internal */
|
|
18
|
+
export declare const CLASS_NAME_Element = "BisCore.Element";
|
|
19
|
+
/** @internal */
|
|
20
|
+
export declare const CLASS_NAME_InformationPartitionElement = "BisCore.InformationPartitionElement";
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const CLASS_NAME_GeometricElement = "BisCore.GeometricElement";
|
|
23
|
+
/** @internal */
|
|
24
|
+
export declare const CLASS_NAME_GeometricElement2d = "BisCore.GeometricElement2d";
|
|
25
|
+
/** @internal */
|
|
26
|
+
export declare const CLASS_NAME_GeometricElement3d = "BisCore.GeometricElement3d";
|
|
27
|
+
/** @internal */
|
|
28
|
+
export declare const CLASS_NAME_ISubModeledElement = "BisCore.ISubModeledElement";
|
|
29
|
+
/** @internal */
|
|
30
|
+
export declare const CLASS_NAME_Model = "BisCore.Model";
|
|
31
|
+
/** @internal */
|
|
32
|
+
export declare const CLASS_NAME_GeometricModel2d = "BisCore.GeometricModel2d";
|
|
33
|
+
/** @internal */
|
|
34
|
+
export declare const CLASS_NAME_GeometricModel3d = "BisCore.GeometricModel3d";
|
|
35
|
+
/** @internal */
|
|
36
|
+
export declare const CLASS_NAME_ClassificationSystem = "ClassificationSystems.ClassificationSystem";
|
|
37
|
+
/** @internal */
|
|
38
|
+
export declare const CLASS_NAME_ClassificationTable = "ClassificationSystems.ClassificationTable";
|
|
39
|
+
/** @internal */
|
|
40
|
+
export declare const CLASS_NAME_Classification = "ClassificationSystems.Classification";
|
|
41
|
+
/** @internal */
|
|
42
|
+
export declare const CLASS_NAME_ElementHasClassifications = "ClassificationSystems.ElementHasClassifications";
|
|
43
|
+
//# sourceMappingURL=ClassNameDefinitions.d.ts.map
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
/** @internal */
|
|
6
|
+
export const CLASS_NAME_Subject = "BisCore.Subject";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export const CLASS_NAME_Category = "BisCore.Category";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export const CLASS_NAME_SpatialCategory = "BisCore.SpatialCategory";
|
|
11
|
+
/** @internal */
|
|
12
|
+
export const CLASS_NAME_DrawingCategory = "BisCore.DrawingCategory";
|
|
13
|
+
/** @internal */
|
|
14
|
+
export const CLASS_NAME_SubCategory = "BisCore.SubCategory";
|
|
15
|
+
/** @internal */
|
|
16
|
+
export const CLASS_NAME_DefinitionContainer = "BisCore.DefinitionContainer";
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const CLASS_NAME_DefinitionElement = "BisCore.DefinitionElement";
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const CLASS_NAME_DefinitionModel = "BisCore.DefinitionModel";
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const CLASS_NAME_Element = "BisCore.Element";
|
|
23
|
+
/** @internal */
|
|
24
|
+
export const CLASS_NAME_InformationPartitionElement = "BisCore.InformationPartitionElement";
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const CLASS_NAME_GeometricElement = "BisCore.GeometricElement";
|
|
27
|
+
/** @internal */
|
|
28
|
+
export const CLASS_NAME_GeometricElement2d = "BisCore.GeometricElement2d";
|
|
29
|
+
/** @internal */
|
|
30
|
+
export const CLASS_NAME_GeometricElement3d = "BisCore.GeometricElement3d";
|
|
31
|
+
/** @internal */
|
|
32
|
+
export const CLASS_NAME_ISubModeledElement = "BisCore.ISubModeledElement";
|
|
33
|
+
/** @internal */
|
|
34
|
+
export const CLASS_NAME_Model = "BisCore.Model";
|
|
35
|
+
/** @internal */
|
|
36
|
+
export const CLASS_NAME_GeometricModel2d = "BisCore.GeometricModel2d";
|
|
37
|
+
/** @internal */
|
|
38
|
+
export const CLASS_NAME_GeometricModel3d = "BisCore.GeometricModel3d";
|
|
39
|
+
/** @internal */
|
|
40
|
+
export const CLASS_NAME_ClassificationSystem = "ClassificationSystems.ClassificationSystem";
|
|
41
|
+
/** @internal */
|
|
42
|
+
export const CLASS_NAME_ClassificationTable = "ClassificationSystems.ClassificationTable";
|
|
43
|
+
/** @internal */
|
|
44
|
+
export const CLASS_NAME_Classification = "ClassificationSystems.Classification";
|
|
45
|
+
/** @internal */
|
|
46
|
+
export const CLASS_NAME_ElementHasClassifications = "ClassificationSystems.ElementHasClassifications";
|
|
47
|
+
//# sourceMappingURL=ClassNameDefinitions.js.map
|
package/lib/esm/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClassNameDefinitions.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AAEpD,gBAAgB;AAChB,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AACtD,gBAAgB;AAChB,MAAM,CAAC,MAAM,0BAA0B,GAAG,yBAAyB,CAAC;AACpE,gBAAgB;AAChB,MAAM,CAAC,MAAM,0BAA0B,GAAG,yBAAyB,CAAC;AACpE,gBAAgB;AAChB,MAAM,CAAC,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AAE5D,gBAAgB;AAChB,MAAM,CAAC,MAAM,8BAA8B,GAAG,6BAA6B,CAAC;AAC5E,gBAAgB;AAChB,MAAM,CAAC,MAAM,4BAA4B,GAAG,2BAA2B,CAAC;AACxE,gBAAgB;AAChB,MAAM,CAAC,MAAM,0BAA0B,GAAG,yBAAyB,CAAC;AAEpE,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AACpD,gBAAgB;AAChB,MAAM,CAAC,MAAM,sCAAsC,GAAG,qCAAqC,CAAC;AAC5F,gBAAgB;AAChB,MAAM,CAAC,MAAM,2BAA2B,GAAG,0BAA0B,CAAC;AACtE,gBAAgB;AAChB,MAAM,CAAC,MAAM,6BAA6B,GAAG,4BAA4B,CAAC;AAC1E,gBAAgB;AAChB,MAAM,CAAC,MAAM,6BAA6B,GAAG,4BAA4B,CAAC;AAE1E,gBAAgB;AAChB,MAAM,CAAC,MAAM,6BAA6B,GAAG,4BAA4B,CAAC;AAE1E,gBAAgB;AAChB,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAChD,gBAAgB;AAChB,MAAM,CAAC,MAAM,2BAA2B,GAAG,0BAA0B,CAAC;AACtE,gBAAgB;AAChB,MAAM,CAAC,MAAM,2BAA2B,GAAG,0BAA0B,CAAC;AAEtE,gBAAgB;AAChB,MAAM,CAAC,MAAM,+BAA+B,GAAG,4CAA4C,CAAC;AAC5F,gBAAgB;AAChB,MAAM,CAAC,MAAM,8BAA8B,GAAG,2CAA2C,CAAC;AAC1F,gBAAgB;AAChB,MAAM,CAAC,MAAM,yBAAyB,GAAG,sCAAsC,CAAC;AAChF,gBAAgB;AAChB,MAAM,CAAC,MAAM,oCAAoC,GAAG,iDAAiD,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\n/** @internal */\nexport const CLASS_NAME_Subject = \"BisCore.Subject\";\n\n/** @internal */\nexport const CLASS_NAME_Category = \"BisCore.Category\";\n/** @internal */\nexport const CLASS_NAME_SpatialCategory = \"BisCore.SpatialCategory\";\n/** @internal */\nexport const CLASS_NAME_DrawingCategory = \"BisCore.DrawingCategory\";\n/** @internal */\nexport const CLASS_NAME_SubCategory = \"BisCore.SubCategory\";\n\n/** @internal */\nexport const CLASS_NAME_DefinitionContainer = \"BisCore.DefinitionContainer\";\n/** @internal */\nexport const CLASS_NAME_DefinitionElement = \"BisCore.DefinitionElement\";\n/** @internal */\nexport const CLASS_NAME_DefinitionModel = \"BisCore.DefinitionModel\";\n\n/** @internal */\nexport const CLASS_NAME_Element = \"BisCore.Element\";\n/** @internal */\nexport const CLASS_NAME_InformationPartitionElement = \"BisCore.InformationPartitionElement\";\n/** @internal */\nexport const CLASS_NAME_GeometricElement = \"BisCore.GeometricElement\";\n/** @internal */\nexport const CLASS_NAME_GeometricElement2d = \"BisCore.GeometricElement2d\";\n/** @internal */\nexport const CLASS_NAME_GeometricElement3d = \"BisCore.GeometricElement3d\";\n\n/** @internal */\nexport const CLASS_NAME_ISubModeledElement = \"BisCore.ISubModeledElement\";\n\n/** @internal */\nexport const CLASS_NAME_Model = \"BisCore.Model\";\n/** @internal */\nexport const CLASS_NAME_GeometricModel2d = \"BisCore.GeometricModel2d\";\n/** @internal */\nexport const CLASS_NAME_GeometricModel3d = \"BisCore.GeometricModel3d\";\n\n/** @internal */\nexport const CLASS_NAME_ClassificationSystem = \"ClassificationSystems.ClassificationSystem\";\n/** @internal */\nexport const CLASS_NAME_ClassificationTable = \"ClassificationSystems.ClassificationTable\";\n/** @internal */\nexport const CLASS_NAME_Classification = \"ClassificationSystems.Classification\";\n/** @internal */\nexport const CLASS_NAME_ElementHasClassifications = \"ClassificationSystems.ElementHasClassifications\";\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Observable } from "rxjs";
|
|
2
|
+
import type { GuidString, Id64String } from "@itwin/core-bentley";
|
|
3
|
+
import type { LimitingECSqlQueryExecutor } from "@itwin/presentation-hierarchies";
|
|
4
|
+
/** @internal */
|
|
5
|
+
export declare class ModelCategoryElementsCountCache implements Disposable {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(queryExecutor: LimitingECSqlQueryExecutor, elementsClassNames: string[], componentId: GuidString);
|
|
8
|
+
private queryCategoryElementCounts;
|
|
9
|
+
[Symbol.dispose](): void;
|
|
10
|
+
getCategoryElementsCount(modelId: Id64String, categoryId: Id64String): Observable<number>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ModelCategoryElementsCountCache.d.ts.map
|
|
@@ -0,0 +1,112 @@
|
|
|
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 { bufferCount, bufferTime, defer, filter, from, map, mergeAll, mergeMap, reduce, ReplaySubject, Subject, take, toArray } from "rxjs";
|
|
6
|
+
import { assert, Guid } from "@itwin/core-bentley";
|
|
7
|
+
import { releaseMainThreadOnItemsCount } from "./Utils.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export class ModelCategoryElementsCountCache {
|
|
10
|
+
#cache = new Map();
|
|
11
|
+
#requestsStream = new Subject();
|
|
12
|
+
#subscription;
|
|
13
|
+
#queryExecutor;
|
|
14
|
+
#elementsClassNames;
|
|
15
|
+
#componentId;
|
|
16
|
+
#componentName;
|
|
17
|
+
constructor(queryExecutor, elementsClassNames, componentId) {
|
|
18
|
+
this.#componentId = componentId;
|
|
19
|
+
this.#queryExecutor = queryExecutor;
|
|
20
|
+
this.#elementsClassNames = elementsClassNames;
|
|
21
|
+
this.#componentName = "ModelCategoryElementsCountCache";
|
|
22
|
+
this.#subscription = this.#requestsStream
|
|
23
|
+
.pipe(bufferTime(20), filter((requests) => requests.length > 0), mergeMap((requests) => this.queryCategoryElementCounts(requests)), mergeAll())
|
|
24
|
+
.subscribe({
|
|
25
|
+
next: ({ modelId, categoryId, elementsCount }) => {
|
|
26
|
+
const subject = this.#cache.get(`${modelId}-${categoryId}`);
|
|
27
|
+
assert(!!subject);
|
|
28
|
+
subject.next(elementsCount);
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
queryCategoryElementCounts(input) {
|
|
33
|
+
return from(input).pipe(reduce((acc, { modelId, categoryId }) => {
|
|
34
|
+
const entry = acc.get(modelId);
|
|
35
|
+
if (!entry) {
|
|
36
|
+
acc.set(modelId, new Set([categoryId]));
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
entry.add(categoryId);
|
|
40
|
+
}
|
|
41
|
+
return acc;
|
|
42
|
+
}, new Map()), mergeMap((modelCategoryMap) => modelCategoryMap.entries()), map(([modelId, categoryIds]) => `Model.Id = ${modelId} AND Category.Id IN (${[...categoryIds].join(", ")})`),
|
|
43
|
+
// we may have thousands of where clauses here, and sending a single query with all of them could take a
|
|
44
|
+
// long time - instead, split it into smaller chunks
|
|
45
|
+
bufferCount(100), mergeMap((whereClauses) => defer(() => this.#queryExecutor.createQueryReader({
|
|
46
|
+
ctes: this.#elementsClassNames.map((elementsClassName, index) => `
|
|
47
|
+
CategoryElements${index}(id, modelId, categoryId) AS (
|
|
48
|
+
SELECT ECInstanceId, Model.Id, Category.Id
|
|
49
|
+
FROM ${elementsClassName}
|
|
50
|
+
WHERE
|
|
51
|
+
Parent.Id IS NULL
|
|
52
|
+
AND (
|
|
53
|
+
${whereClauses.join(" OR ")}
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
UNION ALL
|
|
57
|
+
|
|
58
|
+
SELECT c.ECInstanceId, p.modelId, p.categoryId
|
|
59
|
+
FROM ${elementsClassName} c
|
|
60
|
+
JOIN CategoryElements${index} p ON c.Parent.Id = p.id
|
|
61
|
+
)
|
|
62
|
+
`),
|
|
63
|
+
ecsql: `
|
|
64
|
+
SELECT modelId, categoryId, COUNT(id) elementsCount
|
|
65
|
+
FROM (
|
|
66
|
+
${this.#elementsClassNames
|
|
67
|
+
.map((_, index) => `
|
|
68
|
+
SELECT * FROM CategoryElements${index}
|
|
69
|
+
`)
|
|
70
|
+
.join(" UNION ALL ")}
|
|
71
|
+
)
|
|
72
|
+
GROUP BY modelId, categoryId
|
|
73
|
+
`,
|
|
74
|
+
}, {
|
|
75
|
+
rowFormat: "ECSqlPropertyNames",
|
|
76
|
+
limit: "unbounded",
|
|
77
|
+
restartToken: `${this.#componentName}/${this.#componentId}/category-element-counts/${Guid.createValue()}`,
|
|
78
|
+
}))), releaseMainThreadOnItemsCount(500), reduce(({ acc, createKey }, row) => {
|
|
79
|
+
acc.set(createKey({ modelId: row.modelId, categoryId: row.categoryId }), {
|
|
80
|
+
modelId: row.modelId,
|
|
81
|
+
categoryId: row.categoryId,
|
|
82
|
+
elementsCount: row.elementsCount,
|
|
83
|
+
});
|
|
84
|
+
return { acc, createKey };
|
|
85
|
+
}, {
|
|
86
|
+
acc: new Map(),
|
|
87
|
+
createKey: (keyProps) => `${keyProps.modelId}-${keyProps.categoryId}`,
|
|
88
|
+
}), mergeMap(({ acc: result, createKey }) => {
|
|
89
|
+
input.forEach(({ modelId, categoryId }) => {
|
|
90
|
+
if (!result.has(createKey({ modelId, categoryId }))) {
|
|
91
|
+
result.set(createKey({ modelId, categoryId }), { categoryId, modelId, elementsCount: 0 });
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
return from(result.values());
|
|
95
|
+
}), toArray());
|
|
96
|
+
}
|
|
97
|
+
[Symbol.dispose]() {
|
|
98
|
+
this.#subscription.unsubscribe();
|
|
99
|
+
}
|
|
100
|
+
getCategoryElementsCount(modelId, categoryId) {
|
|
101
|
+
const cacheKey = `${modelId}-${categoryId}`;
|
|
102
|
+
let result = this.#cache.get(cacheKey);
|
|
103
|
+
if (result !== undefined) {
|
|
104
|
+
return from(result).pipe(take(1));
|
|
105
|
+
}
|
|
106
|
+
result = new ReplaySubject(1);
|
|
107
|
+
this.#cache.set(cacheKey, result);
|
|
108
|
+
this.#requestsStream.next({ modelId, categoryId });
|
|
109
|
+
return from(result).pipe(take(1));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=ModelCategoryElementsCountCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelCategoryElementsCountCache.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC5I,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAS3D,gBAAgB;AAChB,MAAM,OAAO,+BAA+B;IAC1C,MAAM,GAAG,IAAI,GAAG,EAAqC,CAAC;IACtD,eAAe,GAAG,IAAI,OAAO,EAAmD,CAAC;IACjF,aAAa,CAAe;IAC5B,cAAc,CAA6B;IAC3C,mBAAmB,CAAW;IAC9B,YAAY,CAAa;IACzB,cAAc,CAAS;IAEvB,YAAmB,aAAyC,EAAE,kBAA4B,EAAE,WAAuB;QACjH,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAChC,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,mBAAmB,GAAG,kBAAkB,CAAC;QAC9C,IAAI,CAAC,cAAc,GAAG,iCAAiC,CAAC;QACxD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,eAAe;aACtC,IAAI,CACH,UAAU,CAAC,EAAE,CAAC,EACd,MAAM,CAAC,C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,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAClC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,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 { bufferCount, bufferTime, defer, filter, from, map, mergeAll, mergeMap, reduce, ReplaySubject, Subject, take, toArray } from \"rxjs\";\nimport { assert, Guid } from \"@itwin/core-bentley\";\nimport { releaseMainThreadOnItemsCount } from \"./Utils.js\";\n\nimport type { Observable, Subscription } from \"rxjs\";\nimport type { GuidString, Id64Set, Id64String } from \"@itwin/core-bentley\";\nimport type { LimitingECSqlQueryExecutor } from \"@itwin/presentation-hierarchies\";\nimport type { CategoryId, ModelId } from \"./Types.js\";\n\ntype ModelCategoryKey = `${ModelId}-${CategoryId}`;\n\n/** @internal */\nexport class ModelCategoryElementsCountCache implements Disposable {\n #cache = new Map<ModelCategoryKey, Subject<number>>();\n #requestsStream = new Subject<{ modelId: Id64String; categoryId: Id64String }>();\n #subscription: Subscription;\n #queryExecutor: LimitingECSqlQueryExecutor;\n #elementsClassNames: string[];\n #componentId: GuidString;\n #componentName: string;\n\n public constructor(queryExecutor: LimitingECSqlQueryExecutor, elementsClassNames: string[], componentId: GuidString) {\n this.#componentId = componentId;\n this.#queryExecutor = queryExecutor;\n this.#elementsClassNames = elementsClassNames;\n this.#componentName = \"ModelCategoryElementsCountCache\";\n this.#subscription = this.#requestsStream\n .pipe(\n bufferTime(20),\n filter((requests) => requests.length > 0),\n mergeMap((requests) => this.queryCategoryElementCounts(requests)),\n mergeAll(),\n )\n .subscribe({\n next: ({ modelId, categoryId, elementsCount }) => {\n const subject = this.#cache.get(`${modelId}-${categoryId}`);\n assert(!!subject);\n subject.next(elementsCount);\n },\n });\n }\n\n private queryCategoryElementCounts(\n input: Array<{ modelId: Id64String; categoryId: Id64String }>,\n ): Observable<Array<{ modelId: Id64String; categoryId: Id64String; elementsCount: number }>> {\n return from(input).pipe(\n reduce((acc, { modelId, categoryId }) => {\n const entry = acc.get(modelId);\n if (!entry) {\n acc.set(modelId, new Set([categoryId]));\n } else {\n entry.add(categoryId);\n }\n return acc;\n }, new Map<Id64String, Id64Set>()),\n mergeMap((modelCategoryMap) => modelCategoryMap.entries()),\n map(([modelId, categoryIds]) => `Model.Id = ${modelId} AND Category.Id IN (${[...categoryIds].join(\", \")})`),\n // we may have thousands of where clauses here, and sending a single query with all of them could take a\n // long time - instead, split it into smaller chunks\n bufferCount(100),\n mergeMap((whereClauses) =>\n defer(() =>\n this.#queryExecutor.createQueryReader(\n {\n ctes: this.#elementsClassNames.map(\n (elementsClassName, index) => `\n CategoryElements${index}(id, modelId, categoryId) AS (\n SELECT ECInstanceId, Model.Id, Category.Id\n FROM ${elementsClassName}\n WHERE\n Parent.Id IS NULL\n AND (\n ${whereClauses.join(\" OR \")}\n )\n\n UNION ALL\n\n SELECT c.ECInstanceId, p.modelId, p.categoryId\n FROM ${elementsClassName} c\n JOIN CategoryElements${index} p ON c.Parent.Id = p.id\n )\n `,\n ),\n ecsql: `\n SELECT modelId, categoryId, COUNT(id) elementsCount\n FROM (\n ${this.#elementsClassNames\n .map(\n (_, index) => `\n SELECT * FROM CategoryElements${index}\n `,\n )\n .join(\" UNION ALL \")}\n )\n GROUP BY modelId, categoryId\n `,\n },\n {\n rowFormat: \"ECSqlPropertyNames\",\n limit: \"unbounded\",\n restartToken: `${this.#componentName}/${this.#componentId}/category-element-counts/${Guid.createValue()}`,\n },\n ),\n ),\n ),\n releaseMainThreadOnItemsCount(500),\n reduce(\n ({ acc, createKey }, row) => {\n acc.set(createKey({ modelId: row.modelId, categoryId: row.categoryId }), {\n modelId: row.modelId,\n categoryId: row.categoryId,\n elementsCount: row.elementsCount,\n });\n return { acc, createKey };\n },\n {\n acc: new Map<string, { modelId: Id64String; categoryId: Id64String; elementsCount: number }>(),\n createKey: (keyProps: { modelId: Id64String; categoryId: Id64String }) => `${keyProps.modelId}-${keyProps.categoryId}`,\n },\n ),\n mergeMap(({ acc: result, createKey }) => {\n input.forEach(({ modelId, categoryId }) => {\n if (!result.has(createKey({ modelId, categoryId }))) {\n result.set(createKey({ modelId, categoryId }), { categoryId, modelId, elementsCount: 0 });\n }\n });\n\n return from(result.values());\n }),\n toArray(),\n );\n }\n\n public [Symbol.dispose]() {\n this.#subscription.unsubscribe();\n }\n\n public getCategoryElementsCount(modelId: Id64String, categoryId: Id64String): Observable<number> {\n const cacheKey: ModelCategoryKey = `${modelId}-${categoryId}`;\n let result = this.#cache.get(cacheKey);\n if (result !== undefined) {\n return from(result).pipe(take(1));\n }\n\n result = new ReplaySubject(1);\n this.#cache.set(cacheKey, result);\n this.#requestsStream.next({ modelId, categoryId });\n return from(result).pipe(take(1));\n }\n}\n"]}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import type { Observable, ObservableInput, OperatorFunction } from "rxjs";
|
|
2
2
|
/**
|
|
3
3
|
* Applies reduce function and "returns" early if the predicate returns `false` for the accumulator.
|
|
4
|
+
* @internal
|
|
4
5
|
*/
|
|
5
6
|
export declare function reduceWhile<TValue, TAccumulator>(predicate: (x: TAccumulator) => boolean, reduceFunc: (acc: TAccumulator, val: TValue) => TAccumulator, initial: TAccumulator): OperatorFunction<TValue, TAccumulator | undefined>;
|
|
6
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Same as `firstValueFrom` except it won't throw if the observable emits no values.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
7
11
|
export declare function toVoidPromise(obs: Observable<any>): Promise<void>;
|
|
8
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Returns observable results in an array
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
9
16
|
export declare function collect<T>(obs: ObservableInput<T>): Promise<T[]>;
|
|
10
17
|
//# sourceMappingURL=Rxjs.d.ts.map
|
|
@@ -5,13 +5,17 @@
|
|
|
5
5
|
import { defaultIfEmpty, from, last, scan, takeWhile } from "rxjs";
|
|
6
6
|
/**
|
|
7
7
|
* Applies reduce function and "returns" early if the predicate returns `false` for the accumulator.
|
|
8
|
+
* @internal
|
|
8
9
|
*/
|
|
9
10
|
export function reduceWhile(predicate, reduceFunc, initial) {
|
|
10
11
|
return (obs) => {
|
|
11
12
|
return obs.pipe(scan(reduceFunc, initial), takeWhile(predicate, true), defaultIfEmpty(undefined), last());
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Same as `firstValueFrom` except it won't throw if the observable emits no values.
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
15
19
|
export async function toVoidPromise(obs) {
|
|
16
20
|
return new Promise((resolve, reject) => {
|
|
17
21
|
obs.subscribe({
|
|
@@ -20,7 +24,10 @@ export async function toVoidPromise(obs) {
|
|
|
20
24
|
});
|
|
21
25
|
});
|
|
22
26
|
}
|
|
23
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Returns observable results in an array
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
24
31
|
export async function collect(obs) {
|
|
25
32
|
return new Promise((resolve, reject) => {
|
|
26
33
|
const arr = new Array();
|
|
@@ -32,6 +39,7 @@ export async function collect(obs) {
|
|
|
32
39
|
resolve(arr);
|
|
33
40
|
},
|
|
34
41
|
error(reason) {
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
35
43
|
reject(reason);
|
|
36
44
|
},
|
|
37
45
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Rxjs.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/internal/Rx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;AACL,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { defaultIfEmpty, from, last, scan, takeWhile } from \"rxjs\";\n\nimport type { Observable, ObservableInput, OperatorFunction } from \"rxjs\";\n\n/**\n * Applies reduce function and \"returns\" early if the predicate returns `false` for the accumulator.\n * @internal\n */\nexport function reduceWhile<TValue, TAccumulator>(\n predicate: (x: TAccumulator) => boolean,\n reduceFunc: (acc: TAccumulator, val: TValue) => TAccumulator,\n initial: TAccumulator,\n): OperatorFunction<TValue, TAccumulator | undefined> {\n return (obs) => {\n return obs.pipe(scan(reduceFunc, initial), takeWhile(predicate, true), defaultIfEmpty(undefined), last());\n };\n}\n\n/**\n * Same as `firstValueFrom` except it won't throw if the observable emits no values.\n * @internal\n */\nexport async function toVoidPromise(obs: Observable<any>): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n obs.subscribe({\n complete: () => resolve(),\n error: reject,\n });\n });\n}\n\n/**\n * Returns observable results in an array\n * @internal\n */\nexport async function collect<T>(obs: ObservableInput<T>): Promise<T[]> {\n return new Promise((resolve, reject) => {\n const arr = new Array<T>();\n from(obs).subscribe({\n next(item: T) {\n arr.push(item);\n },\n complete() {\n resolve(arr);\n },\n error(reason) {\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n reject(reason);\n },\n });\n });\n}\n"]}
|
package/lib/esm/tree-widget-react/components/trees/common/{Tooltip.d.ts → internal/Tooltip.d.ts}
RENAMED
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
import type { VisibilityStatus } from "
|
|
1
|
+
import type { VisibilityStatus } from "../UseHierarchyVisibility.js";
|
|
2
2
|
/** @internal */
|
|
3
3
|
export type Visibility = "visible" | "hidden" | "partial";
|
|
4
4
|
/** @internal */
|
|
5
5
|
export type NonPartialVisibilityStatus = Omit<VisibilityStatus, "state"> & {
|
|
6
6
|
state: "visible" | "hidden";
|
|
7
7
|
};
|
|
8
|
-
interface VisibilityStatusOptions {
|
|
9
|
-
useTooltip?: string | false;
|
|
10
|
-
}
|
|
11
8
|
/** @internal */
|
|
12
|
-
export declare function createVisibilityStatus(status: "visible" | "hidden"
|
|
13
|
-
export declare function createVisibilityStatus(status: "visible" | "hidden" | "partial" | "disabled"
|
|
9
|
+
export declare function createVisibilityStatus(status: "visible" | "hidden"): NonPartialVisibilityStatus;
|
|
10
|
+
export declare function createVisibilityStatus(status: "visible" | "hidden" | "partial" | "disabled"): VisibilityStatus;
|
|
14
11
|
/** @internal */
|
|
15
|
-
export declare function createTooltip(status: Visibility | "disabled"
|
|
16
|
-
export {};
|
|
12
|
+
export declare function createTooltip(status: Visibility | "disabled" | "determining"): string;
|
|
17
13
|
//# sourceMappingURL=Tooltip.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
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 { TreeWidget } from "../../../../TreeWidget.js";
|
|
6
|
+
export function createVisibilityStatus(status) {
|
|
7
|
+
return {
|
|
8
|
+
state: status === "disabled" ? "visible" : status,
|
|
9
|
+
isDisabled: status === "disabled",
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/** @internal */
|
|
13
|
+
export function createTooltip(status) {
|
|
14
|
+
const statusStringId = `visibilityTooltips.status.${status}`;
|
|
15
|
+
const statusString = TreeWidget.translate(statusStringId);
|
|
16
|
+
return statusString;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/internal/Tooltip.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAavD,MAAM,UAAU,sBAAsB,CAAC,MAA+B;IACpE,OAAO;QACL,KAAK,EAAE,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;QACjD,UAAU,EAAE,MAAM,KAAK,UAAU;KAClC,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,MAA+C;IAC3E,MAAM,cAAc,GAAG,6BAA6B,MAAM,EAAE,CAAC;IAC7D,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC1D,OAAO,YAAY,CAAC;AACtB,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 { TreeWidget } from \"../../../../TreeWidget.js\";\n\nimport type { VisibilityStatus } from \"../UseHierarchyVisibility.js\";\n\n/** @internal */\nexport type Visibility = \"visible\" | \"hidden\" | \"partial\";\n\n/** @internal */\nexport type NonPartialVisibilityStatus = Omit<VisibilityStatus, \"state\"> & { state: \"visible\" | \"hidden\" };\n\n/** @internal */\nexport function createVisibilityStatus(status: \"visible\" | \"hidden\"): NonPartialVisibilityStatus;\nexport function createVisibilityStatus(status: \"visible\" | \"hidden\" | \"partial\" | \"disabled\"): VisibilityStatus;\nexport function createVisibilityStatus(status: Visibility | \"disabled\"): VisibilityStatus {\n return {\n state: status === \"disabled\" ? \"visible\" : status,\n isDisabled: status === \"disabled\",\n };\n}\n\n/** @internal */\nexport function createTooltip(status: Visibility | \"disabled\" | \"determining\"): string {\n const statusStringId = `visibilityTooltips.status.${status}`;\n const statusString = TreeWidget.translate(statusStringId);\n return statusString;\n}\n"]}
|