@itwin/tree-widget-react 3.4.1 → 4.0.0-alpha.1
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 +1 -18
- package/README.md +3 -76
- package/lib/esm/tree-widget-react/components/SelectableTree.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/SelectableTree.js +4 -4
- package/lib/esm/tree-widget-react/components/SelectableTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/TreeSelector.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/TreeSelector.js +11 -14
- package/lib/esm/tree-widget-react/components/TreeSelector.js.map +1 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js +3 -5
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/TreeHeader.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/tree-header/TreeHeader.js +6 -49
- package/lib/esm/tree-widget-react/components/tree-header/TreeHeader.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/TreeHeader.scss +0 -1
- package/lib/esm/tree-widget-react/components/tree-header/TreeWithHeader.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.d.ts +4 -4
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +10 -8
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js +3 -3
- 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/UseCategoriesTree.js +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.d.ts +4 -28
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.js +2 -73
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.d.ts +7 -0
- package/lib/{cjs/tree-widget-react/components/trees/common/FocusedInstancesContext.js → esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.js} +14 -34
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyFiltering.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyFiltering.js +2 -2
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyFiltering.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js +12 -10
- 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 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js +3 -2
- 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/Tree.d.ts +4 -5
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js +11 -12
- 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 +8 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.d.ts +28 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js +34 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.d.ts +6 -12
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js +5 -31
- 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 +13 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseMultiCheckboxHandler.js → components/UseVisibilityButtonHandler.js} +7 -7
- package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.js +2 -2
- 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 +3 -4
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js +9 -8
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/trees/index.d.ts +0 -1
- package/lib/esm/tree-widget-react/components/trees/index.js +0 -1
- package/lib/esm/tree-widget-react/components/trees/index.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +1 -2
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.d.ts +8 -9
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +19 -16
- 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 +2 -7
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js +9 -13
- 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/UseModelsTree.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +7 -14
- 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/ModelsTreeVisibilityHandler.js.map +1 -1
- package/package.json +19 -24
- package/lib/cjs/package.json +0 -1
- package/lib/cjs/tree-widget-react/TreeWidget.d.ts +0 -24
- package/lib/cjs/tree-widget-react/TreeWidget.js +0 -54
- package/lib/cjs/tree-widget-react/TreeWidget.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/SelectableTree.d.ts +0 -47
- package/lib/cjs/tree-widget-react/components/SelectableTree.js +0 -107
- package/lib/cjs/tree-widget-react/components/SelectableTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/SelectableTree.scss +0 -18
- package/lib/cjs/tree-widget-react/components/TreeSelector.d.ts +0 -31
- package/lib/cjs/tree-widget-react/components/TreeSelector.js +0 -30
- package/lib/cjs/tree-widget-react/components/TreeSelector.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/TreeSelector.scss +0 -27
- package/lib/cjs/tree-widget-react/components/TreeWidgetUiItemsProvider.d.ts +0 -36
- package/lib/cjs/tree-widget-react/components/TreeWidgetUiItemsProvider.js +0 -74
- package/lib/cjs/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/TreeWidgetUiItemsProvider.scss +0 -9
- package/lib/cjs/tree-widget-react/components/tree-header/TreeHeader.d.ts +0 -33
- package/lib/cjs/tree-widget-react/components/tree-header/TreeHeader.js +0 -75
- package/lib/cjs/tree-widget-react/components/tree-header/TreeHeader.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/tree-header/TreeHeader.scss +0 -57
- package/lib/cjs/tree-widget-react/components/tree-header/TreeWithHeader.d.ts +0 -13
- package/lib/cjs/tree-widget-react/components/tree-header/TreeWithHeader.js +0 -20
- package/lib/cjs/tree-widget-react/components/tree-header/TreeWithHeader.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/tree-header/TreeWithHeader.scss +0 -23
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +0 -12
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTree.js +0 -22
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.d.ts +0 -47
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +0 -75
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.d.ts +0 -53
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js +0 -73
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +0 -23
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +0 -207
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.d.ts +0 -28
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.js +0 -91
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.d.ts +0 -22
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +0 -117
- package/lib/cjs/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.d.ts +0 -42
- package/lib/cjs/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js +0 -119
- package/lib/cjs/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/FocusedInstancesContext.d.ts +0 -35
- package/lib/cjs/tree-widget-react/components/trees/common/FocusedInstancesContext.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/Rxjs.d.ts +0 -10
- package/lib/cjs/tree-widget-react/components/trees/common/Rxjs.js +0 -46
- package/lib/cjs/tree-widget-react/components/trees/common/Rxjs.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/Tooltip.d.ts +0 -17
- package/lib/cjs/tree-widget-react/components/trees/common/Tooltip.js +0 -29
- package/lib/cjs/tree-widget-react/components/trees/common/Tooltip.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/TreeErrors.d.ts +0 -9
- package/lib/cjs/tree-widget-react/components/trees/common/TreeErrors.js +0 -19
- package/lib/cjs/tree-widget-react/components/trees/common/TreeErrors.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseActiveViewport.d.ts +0 -7
- package/lib/cjs/tree-widget-react/components/trees/common/UseActiveViewport.js +0 -25
- package/lib/cjs/tree-widget-react/components/trees/common/UseActiveViewport.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseFiltering.d.ts +0 -11
- package/lib/cjs/tree-widget-react/components/trees/common/UseFiltering.js +0 -28
- package/lib/cjs/tree-widget-react/components/trees/common/UseFiltering.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchiesLocalization.d.ts +0 -7
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchiesLocalization.js +0 -33
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchiesLocalization.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchyFiltering.d.ts +0 -13
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchyFiltering.js +0 -158
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchyFiltering.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchyVisibility.d.ts +0 -55
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchyVisibility.js +0 -114
- package/lib/cjs/tree-widget-react/components/trees/common/UseHierarchyVisibility.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseIModelChangeListener.d.ts +0 -8
- package/lib/cjs/tree-widget-react/components/trees/common/UseIModelChangeListener.js +0 -19
- package/lib/cjs/tree-widget-react/components/trees/common/UseIModelChangeListener.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseMultiCheckboxHandler.d.ts +0 -12
- package/lib/cjs/tree-widget-react/components/trees/common/UseMultiCheckboxHandler.js +0 -34
- package/lib/cjs/tree-widget-react/components/trees/common/UseMultiCheckboxHandler.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseNodeHighlighting.d.ts +0 -20
- package/lib/cjs/tree-widget-react/components/trees/common/UseNodeHighlighting.js +0 -131
- package/lib/cjs/tree-widget-react/components/trees/common/UseNodeHighlighting.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/UseTelemetryContext.d.ts +0 -29
- package/lib/cjs/tree-widget-react/components/trees/common/UseTelemetryContext.js +0 -49
- package/lib/cjs/tree-widget-react/components/trees/common/UseTelemetryContext.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/Utils.d.ts +0 -27
- package/lib/cjs/tree-widget-react/components/trees/common/Utils.js +0 -66
- package/lib/cjs/tree-widget-react/components/trees/common/Utils.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/Delayed.d.ts +0 -5
- package/lib/cjs/tree-widget-react/components/trees/common/components/Delayed.js +0 -30
- package/lib/cjs/tree-widget-react/components/trees/common/components/Delayed.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/ProgressOverlay.d.ts +0 -4
- package/lib/cjs/tree-widget-react/components/trees/common/components/ProgressOverlay.js +0 -15
- package/lib/cjs/tree-widget-react/components/trees/common/components/ProgressOverlay.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/ProgressOverlay.scss +0 -21
- package/lib/cjs/tree-widget-react/components/trees/common/components/Tree.d.ts +0 -44
- package/lib/cjs/tree-widget-react/components/trees/common/components/Tree.js +0 -98
- package/lib/cjs/tree-widget-react/components/trees/common/components/Tree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.d.ts +0 -27
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.js +0 -27
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeRenderer.d.ts +0 -11
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeRenderer.js +0 -19
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeRenderer.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeRenderer.d.ts +0 -19
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeRenderer.js +0 -48
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeRenderer.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTree.d.ts +0 -21
- package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTree.js +0 -26
- package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.d.ts +0 -11
- package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js +0 -26
- package/lib/cjs/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +0 -11
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js +0 -38
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +0 -26
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +0 -35
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +0 -24
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js +0 -265
- package/lib/cjs/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +0 -11
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js +0 -50
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +0 -26
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js +0 -35
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.d.ts +0 -29
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +0 -622
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.d.ts +0 -26
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +0 -203
- package/lib/cjs/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/index.d.ts +0 -18
- package/lib/cjs/tree-widget-react/components/trees/index.js +0 -39
- package/lib/cjs/tree-widget-react/components/trees/index.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +0 -12
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTree.js +0 -26
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.d.ts +0 -65
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +0 -144
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.d.ts +0 -78
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js +0 -106
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.d.ts +0 -79
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +0 -650
- package/lib/cjs/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/UseModelsTree.d.ts +0 -44
- package/lib/cjs/tree-widget-react/components/trees/models-tree/UseModelsTree.js +0 -312
- package/lib/cjs/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/Utils.d.ts +0 -7
- package/lib/cjs/tree-widget-react/components/trees/models-tree/Utils.js +0 -25
- package/lib/cjs/tree-widget-react/components/trees/models-tree/Utils.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.d.ts +0 -29
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js +0 -142
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/FilteredTree.d.ts +0 -25
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js +0 -178
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +0 -44
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +0 -385
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.d.ts +0 -37
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js +0 -57
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +0 -106
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +0 -672
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.d.ts +0 -12
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.js +0 -52
- package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.js.map +0 -1
- package/lib/cjs/tree-widget-react/components/utils/IsPromiseLike.d.ts +0 -6
- package/lib/cjs/tree-widget-react/components/utils/IsPromiseLike.js +0 -16
- package/lib/cjs/tree-widget-react/components/utils/IsPromiseLike.js.map +0 -1
- package/lib/cjs/tree-widget-react.d.ts +0 -6
- package/lib/cjs/tree-widget-react.js +0 -32
- package/lib/cjs/tree-widget-react.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseMultiCheckboxHandler.d.ts +0 -12
- package/lib/esm/tree-widget-react/components/trees/common/UseMultiCheckboxHandler.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.d.ts +0 -27
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.js +0 -23
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeRenderer.d.ts +0 -11
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeRenderer.js +0 -16
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeRenderer.js.map +0 -1
package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js
DELETED
|
@@ -1,385 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ModelsTreeIdsCache = void 0;
|
|
8
|
-
const rxjs_1 = require("rxjs");
|
|
9
|
-
const core_bentley_1 = require("@itwin/core-bentley");
|
|
10
|
-
const Utils_js_1 = require("../../common/Utils.js");
|
|
11
|
-
/** @internal */
|
|
12
|
-
class ModelsTreeIdsCache {
|
|
13
|
-
constructor(_queryExecutor, _hierarchyConfig) {
|
|
14
|
-
this._queryExecutor = _queryExecutor;
|
|
15
|
-
this._hierarchyConfig = _hierarchyConfig;
|
|
16
|
-
this._categoryElementCounts = new ModelCategoryElementsCountCache(async (input) => this.queryCategoryElementCounts(input));
|
|
17
|
-
this._modelKeyPaths = new Map();
|
|
18
|
-
this._subjectKeyPaths = new Map();
|
|
19
|
-
this._categoryKeyPaths = new Map();
|
|
20
|
-
}
|
|
21
|
-
[Symbol.dispose]() {
|
|
22
|
-
this._categoryElementCounts[Symbol.dispose]();
|
|
23
|
-
}
|
|
24
|
-
async *querySubjects() {
|
|
25
|
-
const subjectsQuery = `
|
|
26
|
-
SELECT
|
|
27
|
-
s.ECInstanceId id,
|
|
28
|
-
s.Parent.Id parentId,
|
|
29
|
-
(
|
|
30
|
-
SELECT m.ECInstanceId
|
|
31
|
-
FROM bis.GeometricModel3d m
|
|
32
|
-
WHERE m.ECInstanceId = HexToId(json_extract(s.JsonProperties, '$.Subject.Model.TargetPartition'))
|
|
33
|
-
AND NOT m.IsPrivate
|
|
34
|
-
AND EXISTS (SELECT 1 FROM ${this._hierarchyConfig.elementClassSpecification} WHERE Model.Id = m.ECInstanceId)
|
|
35
|
-
) targetPartitionId,
|
|
36
|
-
CASE
|
|
37
|
-
WHEN (
|
|
38
|
-
json_extract(s.JsonProperties, '$.Subject.Job.Bridge') IS NOT NULL
|
|
39
|
-
OR json_extract(s.JsonProperties, '$.Subject.Model.Type') = 'Hierarchy'
|
|
40
|
-
) THEN 1
|
|
41
|
-
ELSE 0
|
|
42
|
-
END hideInHierarchy
|
|
43
|
-
FROM bis.Subject s
|
|
44
|
-
`;
|
|
45
|
-
for await (const row of this._queryExecutor.createQueryReader({ ecsql: subjectsQuery }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded" })) {
|
|
46
|
-
yield { id: row.id, parentId: row.parentId, targetPartitionId: row.targetPartitionId, hideInHierarchy: !!row.hideInHierarchy };
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
async *queryModels() {
|
|
50
|
-
const modelsQuery = `
|
|
51
|
-
SELECT p.ECInstanceId id, p.Parent.Id parentId
|
|
52
|
-
FROM bis.InformationPartitionElement p
|
|
53
|
-
INNER JOIN bis.GeometricModel3d m ON m.ModeledElement.Id = p.ECInstanceId
|
|
54
|
-
WHERE
|
|
55
|
-
NOT m.IsPrivate
|
|
56
|
-
${this._hierarchyConfig.showEmptyModels ? "" : `AND EXISTS (SELECT 1 FROM ${this._hierarchyConfig.elementClassSpecification} WHERE Model.Id = m.ECInstanceId)`}
|
|
57
|
-
`;
|
|
58
|
-
for await (const row of this._queryExecutor.createQueryReader({ ecsql: modelsQuery }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded" })) {
|
|
59
|
-
yield { id: row.id, parentId: row.parentId };
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
async getSubjectInfos() {
|
|
63
|
-
this._subjectInfos ??= (async () => {
|
|
64
|
-
const [subjectInfos, targetPartitionSubjects] = await Promise.all([
|
|
65
|
-
(async () => {
|
|
66
|
-
const result = new Map();
|
|
67
|
-
for await (const subject of this.querySubjects()) {
|
|
68
|
-
const subjectInfo = {
|
|
69
|
-
parentSubject: subject.parentId,
|
|
70
|
-
hideInHierarchy: subject.hideInHierarchy,
|
|
71
|
-
childSubjects: new Set(),
|
|
72
|
-
childModels: new Set(),
|
|
73
|
-
};
|
|
74
|
-
if (subject.targetPartitionId) {
|
|
75
|
-
subjectInfo.childModels.add(subject.targetPartitionId);
|
|
76
|
-
}
|
|
77
|
-
result.set(subject.id, subjectInfo);
|
|
78
|
-
}
|
|
79
|
-
return result;
|
|
80
|
-
})(),
|
|
81
|
-
(async () => {
|
|
82
|
-
const result = new Map();
|
|
83
|
-
for await (const model of this.queryModels()) {
|
|
84
|
-
(0, Utils_js_1.pushToMap)(result, model.id, model.parentId);
|
|
85
|
-
}
|
|
86
|
-
return result;
|
|
87
|
-
})(),
|
|
88
|
-
]);
|
|
89
|
-
for (const [subjectId, { parentSubject: parentSubjectId }] of subjectInfos.entries()) {
|
|
90
|
-
if (parentSubjectId) {
|
|
91
|
-
const parentSubjectInfo = subjectInfos.get(parentSubjectId);
|
|
92
|
-
(0, core_bentley_1.assert)(!!parentSubjectInfo);
|
|
93
|
-
parentSubjectInfo.childSubjects.add(subjectId);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
for (const [partitionId, subjectIds] of targetPartitionSubjects) {
|
|
97
|
-
subjectIds.forEach((subjectId) => {
|
|
98
|
-
const subjectInfo = subjectInfos.get(subjectId);
|
|
99
|
-
(0, core_bentley_1.assert)(!!subjectInfo);
|
|
100
|
-
subjectInfo.childModels.add(partitionId);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
return subjectInfos;
|
|
104
|
-
})();
|
|
105
|
-
return this._subjectInfos;
|
|
106
|
-
}
|
|
107
|
-
/** Returns ECInstanceIDs of Subjects that either have direct Model or at least one child Subject with a Model. */
|
|
108
|
-
async getParentSubjectIds() {
|
|
109
|
-
this._parentSubjectIds ??= (async () => {
|
|
110
|
-
const subjectInfos = await this.getSubjectInfos();
|
|
111
|
-
const parentSubjectIds = new Set();
|
|
112
|
-
subjectInfos.forEach((subjectInfo, subjectId) => {
|
|
113
|
-
if (subjectInfo.childModels.size > 0) {
|
|
114
|
-
parentSubjectIds.add(subjectId);
|
|
115
|
-
let currParentId = subjectInfo.parentSubject;
|
|
116
|
-
while (currParentId) {
|
|
117
|
-
parentSubjectIds.add(currParentId);
|
|
118
|
-
currParentId = subjectInfos.get(currParentId)?.parentSubject;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
return [...parentSubjectIds];
|
|
123
|
-
})();
|
|
124
|
-
return this._parentSubjectIds;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Returns child subjects of the specified parent subjects as they're displayed in the hierarchy - taking into
|
|
128
|
-
* account `hideInHierarchy` flag.
|
|
129
|
-
*/
|
|
130
|
-
async getChildSubjectIds(parentSubjectIds) {
|
|
131
|
-
const childSubjectIds = new Array();
|
|
132
|
-
const subjectInfos = await this.getSubjectInfos();
|
|
133
|
-
parentSubjectIds.forEach((subjectId) => {
|
|
134
|
-
forEachChildSubject(subjectInfos, subjectId, (childSubjectId, childSubjectInfo) => {
|
|
135
|
-
if (!childSubjectInfo.hideInHierarchy) {
|
|
136
|
-
childSubjectIds.push(childSubjectId);
|
|
137
|
-
return "break";
|
|
138
|
-
}
|
|
139
|
-
return "continue";
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
return childSubjectIds;
|
|
143
|
-
}
|
|
144
|
-
/** Returns ECInstanceIDs of all Models under specific parent Subjects, including their child Subjects, etc. */
|
|
145
|
-
async getSubjectModelIds(subjectIds) {
|
|
146
|
-
const subjectInfos = await this.getSubjectInfos();
|
|
147
|
-
const subjectStack = [...subjectIds];
|
|
148
|
-
const result = new Array();
|
|
149
|
-
while (true) {
|
|
150
|
-
const subjectId = subjectStack.pop();
|
|
151
|
-
if (subjectId === undefined) {
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
const subjectInfo = subjectInfos.get(subjectId);
|
|
155
|
-
if (!subjectInfo) {
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
|
-
result.push(...subjectInfo.childModels);
|
|
159
|
-
subjectStack.push(...subjectInfo.childSubjects);
|
|
160
|
-
}
|
|
161
|
-
return result;
|
|
162
|
-
}
|
|
163
|
-
/** Returns ECInstanceIDs of Models under specific parent Subjects as they are displayed in the hierarchy. */
|
|
164
|
-
async getChildSubjectModelIds(parentSubjectIds) {
|
|
165
|
-
const subjectInfos = await this.getSubjectInfos();
|
|
166
|
-
const hiddenSubjectIds = new Array();
|
|
167
|
-
parentSubjectIds.forEach((subjectId) => {
|
|
168
|
-
forEachChildSubject(subjectInfos, subjectId, (childSubjectId, childSubjectInfo) => {
|
|
169
|
-
if (childSubjectInfo.hideInHierarchy) {
|
|
170
|
-
hiddenSubjectIds.push(childSubjectId);
|
|
171
|
-
return "continue";
|
|
172
|
-
}
|
|
173
|
-
return "break";
|
|
174
|
-
});
|
|
175
|
-
});
|
|
176
|
-
const modelIds = new Array();
|
|
177
|
-
[...parentSubjectIds, ...hiddenSubjectIds].forEach((subjectId) => {
|
|
178
|
-
const subjectInfo = subjectInfos.get(subjectId);
|
|
179
|
-
subjectInfo && modelIds.push(...subjectInfo.childModels);
|
|
180
|
-
});
|
|
181
|
-
return modelIds;
|
|
182
|
-
}
|
|
183
|
-
async createSubjectInstanceKeysPath(targetSubjectId) {
|
|
184
|
-
let entry = this._subjectKeyPaths.get(targetSubjectId);
|
|
185
|
-
if (!entry) {
|
|
186
|
-
entry = (async () => {
|
|
187
|
-
const subjectInfos = await this.getSubjectInfos();
|
|
188
|
-
const result = new Array();
|
|
189
|
-
let currParentId = targetSubjectId;
|
|
190
|
-
while (currParentId) {
|
|
191
|
-
const parentInfo = subjectInfos.get(currParentId);
|
|
192
|
-
if (!parentInfo?.hideInHierarchy) {
|
|
193
|
-
result.push({ className: "BisCore.Subject", id: currParentId });
|
|
194
|
-
}
|
|
195
|
-
currParentId = parentInfo?.parentSubject;
|
|
196
|
-
}
|
|
197
|
-
return result.reverse();
|
|
198
|
-
})();
|
|
199
|
-
this._subjectKeyPaths.set(targetSubjectId, entry);
|
|
200
|
-
}
|
|
201
|
-
return entry;
|
|
202
|
-
}
|
|
203
|
-
async *queryModelElementCounts() {
|
|
204
|
-
const query = /* sql */ `
|
|
205
|
-
SELECT Model.Id modelId, COUNT(*) elementCount
|
|
206
|
-
FROM ${this._hierarchyConfig.elementClassSpecification}
|
|
207
|
-
GROUP BY Model.Id
|
|
208
|
-
`;
|
|
209
|
-
for await (const row of this._queryExecutor.createQueryReader({ ecsql: query }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded" })) {
|
|
210
|
-
yield { modelId: row.modelId, elementCount: row.elementCount };
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
async *queryModelCategories() {
|
|
214
|
-
const query = /* sql */ `
|
|
215
|
-
SELECT Model.Id modelId, Category.Id categoryId
|
|
216
|
-
FROM ${this._hierarchyConfig.elementClassSpecification}
|
|
217
|
-
WHERE Parent.Id IS NULL
|
|
218
|
-
GROUP BY modelId, categoryId
|
|
219
|
-
`;
|
|
220
|
-
for await (const row of this._queryExecutor.createQueryReader({ ecsql: query }, { rowFormat: "ECSqlPropertyNames", limit: "unbounded" })) {
|
|
221
|
-
yield { modelId: row.modelId, categoryId: row.categoryId };
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
async getModelInfos() {
|
|
225
|
-
this._modelInfos ??= (async () => {
|
|
226
|
-
const modelInfos = new Map();
|
|
227
|
-
await Promise.all([
|
|
228
|
-
(async () => {
|
|
229
|
-
for await (const { modelId, categoryId } of this.queryModelCategories()) {
|
|
230
|
-
const entry = modelInfos.get(modelId);
|
|
231
|
-
if (entry) {
|
|
232
|
-
entry.categories.add(categoryId);
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
modelInfos.set(modelId, { categories: new Set([categoryId]), elementCount: 0 });
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
})(),
|
|
239
|
-
(async () => {
|
|
240
|
-
for await (const { modelId, elementCount } of this.queryModelElementCounts()) {
|
|
241
|
-
const entry = modelInfos.get(modelId);
|
|
242
|
-
if (entry) {
|
|
243
|
-
entry.elementCount = elementCount;
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
modelInfos.set(modelId, { categories: new Set(), elementCount });
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
})(),
|
|
250
|
-
]);
|
|
251
|
-
return modelInfos;
|
|
252
|
-
})();
|
|
253
|
-
return this._modelInfos;
|
|
254
|
-
}
|
|
255
|
-
async getModelCategories(modelId) {
|
|
256
|
-
const modelInfos = await this.getModelInfos();
|
|
257
|
-
const categories = modelInfos.get(modelId)?.categories;
|
|
258
|
-
return categories ? [...categories] : [];
|
|
259
|
-
}
|
|
260
|
-
async getModelElementCount(modelId) {
|
|
261
|
-
const modelInfos = await this.getModelInfos();
|
|
262
|
-
return modelInfos.get(modelId)?.elementCount ?? 0;
|
|
263
|
-
}
|
|
264
|
-
async createModelInstanceKeyPaths(modelId) {
|
|
265
|
-
let entry = this._modelKeyPaths.get(modelId);
|
|
266
|
-
if (!entry) {
|
|
267
|
-
entry = (async () => {
|
|
268
|
-
const result = new Array();
|
|
269
|
-
const subjectInfos = (await this.getSubjectInfos()).entries();
|
|
270
|
-
for (const [modelSubjectId, subjectInfo] of subjectInfos) {
|
|
271
|
-
if (subjectInfo.childModels.has(modelId)) {
|
|
272
|
-
const subjectPath = await this.createSubjectInstanceKeysPath(modelSubjectId);
|
|
273
|
-
result.push([...subjectPath, { className: "BisCore.GeometricModel3d", id: modelId }]);
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
return result;
|
|
277
|
-
})();
|
|
278
|
-
this._modelKeyPaths.set(modelId, entry);
|
|
279
|
-
}
|
|
280
|
-
return entry;
|
|
281
|
-
}
|
|
282
|
-
async queryCategoryElementCounts(input) {
|
|
283
|
-
const reader = this._queryExecutor.createQueryReader({
|
|
284
|
-
ctes: [
|
|
285
|
-
/* sql */ `
|
|
286
|
-
CategoryElements(id, modelId, categoryId) AS (
|
|
287
|
-
SELECT ECInstanceId, Model.Id, Category.Id
|
|
288
|
-
FROM ${this._hierarchyConfig.elementClassSpecification}
|
|
289
|
-
WHERE
|
|
290
|
-
Parent.Id IS NULL
|
|
291
|
-
AND (
|
|
292
|
-
${input.map(({ modelId, categoryId }) => `Model.Id = ${modelId} AND Category.Id = ${categoryId}`).join(" OR ")}
|
|
293
|
-
)
|
|
294
|
-
|
|
295
|
-
UNION ALL
|
|
296
|
-
|
|
297
|
-
SELECT c.ECInstanceId, p.modelId, p.categoryId
|
|
298
|
-
FROM ${this._hierarchyConfig.elementClassSpecification} c
|
|
299
|
-
JOIN CategoryElements p ON c.Parent.Id = p.id
|
|
300
|
-
)
|
|
301
|
-
`,
|
|
302
|
-
],
|
|
303
|
-
ecsql: `
|
|
304
|
-
SELECT modelId, categoryId, COUNT(id) elementsCount
|
|
305
|
-
FROM CategoryElements
|
|
306
|
-
GROUP BY modelId, categoryId
|
|
307
|
-
`,
|
|
308
|
-
}, { rowFormat: "ECSqlPropertyNames", limit: "unbounded" });
|
|
309
|
-
const result = new Array();
|
|
310
|
-
for await (const row of reader) {
|
|
311
|
-
result.push({ modelId: row.modelId, categoryId: row.categoryId, elementsCount: row.elementsCount });
|
|
312
|
-
}
|
|
313
|
-
return result;
|
|
314
|
-
}
|
|
315
|
-
async getCategoryElementsCount(modelId, categoryId) {
|
|
316
|
-
return this._categoryElementCounts.getCategoryElementsCount(modelId, categoryId);
|
|
317
|
-
}
|
|
318
|
-
async createCategoryInstanceKeyPaths(categoryId) {
|
|
319
|
-
let entry = this._categoryKeyPaths.get(categoryId);
|
|
320
|
-
if (!entry) {
|
|
321
|
-
entry = (async () => {
|
|
322
|
-
const result = new Set();
|
|
323
|
-
const modelInfos = await this.getModelInfos();
|
|
324
|
-
modelInfos?.forEach((modelInfo, modelId) => {
|
|
325
|
-
if (modelInfo.categories.has(categoryId)) {
|
|
326
|
-
result.add(modelId);
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
const categoryPaths = new Array();
|
|
330
|
-
for (const categoryModelId of [...result]) {
|
|
331
|
-
const modelPaths = await this.createModelInstanceKeyPaths(categoryModelId);
|
|
332
|
-
for (const modelPath of modelPaths) {
|
|
333
|
-
categoryPaths.push([...modelPath, { className: "BisCore.SpatialCategory", id: categoryId }]);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
return categoryPaths;
|
|
337
|
-
})();
|
|
338
|
-
this._categoryKeyPaths.set(categoryId, entry);
|
|
339
|
-
}
|
|
340
|
-
return entry;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
exports.ModelsTreeIdsCache = ModelsTreeIdsCache;
|
|
344
|
-
function forEachChildSubject(subjectInfos, parentSubject, cb) {
|
|
345
|
-
const parentSubjectInfo = typeof parentSubject === "string" ? subjectInfos.get(parentSubject) : parentSubject;
|
|
346
|
-
parentSubjectInfo &&
|
|
347
|
-
parentSubjectInfo.childSubjects.forEach((childSubjectId) => {
|
|
348
|
-
const childSubjectInfo = subjectInfos.get(childSubjectId);
|
|
349
|
-
if (cb(childSubjectId, childSubjectInfo) === "break") {
|
|
350
|
-
return;
|
|
351
|
-
}
|
|
352
|
-
forEachChildSubject(subjectInfos, childSubjectInfo, cb);
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
class ModelCategoryElementsCountCache {
|
|
356
|
-
constructor(_loader) {
|
|
357
|
-
this._loader = _loader;
|
|
358
|
-
this._cache = new Map();
|
|
359
|
-
this._requestsStream = new rxjs_1.Subject();
|
|
360
|
-
this._subscription = this._requestsStream
|
|
361
|
-
.pipe((0, rxjs_1.bufferTime)(20), (0, rxjs_1.filter)((requests) => requests.length > 0), (0, rxjs_1.mergeMap)(async (requests) => this._loader(requests)), (0, rxjs_1.mergeAll)())
|
|
362
|
-
.subscribe({
|
|
363
|
-
next: ({ modelId, categoryId, elementsCount }) => {
|
|
364
|
-
const subject = this._cache.get(`${modelId}${categoryId}`);
|
|
365
|
-
(0, core_bentley_1.assert)(!!subject);
|
|
366
|
-
subject.next(elementsCount);
|
|
367
|
-
},
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
[Symbol.dispose]() {
|
|
371
|
-
this._subscription.unsubscribe();
|
|
372
|
-
}
|
|
373
|
-
async getCategoryElementsCount(modelId, categoryId) {
|
|
374
|
-
const cacheKey = `${modelId}${categoryId}`;
|
|
375
|
-
let result = this._cache.get(cacheKey);
|
|
376
|
-
if (result !== undefined) {
|
|
377
|
-
return (0, rxjs_1.firstValueFrom)(result);
|
|
378
|
-
}
|
|
379
|
-
result = new rxjs_1.ReplaySubject(1);
|
|
380
|
-
this._cache.set(cacheKey, result);
|
|
381
|
-
this._requestsStream.next({ modelId, categoryId });
|
|
382
|
-
return (0, rxjs_1.firstValueFrom)(result);
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
//# sourceMappingURL=ModelsTreeIdsCache.js.map
|
package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModelsTreeIdsCache.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAGhG,+BAAsG;AACtG,sDAA6C;AAC7C,oDAAkD;AAqBlD,gBAAgB;AAChB,MAAa,kBAAkB;IAS7B,YACU,cAA0C,EAC1C,gBAAkD;QADlD,mBAAc,GAAd,cAAc,CAA4B;QAC1C,qBAAgB,GAAhB,gBAAgB,CAAkC;QAE1D,IAAI,CAAC,sBAAsB,GAAG,IAAI,+BAA+B,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC,CAAC,CAAC;QAC3H,IAAI,CAAC,cAAc,GAAG,IAAI,GAAG,EAAE,CAAC;QAChC,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAE,CAAC;IACrC,CAAC;IAEM,CAAC,MAAM,CAAC,OAAO,CAAC;QACrB,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAChD,CAAC;IAEO,KAAK,CAAC,CAAC,aAAa;QAC1B,MAAM,aAAa,GAAG;;;;;;;;;wCASc,IAAI,CAAC,gBAAgB,CA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;SAC/B;QAED,MAAM,GAAG,IAAI,oBAAa,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,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,IAAA,qBAAc,EAAC,MAAM,CAAC,CAAC;IAChC,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 type { Subscription } from \"rxjs\";\nimport { bufferTime, filter, firstValueFrom, mergeAll, mergeMap, ReplaySubject, Subject } from \"rxjs\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { pushToMap } from \"../../common/Utils.js\";\n\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\nimport type { ModelsTreeDefinition } from \"../ModelsTreeDefinition.js\";\nimport type { Id64Array, Id64Set, Id64String } from \"@itwin/core-bentley\";\nimport type { HierarchyNodeIdentifiersPath, LimitingECSqlQueryExecutor } from \"@itwin/presentation-hierarchies\";\n\ninterface SubjectInfo {\n parentSubject: Id64String | undefined;\n hideInHierarchy: boolean;\n childSubjects: Id64Set;\n childModels: Id64Set;\n}\n\ninterface ModelInfo {\n categories: Id64Set;\n elementCount: number;\n}\n\ntype ModelsTreeHierarchyConfiguration = ConstructorParameters<typeof ModelsTreeDefinition>[0][\"hierarchyConfig\"];\n\n/** @internal */\nexport class ModelsTreeIdsCache {\n private readonly _categoryElementCounts: ModelCategoryElementsCountCache;\n private _subjectInfos: Promise<Map<Id64String, SubjectInfo>> | undefined;\n private _parentSubjectIds: Promise<Id64Array> | undefined; // the list should contain a subject id if its node should be shown as having children\n private _modelInfos: Promise<Map<Id64String, ModelInfo>> | undefined;\n private _modelKeyPaths: Map<Id64String, Promise<HierarchyNodeIdentifiersPath[]>>;\n private _subjectKeyPaths: Map<Id64String, Promise<HierarchyNodeIdentifiersPath>>;\n private _categoryKeyPaths: Map<Id64String, Promise<HierarchyNodeIdentifiersPath[]>>;\n\n constructor(\n private _queryExecutor: LimitingECSqlQueryExecutor,\n private _hierarchyConfig: ModelsTreeHierarchyConfiguration,\n ) {\n this._categoryElementCounts = new ModelCategoryElementsCountCache(async (input) => this.queryCategoryElementCounts(input));\n this._modelKeyPaths = new Map();\n this._subjectKeyPaths = new Map();\n this._categoryKeyPaths = new Map();\n }\n\n public [Symbol.dispose]() {\n this._categoryElementCounts[Symbol.dispose]();\n }\n\n private async *querySubjects(): AsyncIterableIterator<{ id: Id64String; parentId?: Id64String; targetPartitionId?: Id64String; hideInHierarchy: boolean }> {\n const subjectsQuery = `\n SELECT\n s.ECInstanceId id,\n s.Parent.Id parentId,\n (\n SELECT m.ECInstanceId\n FROM bis.GeometricModel3d m\n WHERE m.ECInstanceId = HexToId(json_extract(s.JsonProperties, '$.Subject.Model.TargetPartition'))\n AND NOT m.IsPrivate\n AND EXISTS (SELECT 1 FROM ${this._hierarchyConfig.elementClassSpecification} WHERE Model.Id = m.ECInstanceId)\n ) targetPartitionId,\n CASE\n WHEN (\n json_extract(s.JsonProperties, '$.Subject.Job.Bridge') IS NOT NULL\n OR json_extract(s.JsonProperties, '$.Subject.Model.Type') = 'Hierarchy'\n ) THEN 1\n ELSE 0\n END hideInHierarchy\n FROM bis.Subject s\n `;\n for await (const row of this._queryExecutor.createQueryReader({ ecsql: subjectsQuery }, { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\" })) {\n yield { id: row.id, parentId: row.parentId, targetPartitionId: row.targetPartitionId, hideInHierarchy: !!row.hideInHierarchy };\n }\n }\n\n private async *queryModels(): AsyncIterableIterator<{ id: Id64String; parentId: Id64String }> {\n const modelsQuery = `\n SELECT p.ECInstanceId id, p.Parent.Id parentId\n FROM bis.InformationPartitionElement p\n INNER JOIN bis.GeometricModel3d m ON m.ModeledElement.Id = p.ECInstanceId\n WHERE\n NOT m.IsPrivate\n ${this._hierarchyConfig.showEmptyModels ? \"\" : `AND EXISTS (SELECT 1 FROM ${this._hierarchyConfig.elementClassSpecification} WHERE Model.Id = m.ECInstanceId)`}\n `;\n for await (const row of this._queryExecutor.createQueryReader({ ecsql: modelsQuery }, { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\" })) {\n yield { id: row.id, parentId: row.parentId };\n }\n }\n\n private async getSubjectInfos() {\n this._subjectInfos ??= (async () => {\n const [subjectInfos, targetPartitionSubjects] = await Promise.all([\n (async () => {\n const result = new Map<Id64String, SubjectInfo>();\n for await (const subject of this.querySubjects()) {\n const subjectInfo: SubjectInfo = {\n parentSubject: subject.parentId,\n hideInHierarchy: subject.hideInHierarchy,\n childSubjects: new Set(),\n childModels: new Set(),\n };\n if (subject.targetPartitionId) {\n subjectInfo.childModels.add(subject.targetPartitionId);\n }\n result.set(subject.id, subjectInfo);\n }\n return result;\n })(),\n (async () => {\n const result = new Map<Id64String, Set<Id64String>>();\n for await (const model of this.queryModels()) {\n pushToMap(result, model.id, model.parentId);\n }\n return result;\n })(),\n ]);\n\n for (const [subjectId, { parentSubject: parentSubjectId }] of subjectInfos.entries()) {\n if (parentSubjectId) {\n const parentSubjectInfo = subjectInfos.get(parentSubjectId);\n assert(!!parentSubjectInfo);\n parentSubjectInfo.childSubjects.add(subjectId);\n }\n }\n\n for (const [partitionId, subjectIds] of targetPartitionSubjects) {\n subjectIds.forEach((subjectId) => {\n const subjectInfo = subjectInfos.get(subjectId);\n assert(!!subjectInfo);\n subjectInfo.childModels.add(partitionId);\n });\n }\n\n return subjectInfos;\n })();\n return this._subjectInfos;\n }\n\n /** Returns ECInstanceIDs of Subjects that either have direct Model or at least one child Subject with a Model. */\n public async getParentSubjectIds(): Promise<Id64String[]> {\n this._parentSubjectIds ??= (async () => {\n const subjectInfos = await this.getSubjectInfos();\n const parentSubjectIds = new Set<Id64String>();\n subjectInfos.forEach((subjectInfo, subjectId) => {\n if (subjectInfo.childModels.size > 0) {\n parentSubjectIds.add(subjectId);\n let currParentId = subjectInfo.parentSubject;\n while (currParentId) {\n parentSubjectIds.add(currParentId);\n currParentId = subjectInfos.get(currParentId)?.parentSubject;\n }\n }\n });\n return [...parentSubjectIds];\n })();\n return this._parentSubjectIds;\n }\n\n /**\n * Returns child subjects of the specified parent subjects as they're displayed in the hierarchy - taking into\n * account `hideInHierarchy` flag.\n */\n public async getChildSubjectIds(parentSubjectIds: Id64String[]): Promise<Id64String[]> {\n const childSubjectIds = new Array<Id64String>();\n const subjectInfos = await this.getSubjectInfos();\n parentSubjectIds.forEach((subjectId) => {\n forEachChildSubject(subjectInfos, subjectId, (childSubjectId, childSubjectInfo) => {\n if (!childSubjectInfo.hideInHierarchy) {\n childSubjectIds.push(childSubjectId);\n return \"break\";\n }\n return \"continue\";\n });\n });\n return childSubjectIds;\n }\n\n /** Returns ECInstanceIDs of all Models under specific parent Subjects, including their child Subjects, etc. */\n public async getSubjectModelIds(subjectIds: Id64Array): Promise<Id64Array> {\n const subjectInfos = await this.getSubjectInfos();\n const subjectStack = [...subjectIds];\n const result = new Array<Id64String>();\n while (true) {\n const subjectId = subjectStack.pop();\n if (subjectId === undefined) {\n break;\n }\n const subjectInfo = subjectInfos.get(subjectId);\n if (!subjectInfo) {\n continue;\n }\n result.push(...subjectInfo.childModels);\n subjectStack.push(...subjectInfo.childSubjects);\n }\n return result;\n }\n\n /** Returns ECInstanceIDs of Models under specific parent Subjects as they are displayed in the hierarchy. */\n public async getChildSubjectModelIds(parentSubjectIds: Id64String[]): Promise<Id64String[]> {\n const subjectInfos = await this.getSubjectInfos();\n\n const hiddenSubjectIds = new Array<Id64String>();\n parentSubjectIds.forEach((subjectId) => {\n forEachChildSubject(subjectInfos, subjectId, (childSubjectId, childSubjectInfo) => {\n if (childSubjectInfo.hideInHierarchy) {\n hiddenSubjectIds.push(childSubjectId);\n return \"continue\";\n }\n return \"break\";\n });\n });\n\n const modelIds = new Array<Id64String>();\n [...parentSubjectIds, ...hiddenSubjectIds].forEach((subjectId) => {\n const subjectInfo = subjectInfos.get(subjectId);\n subjectInfo && modelIds.push(...subjectInfo.childModels);\n });\n return modelIds;\n }\n\n public async createSubjectInstanceKeysPath(targetSubjectId: Id64String): Promise<HierarchyNodeIdentifiersPath> {\n let entry = this._subjectKeyPaths.get(targetSubjectId);\n if (!entry) {\n entry = (async () => {\n const subjectInfos = await this.getSubjectInfos();\n const result = new Array<InstanceKey>();\n let currParentId: Id64String | undefined = targetSubjectId;\n while (currParentId) {\n const parentInfo = subjectInfos.get(currParentId);\n if (!parentInfo?.hideInHierarchy) {\n result.push({ className: \"BisCore.Subject\", id: currParentId });\n }\n currParentId = parentInfo?.parentSubject;\n }\n return result.reverse();\n })();\n this._subjectKeyPaths.set(targetSubjectId, entry);\n }\n return entry;\n }\n\n private async *queryModelElementCounts() {\n const query = /* sql */ `\n SELECT Model.Id modelId, COUNT(*) elementCount\n FROM ${this._hierarchyConfig.elementClassSpecification}\n GROUP BY Model.Id\n `;\n for await (const row of this._queryExecutor.createQueryReader({ ecsql: query }, { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\" })) {\n yield { modelId: row.modelId, elementCount: row.elementCount };\n }\n }\n\n private async *queryModelCategories() {\n const query = /* sql */ `\n SELECT Model.Id modelId, Category.Id categoryId\n FROM ${this._hierarchyConfig.elementClassSpecification}\n WHERE Parent.Id IS NULL\n GROUP BY modelId, categoryId\n `;\n for await (const row of this._queryExecutor.createQueryReader({ ecsql: query }, { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\" })) {\n yield { modelId: row.modelId, categoryId: row.categoryId };\n }\n }\n\n private async getModelInfos() {\n this._modelInfos ??= (async () => {\n const modelInfos = new Map<Id64String, { categories: Id64Set; elementCount: number }>();\n await Promise.all([\n (async () => {\n for await (const { modelId, categoryId } of this.queryModelCategories()) {\n const entry = modelInfos.get(modelId);\n if (entry) {\n entry.categories.add(categoryId);\n } else {\n modelInfos.set(modelId, { categories: new Set([categoryId]), elementCount: 0 });\n }\n }\n })(),\n (async () => {\n for await (const { modelId, elementCount } of this.queryModelElementCounts()) {\n const entry = modelInfos.get(modelId);\n if (entry) {\n entry.elementCount = elementCount;\n } else {\n modelInfos.set(modelId, { categories: new Set(), elementCount });\n }\n }\n })(),\n ]);\n return modelInfos;\n })();\n return this._modelInfos;\n }\n\n public async getModelCategories(modelId: Id64String): Promise<Id64Array> {\n const modelInfos = await this.getModelInfos();\n const categories = modelInfos.get(modelId)?.categories;\n return categories ? [...categories] : [];\n }\n\n public async getModelElementCount(modelId: Id64String): Promise<number> {\n const modelInfos = await this.getModelInfos();\n return modelInfos.get(modelId)?.elementCount ?? 0;\n }\n\n public async createModelInstanceKeyPaths(modelId: Id64String): Promise<HierarchyNodeIdentifiersPath[]> {\n let entry = this._modelKeyPaths.get(modelId);\n if (!entry) {\n entry = (async () => {\n const result = new Array<HierarchyNodeIdentifiersPath>();\n const subjectInfos = (await this.getSubjectInfos()).entries();\n for (const [modelSubjectId, subjectInfo] of subjectInfos) {\n if (subjectInfo.childModels.has(modelId)) {\n const subjectPath = await this.createSubjectInstanceKeysPath(modelSubjectId);\n result.push([...subjectPath, { className: \"BisCore.GeometricModel3d\", id: modelId }]);\n }\n }\n return result;\n })();\n\n this._modelKeyPaths.set(modelId, entry);\n }\n return entry;\n }\n\n private async queryCategoryElementCounts(\n input: Array<{ modelId: Id64String; categoryId: Id64String }>,\n ): Promise<Array<{ modelId: number; categoryId: number; elementsCount: number }>> {\n const reader = this._queryExecutor.createQueryReader(\n {\n ctes: [\n /* sql */ `\n CategoryElements(id, modelId, categoryId) AS (\n SELECT ECInstanceId, Model.Id, Category.Id\n FROM ${this._hierarchyConfig.elementClassSpecification}\n WHERE\n Parent.Id IS NULL\n AND (\n ${input.map(({ modelId, categoryId }) => `Model.Id = ${modelId} AND Category.Id = ${categoryId}`).join(\" OR \")}\n )\n\n UNION ALL\n\n SELECT c.ECInstanceId, p.modelId, p.categoryId\n FROM ${this._hierarchyConfig.elementClassSpecification} c\n JOIN CategoryElements p ON c.Parent.Id = p.id\n )\n `,\n ],\n ecsql: `\n SELECT modelId, categoryId, COUNT(id) elementsCount\n FROM CategoryElements\n GROUP BY modelId, categoryId\n `,\n },\n { rowFormat: \"ECSqlPropertyNames\", limit: \"unbounded\" },\n );\n\n const result = new Array<{ modelId: number; categoryId: number; elementsCount: number }>();\n for await (const row of reader) {\n result.push({ modelId: row.modelId, categoryId: row.categoryId, elementsCount: row.elementsCount });\n }\n return result;\n }\n\n public async getCategoryElementsCount(modelId: Id64String, categoryId: Id64String): Promise<number> {\n return this._categoryElementCounts.getCategoryElementsCount(modelId, categoryId);\n }\n\n public async createCategoryInstanceKeyPaths(categoryId: Id64String): Promise<HierarchyNodeIdentifiersPath[]> {\n let entry = this._categoryKeyPaths.get(categoryId);\n if (!entry) {\n entry = (async () => {\n const result = new Set<Id64String>();\n const modelInfos = await this.getModelInfos();\n modelInfos?.forEach((modelInfo, modelId) => {\n if (modelInfo.categories.has(categoryId)) {\n result.add(modelId);\n }\n });\n\n const categoryPaths = new Array<HierarchyNodeIdentifiersPath>();\n for (const categoryModelId of [...result]) {\n const modelPaths = await this.createModelInstanceKeyPaths(categoryModelId);\n for (const modelPath of modelPaths) {\n categoryPaths.push([...modelPath, { className: \"BisCore.SpatialCategory\", id: categoryId }]);\n }\n }\n return categoryPaths;\n })();\n this._categoryKeyPaths.set(categoryId, entry);\n }\n return entry;\n }\n}\n\nfunction forEachChildSubject(\n subjectInfos: Map<Id64String, SubjectInfo>,\n parentSubject: Id64String | SubjectInfo,\n cb: (childSubjectId: Id64String, childSubjectInfo: SubjectInfo) => \"break\" | \"continue\",\n) {\n const parentSubjectInfo = typeof parentSubject === \"string\" ? subjectInfos.get(parentSubject) : parentSubject;\n parentSubjectInfo &&\n parentSubjectInfo.childSubjects.forEach((childSubjectId) => {\n const childSubjectInfo = subjectInfos.get(childSubjectId)!;\n if (cb(childSubjectId, childSubjectInfo) === \"break\") {\n return;\n }\n forEachChildSubject(subjectInfos, childSubjectInfo, cb);\n });\n}\n\nclass ModelCategoryElementsCountCache {\n private _cache = new Map<string, Subject<number>>();\n private _requestsStream = new Subject<{ modelId: Id64String; categoryId: Id64String }>();\n private _subscription: Subscription;\n\n public constructor(\n private _loader: (\n input: Array<{ modelId: Id64String; categoryId: Id64String }>,\n ) => Promise<Array<{ modelId: number; categoryId: number; elementsCount: number }>>,\n ) {\n this._subscription = this._requestsStream\n .pipe(\n bufferTime(20),\n filter((requests) => requests.length > 0),\n mergeMap(async (requests) => this._loader(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 public [Symbol.dispose]() {\n this._subscription.unsubscribe();\n }\n\n public async getCategoryElementsCount(modelId: Id64String, categoryId: Id64String): Promise<number> {\n const cacheKey = `${modelId}${categoryId}`;\n let result = this._cache.get(cacheKey);\n if (result !== undefined) {\n return firstValueFrom(result);\n }\n\n result = new ReplaySubject(1);\n this._cache.set(cacheKey, result);\n this._requestsStream.next({ modelId, categoryId });\n return firstValueFrom(result);\n }\n}\n"]}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { Id64String } from "@itwin/core-bentley";
|
|
2
|
-
import { HierarchyNodeKey } from "@itwin/presentation-hierarchies";
|
|
3
|
-
interface ModelsTreeNode {
|
|
4
|
-
key: HierarchyNodeKey;
|
|
5
|
-
extendedData?: {
|
|
6
|
-
[id: string]: any;
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export declare namespace ModelsTreeNode {
|
|
13
|
-
/**
|
|
14
|
-
* Determines if a node represents a subject.
|
|
15
|
-
*/
|
|
16
|
-
const isSubjectNode: (node: Pick<ModelsTreeNode, "extendedData">) => boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Determines if a node represents a model.
|
|
19
|
-
*/
|
|
20
|
-
const isModelNode: (node: Pick<ModelsTreeNode, "extendedData">) => boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Determines if a node represents a category.
|
|
23
|
-
*/
|
|
24
|
-
const isCategoryNode: (node: Pick<ModelsTreeNode, "extendedData">) => boolean;
|
|
25
|
-
/** Returns type of the node. */
|
|
26
|
-
const getType: (node: ModelsTreeNode) => "subject" | "model" | "category" | "element" | "elements-class-group";
|
|
27
|
-
/**
|
|
28
|
-
* Retrieves model ID from node's extended data.
|
|
29
|
-
*/
|
|
30
|
-
const getModelId: (node: Pick<ModelsTreeNode, "extendedData">) => Id64String | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* Retrieves category ID from node's extended data.
|
|
33
|
-
*/
|
|
34
|
-
const getCategoryId: (node: Pick<ModelsTreeNode, "extendedData">) => Id64String | undefined;
|
|
35
|
-
}
|
|
36
|
-
export {};
|
|
37
|
-
//# sourceMappingURL=ModelsTreeNode.d.ts.map
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ModelsTreeNode = void 0;
|
|
8
|
-
const presentation_hierarchies_1 = require("@itwin/presentation-hierarchies");
|
|
9
|
-
/**
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
var ModelsTreeNode;
|
|
13
|
-
(function (ModelsTreeNode) {
|
|
14
|
-
/**
|
|
15
|
-
* Determines if a node represents a subject.
|
|
16
|
-
*/
|
|
17
|
-
ModelsTreeNode.isSubjectNode = (node) => !!node.extendedData?.isSubject;
|
|
18
|
-
/**
|
|
19
|
-
* Determines if a node represents a model.
|
|
20
|
-
*/
|
|
21
|
-
ModelsTreeNode.isModelNode = (node) => !!node.extendedData?.isModel;
|
|
22
|
-
/**
|
|
23
|
-
* Determines if a node represents a category.
|
|
24
|
-
*/
|
|
25
|
-
ModelsTreeNode.isCategoryNode = (node) => !!node.extendedData?.isCategory;
|
|
26
|
-
/** Returns type of the node. */
|
|
27
|
-
ModelsTreeNode.getType = (node) => {
|
|
28
|
-
if (presentation_hierarchies_1.HierarchyNodeKey.isClassGrouping(node.key)) {
|
|
29
|
-
return "elements-class-group";
|
|
30
|
-
}
|
|
31
|
-
if (ModelsTreeNode.isSubjectNode(node)) {
|
|
32
|
-
return "subject";
|
|
33
|
-
}
|
|
34
|
-
if (ModelsTreeNode.isModelNode(node)) {
|
|
35
|
-
return "model";
|
|
36
|
-
}
|
|
37
|
-
if (ModelsTreeNode.isCategoryNode(node)) {
|
|
38
|
-
return "category";
|
|
39
|
-
}
|
|
40
|
-
return "element";
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Retrieves model ID from node's extended data.
|
|
44
|
-
*/
|
|
45
|
-
ModelsTreeNode.getModelId = (node) => {
|
|
46
|
-
if (node.extendedData?.modelId) {
|
|
47
|
-
return node.extendedData?.modelId;
|
|
48
|
-
}
|
|
49
|
-
const modelIds = node.extendedData?.modelIds?.[0];
|
|
50
|
-
return modelIds && (Array.isArray(modelIds) ? modelIds[0] : modelIds);
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Retrieves category ID from node's extended data.
|
|
54
|
-
*/
|
|
55
|
-
ModelsTreeNode.getCategoryId = (node) => node.extendedData?.categoryId;
|
|
56
|
-
})(ModelsTreeNode || (exports.ModelsTreeNode = ModelsTreeNode = {}));
|
|
57
|
-
//# sourceMappingURL=ModelsTreeNode.js.map
|
package/lib/cjs/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModelsTreeNode.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/models-tree/internal/ModelsTreeNode.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAGhG,8EAAmE;AAOnE;;GAEG;AACH,IAAiB,cAAc,CAiD9B;AAjDD,WAAiB,cAAc;IAC7B;;OAEG;IACU,4BAAa,GAAG,CAAC,IAA0C,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC;IAE5G;;OAEG;IACU,0BAAW,GAAG,CAAC,IAA0C,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC;IAExG;;OAEG;IACU,6BAAc,GAAG,CAAC,IAA0C,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC;IAE9G,gCAAgC;IACnB,sBAAO,GAAG,CAAC,IAAoB,EAAyE,EAAE;QACrH,IAAI,2CAAgB,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YAC9C,OAAO,sBAAsB,CAAC;SAC/B;QACD,IAAI,eAAA,aAAa,CAAC,IAAI,CAAC,EAAE;YACvB,OAAO,SAAS,CAAC;SAClB;QACD,IAAI,eAAA,WAAW,CAAC,IAAI,CAAC,EAAE;YACrB,OAAO,OAAO,CAAC;SAChB;QACD,IAAI,eAAA,cAAc,CAAC,IAAI,CAAC,EAAE;YACxB,OAAO,UAAU,CAAC;SACnB;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF;;OAEG;IACU,yBAAU,GAAG,CAAC,IAA0C,EAA0B,EAAE;QAC/F,IAAI,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE;YAC9B,OAAO,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC;SACnC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QAClD,OAAO,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IACxE,CAAC,CAAC;IAEF;;OAEG;IACU,4BAAa,GAAG,CAAC,IAA0C,EAA0B,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,UAAU,CAAC;AACrI,CAAC,EAjDgB,cAAc,8BAAd,cAAc,QAiD9B","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport type { Id64String } from \"@itwin/core-bentley\";\nimport { HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\n\ninterface ModelsTreeNode {\n key: HierarchyNodeKey;\n extendedData?: { [id: string]: any };\n}\n\n/**\n * @internal\n */\nexport namespace ModelsTreeNode {\n /**\n * Determines if a node represents a subject.\n */\n export const isSubjectNode = (node: Pick<ModelsTreeNode, \"extendedData\">) => !!node.extendedData?.isSubject;\n\n /**\n * Determines if a node represents a model.\n */\n export const isModelNode = (node: Pick<ModelsTreeNode, \"extendedData\">) => !!node.extendedData?.isModel;\n\n /**\n * Determines if a node represents a category.\n */\n export const isCategoryNode = (node: Pick<ModelsTreeNode, \"extendedData\">) => !!node.extendedData?.isCategory;\n\n /** Returns type of the node. */\n export const getType = (node: ModelsTreeNode): \"subject\" | \"model\" | \"category\" | \"element\" | \"elements-class-group\" => {\n if (HierarchyNodeKey.isClassGrouping(node.key)) {\n return \"elements-class-group\";\n }\n if (isSubjectNode(node)) {\n return \"subject\";\n }\n if (isModelNode(node)) {\n return \"model\";\n }\n if (isCategoryNode(node)) {\n return \"category\";\n }\n return \"element\";\n };\n\n /**\n * Retrieves model ID from node's extended data.\n */\n export const getModelId = (node: Pick<ModelsTreeNode, \"extendedData\">): Id64String | undefined => {\n if (node.extendedData?.modelId) {\n return node.extendedData?.modelId;\n }\n\n const modelIds = node.extendedData?.modelIds?.[0];\n return modelIds && (Array.isArray(modelIds) ? modelIds[0] : modelIds);\n };\n\n /**\n * Retrieves category ID from node's extended data.\n */\n export const getCategoryId = (node: Pick<ModelsTreeNode, \"extendedData\">): Id64String | undefined => node.extendedData?.categoryId;\n}\n"]}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import type { GroupingHierarchyNode, HierarchyFilteringPath } from "@itwin/presentation-hierarchies";
|
|
2
|
-
import type { HierarchyVisibilityHandler, HierarchyVisibilityHandlerOverridableMethod, VisibilityStatus } from "../../common/UseHierarchyVisibility.js";
|
|
3
|
-
import type { ModelsTreeIdsCache } from "./ModelsTreeIdsCache.js";
|
|
4
|
-
import type { Id64Arg, Id64Array, Id64Set, Id64String } from "@itwin/core-bentley";
|
|
5
|
-
import type { Viewport } from "@itwin/core-frontend";
|
|
6
|
-
import type { ECClassHierarchyInspector } from "@itwin/presentation-shared";
|
|
7
|
-
/** @beta */
|
|
8
|
-
interface GetCategoryVisibilityStatusProps {
|
|
9
|
-
categoryId: Id64String;
|
|
10
|
-
modelId: Id64String;
|
|
11
|
-
}
|
|
12
|
-
/** @beta */
|
|
13
|
-
interface ChangeCategoryVisibilityStateProps extends GetCategoryVisibilityStatusProps {
|
|
14
|
-
on: boolean;
|
|
15
|
-
}
|
|
16
|
-
/** @beta */
|
|
17
|
-
interface GetGeometricElementVisibilityStatusProps {
|
|
18
|
-
elementId: Id64String;
|
|
19
|
-
modelId: Id64String;
|
|
20
|
-
categoryId: Id64String;
|
|
21
|
-
}
|
|
22
|
-
/** @beta */
|
|
23
|
-
interface ChangeGeometricElementsDisplayStateProps {
|
|
24
|
-
elementIds: Id64Set;
|
|
25
|
-
modelId: Id64String;
|
|
26
|
-
categoryId: Id64String;
|
|
27
|
-
on: boolean;
|
|
28
|
-
}
|
|
29
|
-
/** @beta */
|
|
30
|
-
interface ChangeModelVisibilityStateProps {
|
|
31
|
-
ids: Id64Arg;
|
|
32
|
-
on: boolean;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Functionality of Models tree visibility handler that can be overridden.
|
|
36
|
-
* Each callback is provided original implementation and reference to a `HierarchyVisibilityHandler`.
|
|
37
|
-
* @beta
|
|
38
|
-
*/
|
|
39
|
-
export interface ModelsTreeVisibilityHandlerOverrides {
|
|
40
|
-
getSubjectNodeVisibility?: HierarchyVisibilityHandlerOverridableMethod<(props: {
|
|
41
|
-
ids: Id64Array;
|
|
42
|
-
}) => Promise<VisibilityStatus>>;
|
|
43
|
-
getModelDisplayStatus?: HierarchyVisibilityHandlerOverridableMethod<(props: {
|
|
44
|
-
id: Id64String;
|
|
45
|
-
}) => Promise<VisibilityStatus>>;
|
|
46
|
-
getCategoryDisplayStatus?: HierarchyVisibilityHandlerOverridableMethod<(props: GetCategoryVisibilityStatusProps) => Promise<VisibilityStatus>>;
|
|
47
|
-
getElementGroupingNodeDisplayStatus?: HierarchyVisibilityHandlerOverridableMethod<(props: {
|
|
48
|
-
node: GroupingHierarchyNode;
|
|
49
|
-
}) => Promise<VisibilityStatus>>;
|
|
50
|
-
getElementDisplayStatus?: HierarchyVisibilityHandlerOverridableMethod<(props: GetGeometricElementVisibilityStatusProps) => Promise<VisibilityStatus>>;
|
|
51
|
-
changeSubjectNodeState?: HierarchyVisibilityHandlerOverridableMethod<(props: {
|
|
52
|
-
ids: Id64Array;
|
|
53
|
-
on: boolean;
|
|
54
|
-
}) => Promise<void>>;
|
|
55
|
-
changeModelState?: HierarchyVisibilityHandlerOverridableMethod<(props: ChangeModelVisibilityStateProps) => Promise<void>>;
|
|
56
|
-
changeCategoryState?: HierarchyVisibilityHandlerOverridableMethod<(props: ChangeCategoryVisibilityStateProps) => Promise<void>>;
|
|
57
|
-
changeElementGroupingNodeState?: HierarchyVisibilityHandlerOverridableMethod<(props: {
|
|
58
|
-
node: GroupingHierarchyNode;
|
|
59
|
-
on: boolean;
|
|
60
|
-
}) => Promise<void>>;
|
|
61
|
-
changeElementsState?: HierarchyVisibilityHandlerOverridableMethod<(props: ChangeGeometricElementsDisplayStateProps) => Promise<void>>;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Props for `createModelsTreeVisibilityHandler`.
|
|
65
|
-
* @internal
|
|
66
|
-
*/
|
|
67
|
-
export interface ModelsTreeVisibilityHandlerProps {
|
|
68
|
-
viewport: Viewport;
|
|
69
|
-
idsCache: ModelsTreeIdsCache;
|
|
70
|
-
imodelAccess: ECClassHierarchyInspector;
|
|
71
|
-
overrides?: ModelsTreeVisibilityHandlerOverrides;
|
|
72
|
-
filteredPaths?: HierarchyFilteringPath[];
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Creates an instance if `ModelsTreeVisibilityHandler`.
|
|
76
|
-
* @internal
|
|
77
|
-
*/
|
|
78
|
-
export declare function createModelsTreeVisibilityHandler(props: ModelsTreeVisibilityHandlerProps): HierarchyVisibilityHandler;
|
|
79
|
-
/**
|
|
80
|
-
* Enables display of all given models. Also enables display of all categories and clears always and
|
|
81
|
-
* never drawn lists in the viewport.
|
|
82
|
-
* @public
|
|
83
|
-
*/
|
|
84
|
-
export declare function showAllModels(models: string[], viewport: Viewport): Promise<void>;
|
|
85
|
-
/**
|
|
86
|
-
* Disables display of all given models.
|
|
87
|
-
* @public
|
|
88
|
-
*/
|
|
89
|
-
export declare function hideAllModels(models: string[], viewport: Viewport): Promise<void>;
|
|
90
|
-
/**
|
|
91
|
-
* Inverts display of all given models.
|
|
92
|
-
* @public
|
|
93
|
-
*/
|
|
94
|
-
export declare function invertAllModels(models: string[], viewport: Viewport): Promise<void>;
|
|
95
|
-
/**
|
|
96
|
-
* Based on the value of `enable` argument, either enables or disables display of given models.
|
|
97
|
-
* @public
|
|
98
|
-
*/
|
|
99
|
-
export declare function toggleModels(models: string[], enable: boolean, viewport: Viewport): Promise<void>;
|
|
100
|
-
/**
|
|
101
|
-
* Checks if all given models are displayed in given viewport.
|
|
102
|
-
* @public
|
|
103
|
-
*/
|
|
104
|
-
export declare function areAllModelsVisible(models: string[], viewport: Viewport): boolean;
|
|
105
|
-
export {};
|
|
106
|
-
//# sourceMappingURL=ModelsTreeVisibilityHandler.d.ts.map
|