@itwin/tree-widget-react 3.0.0-dev.0 → 3.0.0-dev.2
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 +9 -1
- package/README.md +232 -147
- package/lib/cjs/TreeWidget.d.ts +0 -1
- package/lib/cjs/TreeWidget.js +0 -6
- package/lib/cjs/TreeWidget.js.map +1 -1
- package/lib/cjs/components/SelectableTree.d.ts +3 -9
- package/lib/cjs/components/SelectableTree.js +1 -1
- package/lib/cjs/components/SelectableTree.js.map +1 -1
- package/lib/cjs/components/TreeSelector.d.ts +2 -2
- package/lib/cjs/components/TreeSelector.js.map +1 -1
- package/lib/cjs/components/TreeWidgetUiItemsProvider.d.ts +14 -25
- package/lib/cjs/components/TreeWidgetUiItemsProvider.js +43 -45
- package/lib/cjs/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/cjs/components/tree-header/TreeHeader.js +10 -10
- package/lib/cjs/components/tree-header/TreeHeader.js.map +1 -1
- package/lib/cjs/components/tree-header/TreeHeader.scss +7 -41
- package/lib/cjs/components/trees/Tree.scss +23 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTree.d.ts +22 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTree.js +78 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTree.js.map +1 -0
- package/lib/{esm/components/trees/category-tree → cjs/components/trees/categories-tree}/CategoriesTreeButtons.d.ts +2 -9
- package/lib/cjs/components/trees/{category-tree → categories-tree}/CategoriesTreeButtons.js +10 -11
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -0
- package/lib/{esm/components/trees/category-tree → cjs/components/trees/categories-tree}/CategoriesTreeComponent.d.ts +11 -12
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.js +75 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -0
- package/lib/cjs/components/trees/{stateless/categories-tree → categories-tree}/CategoriesTreeDefinition.js +7 -2
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -0
- package/lib/cjs/components/trees/{stateless/categories-tree → categories-tree}/CategoriesVisibilityHandler.d.ts +6 -6
- package/lib/cjs/components/trees/{stateless/categories-tree → categories-tree}/CategoriesVisibilityHandler.js +10 -10
- package/lib/cjs/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +1 -0
- package/lib/cjs/components/trees/categories-tree/UseCategories.d.ts +8 -0
- package/lib/cjs/components/trees/categories-tree/UseCategories.js +22 -0
- package/lib/cjs/components/trees/categories-tree/UseCategories.js.map +1 -0
- package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.d.ts +46 -0
- package/lib/cjs/components/trees/{CategoriesVisibilityUtils.js → common/CategoriesVisibilityUtils.js} +56 -8
- package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.js.map +1 -0
- package/lib/{esm/components/trees/stateless → cjs/components/trees}/common/FocusedInstancesContext.d.ts +2 -1
- package/lib/cjs/components/trees/common/FocusedInstancesContext.js.map +1 -0
- package/lib/{esm/components/trees/stateless → cjs/components/trees}/common/FocusedInstancesContextProvider.d.ts +1 -1
- package/lib/cjs/components/trees/{stateless/common → common}/FocusedInstancesContextProvider.js +30 -6
- package/lib/cjs/components/trees/common/FocusedInstancesContextProvider.js.map +1 -0
- package/lib/cjs/components/trees/common/Rxjs.d.ts +10 -0
- package/lib/cjs/components/trees/common/Rxjs.js +46 -0
- package/lib/cjs/components/trees/common/Rxjs.js.map +1 -0
- package/lib/cjs/components/trees/common/UseFeatureReporting.d.ts +11 -0
- package/lib/cjs/components/trees/common/UseFeatureReporting.js +10 -1
- package/lib/cjs/components/trees/common/UseFeatureReporting.js.map +1 -1
- package/lib/cjs/components/trees/common/UseFiltering.d.ts +12 -0
- package/lib/cjs/components/trees/common/UseFiltering.js +29 -0
- package/lib/cjs/components/trees/common/UseFiltering.js.map +1 -0
- package/lib/{esm/components/trees/stateless → cjs/components/trees}/common/UseHierarchiesLocalization.d.ts +2 -2
- package/lib/cjs/components/trees/{stateless/common → common}/UseHierarchiesLocalization.js +12 -11
- package/lib/cjs/components/trees/common/UseHierarchiesLocalization.js.map +1 -0
- package/lib/cjs/components/trees/common/UseHierarchyFiltering.d.ts +19 -0
- package/lib/cjs/components/trees/{stateless/common → common}/UseHierarchyFiltering.js +44 -26
- package/lib/cjs/components/trees/common/UseHierarchyFiltering.js.map +1 -0
- package/lib/cjs/components/trees/common/UseHierarchyVisibility.d.ts +30 -0
- package/lib/cjs/components/trees/{stateless/common → common}/UseHierarchyVisibility.js +45 -29
- package/lib/cjs/components/trees/common/UseHierarchyVisibility.js.map +1 -0
- package/lib/cjs/components/trees/common/UseIModelChangeListener.d.ts +9 -0
- package/lib/cjs/components/trees/common/UseIModelChangeListener.js +20 -0
- package/lib/cjs/components/trees/common/UseIModelChangeListener.js.map +1 -0
- package/lib/cjs/components/trees/common/UseMultiCheckboxHandler.js +35 -0
- package/lib/cjs/components/trees/common/UseMultiCheckboxHandler.js.map +1 -0
- package/lib/cjs/components/trees/common/UseNodeHighlighting.d.ts +16 -0
- package/lib/cjs/components/trees/common/UseNodeHighlighting.js +140 -0
- package/lib/cjs/components/trees/common/UseNodeHighlighting.js.map +1 -0
- package/lib/cjs/components/trees/common/Utils.d.ts +16 -6
- package/lib/cjs/components/trees/common/Utils.js +38 -34
- package/lib/cjs/components/trees/common/Utils.js.map +1 -1
- package/lib/cjs/components/trees/common/components/BaseTree.d.ts +34 -0
- package/lib/cjs/components/trees/common/components/BaseTree.js +78 -0
- package/lib/cjs/components/trees/common/components/BaseTree.js.map +1 -0
- package/lib/cjs/components/trees/common/components/Delayed.js.map +1 -0
- package/lib/cjs/components/trees/common/components/ProgressOverlay.js.map +1 -0
- package/lib/cjs/components/trees/common/components/TreeNodeCheckbox.d.ts +20 -0
- package/lib/cjs/components/trees/{stateless/common/components/VisibilityTreeNodeCheckbox.js → common/components/TreeNodeCheckbox.js} +11 -7
- package/lib/cjs/components/trees/common/components/TreeNodeCheckbox.js.map +1 -0
- package/lib/cjs/components/trees/common/components/TreeNodeRenderer.d.ts +13 -0
- package/lib/cjs/components/trees/{stateless/common/components/VisibilityTreeNodeRenderer.js → common/components/TreeNodeRenderer.js} +6 -6
- package/lib/cjs/components/trees/common/components/TreeNodeRenderer.js.map +1 -0
- package/lib/cjs/components/trees/common/components/TreeRenderer.d.ts +17 -0
- package/lib/cjs/components/trees/common/components/TreeRenderer.js +44 -0
- package/lib/cjs/components/trees/common/components/TreeRenderer.js.map +1 -0
- package/lib/cjs/components/trees/common/components/TreeRenderer.scss +62 -0
- package/lib/cjs/components/trees/common/components/VisibilityTree.d.ts +14 -0
- package/lib/cjs/components/trees/common/components/VisibilityTree.js +41 -0
- package/lib/cjs/components/trees/common/components/VisibilityTree.js.map +1 -0
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +11 -35
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.js +29 -83
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +14 -14
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +12 -12
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
- package/lib/{esm/components/trees/stateless → cjs/components/trees}/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +6 -2
- package/lib/cjs/components/trees/{stateless/external-sources-tree → external-sources-tree}/ExternalSourcesTreeDefinition.js +55 -37
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js.map +1 -0
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.d.ts +11 -35
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.js +41 -55
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +14 -14
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.js +12 -12
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/{stateless/imodel-content-tree → imodel-content-tree}/IModelContentTreeDefinition.d.ts +3 -0
- package/lib/cjs/components/trees/{stateless/imodel-content-tree → imodel-content-tree}/IModelContentTreeDefinition.js +248 -268
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -0
- package/lib/cjs/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.d.ts +26 -0
- package/lib/cjs/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +203 -0
- package/lib/cjs/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -0
- package/lib/cjs/components/trees/index.d.ts +4 -19
- package/lib/cjs/components/trees/index.js +9 -31
- package/lib/cjs/components/trees/index.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTree.d.ts +17 -72
- package/lib/cjs/components/trees/models-tree/ModelsTree.js +196 -135
- package/lib/cjs/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.d.ts +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js +40 -25
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.d.ts +13 -12
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js +35 -26
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/{esm/components/trees/stateless → cjs/components/trees}/models-tree/ModelsTreeDefinition.d.ts +36 -4
- package/lib/cjs/components/trees/models-tree/ModelsTreeDefinition.js +617 -0
- package/lib/cjs/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -0
- package/lib/cjs/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.d.ts +24 -0
- package/lib/cjs/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js +121 -0
- package/lib/cjs/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +44 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeIdsCache.js +325 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeNode.d.ts +31 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeNode.js +40 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeNode.js.map +1 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +122 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +757 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -0
- package/lib/cjs/components/trees/models-tree/internal/Tooltip.d.ts +13 -0
- package/lib/cjs/components/trees/models-tree/internal/Tooltip.js +29 -0
- package/lib/cjs/components/trees/models-tree/internal/Tooltip.js.map +1 -0
- package/lib/cjs/components/trees/models-tree/internal/VisibilityChangeEventListener.d.ts +10 -0
- package/lib/cjs/components/trees/models-tree/internal/VisibilityChangeEventListener.js +43 -0
- package/lib/cjs/components/trees/models-tree/internal/VisibilityChangeEventListener.js.map +1 -0
- package/lib/cjs/tree-widget-react.d.ts +3 -4
- package/lib/cjs/tree-widget-react.js +8 -4
- package/lib/cjs/tree-widget-react.js.map +1 -1
- package/lib/esm/TreeWidget.d.ts +0 -1
- package/lib/esm/TreeWidget.js +0 -6
- package/lib/esm/TreeWidget.js.map +1 -1
- package/lib/esm/components/SelectableTree.d.ts +3 -9
- package/lib/esm/components/SelectableTree.js +1 -1
- package/lib/esm/components/SelectableTree.js.map +1 -1
- package/lib/esm/components/TreeSelector.d.ts +2 -2
- package/lib/esm/components/TreeSelector.js.map +1 -1
- package/lib/esm/components/TreeWidgetUiItemsProvider.d.ts +14 -25
- package/lib/esm/components/TreeWidgetUiItemsProvider.js +42 -44
- package/lib/esm/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/esm/components/tree-header/TreeHeader.js +10 -10
- package/lib/esm/components/tree-header/TreeHeader.js.map +1 -1
- package/lib/esm/components/tree-header/TreeHeader.scss +7 -41
- package/lib/esm/components/trees/Tree.scss +23 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTree.d.ts +22 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTree.js +74 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTree.js.map +1 -0
- package/lib/{cjs/components/trees/category-tree → esm/components/trees/categories-tree}/CategoriesTreeButtons.d.ts +2 -9
- package/lib/esm/components/trees/{category-tree → categories-tree}/CategoriesTreeButtons.js +7 -8
- package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -0
- package/lib/{cjs/components/trees/category-tree → esm/components/trees/categories-tree}/CategoriesTreeComponent.d.ts +11 -12
- package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.js +68 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -0
- package/lib/esm/components/trees/{stateless/categories-tree → categories-tree}/CategoriesTreeDefinition.js +7 -2
- package/lib/esm/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -0
- package/lib/esm/components/trees/{stateless/categories-tree → categories-tree}/CategoriesVisibilityHandler.d.ts +6 -6
- package/lib/esm/components/trees/{stateless/categories-tree → categories-tree}/CategoriesVisibilityHandler.js +8 -8
- package/lib/esm/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +1 -0
- package/lib/esm/components/trees/categories-tree/UseCategories.d.ts +8 -0
- package/lib/esm/components/trees/categories-tree/UseCategories.js +18 -0
- package/lib/esm/components/trees/categories-tree/UseCategories.js.map +1 -0
- package/lib/esm/components/trees/common/CategoriesVisibilityUtils.d.ts +46 -0
- package/lib/esm/components/trees/{CategoriesVisibilityUtils.js → common/CategoriesVisibilityUtils.js} +51 -6
- package/lib/esm/components/trees/common/CategoriesVisibilityUtils.js.map +1 -0
- package/lib/{cjs/components/trees/stateless → esm/components/trees}/common/FocusedInstancesContext.d.ts +2 -1
- package/lib/esm/components/trees/common/FocusedInstancesContext.js.map +1 -0
- package/lib/{cjs/components/trees/stateless → esm/components/trees}/common/FocusedInstancesContextProvider.d.ts +1 -1
- package/lib/esm/components/trees/{stateless/common → common}/FocusedInstancesContextProvider.js +30 -6
- package/lib/esm/components/trees/common/FocusedInstancesContextProvider.js.map +1 -0
- package/lib/esm/components/trees/common/Rxjs.d.ts +10 -0
- package/lib/esm/components/trees/common/Rxjs.js +40 -0
- package/lib/esm/components/trees/common/Rxjs.js.map +1 -0
- package/lib/esm/components/trees/common/UseFeatureReporting.d.ts +11 -0
- package/lib/esm/components/trees/common/UseFeatureReporting.js +8 -0
- package/lib/esm/components/trees/common/UseFeatureReporting.js.map +1 -1
- package/lib/esm/components/trees/common/UseFiltering.d.ts +12 -0
- package/lib/esm/components/trees/common/UseFiltering.js +25 -0
- package/lib/esm/components/trees/common/UseFiltering.js.map +1 -0
- package/lib/{cjs/components/trees/stateless → esm/components/trees}/common/UseHierarchiesLocalization.d.ts +2 -2
- package/lib/esm/components/trees/common/UseHierarchiesLocalization.js +30 -0
- package/lib/esm/components/trees/common/UseHierarchiesLocalization.js.map +1 -0
- package/lib/esm/components/trees/common/UseHierarchyFiltering.d.ts +19 -0
- package/lib/esm/components/trees/{stateless/common → common}/UseHierarchyFiltering.js +45 -27
- package/lib/esm/components/trees/common/UseHierarchyFiltering.js.map +1 -0
- package/lib/esm/components/trees/common/UseHierarchyVisibility.d.ts +30 -0
- package/lib/esm/components/trees/{stateless/common → common}/UseHierarchyVisibility.js +45 -29
- package/lib/esm/components/trees/common/UseHierarchyVisibility.js.map +1 -0
- package/lib/esm/components/trees/common/UseIModelChangeListener.d.ts +9 -0
- package/lib/esm/components/trees/common/UseIModelChangeListener.js +16 -0
- package/lib/esm/components/trees/common/UseIModelChangeListener.js.map +1 -0
- package/lib/esm/components/trees/common/UseMultiCheckboxHandler.js +31 -0
- package/lib/esm/components/trees/common/UseMultiCheckboxHandler.js.map +1 -0
- package/lib/esm/components/trees/common/UseNodeHighlighting.d.ts +16 -0
- package/lib/esm/components/trees/common/UseNodeHighlighting.js +136 -0
- package/lib/esm/components/trees/common/UseNodeHighlighting.js.map +1 -0
- package/lib/esm/components/trees/common/Utils.d.ts +16 -6
- package/lib/esm/components/trees/common/Utils.js +33 -29
- package/lib/esm/components/trees/common/Utils.js.map +1 -1
- package/lib/esm/components/trees/common/components/BaseTree.d.ts +34 -0
- package/lib/esm/components/trees/common/components/BaseTree.js +74 -0
- package/lib/esm/components/trees/common/components/BaseTree.js.map +1 -0
- package/lib/esm/components/trees/common/components/Delayed.js.map +1 -0
- package/lib/esm/components/trees/common/components/ProgressOverlay.js.map +1 -0
- package/lib/esm/components/trees/common/components/TreeNodeCheckbox.d.ts +20 -0
- package/lib/esm/components/trees/{stateless/common/components/VisibilityTreeNodeCheckbox.js → common/components/TreeNodeCheckbox.js} +6 -5
- package/lib/esm/components/trees/common/components/TreeNodeCheckbox.js.map +1 -0
- package/lib/esm/components/trees/common/components/TreeNodeRenderer.d.ts +13 -0
- package/lib/esm/components/trees/common/components/TreeNodeRenderer.js +13 -0
- package/lib/esm/components/trees/common/components/TreeNodeRenderer.js.map +1 -0
- package/lib/esm/components/trees/common/components/TreeRenderer.d.ts +17 -0
- package/lib/esm/components/trees/common/components/TreeRenderer.js +40 -0
- package/lib/esm/components/trees/common/components/TreeRenderer.js.map +1 -0
- package/lib/esm/components/trees/common/components/TreeRenderer.scss +62 -0
- package/lib/esm/components/trees/common/components/VisibilityTree.d.ts +14 -0
- package/lib/esm/components/trees/common/components/VisibilityTree.js +37 -0
- package/lib/esm/components/trees/common/components/VisibilityTree.js.map +1 -0
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +11 -35
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.js +27 -58
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +14 -14
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +12 -12
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
- package/lib/{cjs/components/trees/stateless → esm/components/trees}/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +6 -2
- package/lib/esm/components/trees/{stateless/external-sources-tree → external-sources-tree}/ExternalSourcesTreeDefinition.js +55 -37
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js.map +1 -0
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.d.ts +11 -35
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.js +39 -53
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +14 -14
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.js +12 -12
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/{stateless/imodel-content-tree → imodel-content-tree}/IModelContentTreeDefinition.d.ts +3 -0
- package/lib/esm/components/trees/{stateless/imodel-content-tree → imodel-content-tree}/IModelContentTreeDefinition.js +249 -269
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -0
- package/lib/esm/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.d.ts +26 -0
- package/lib/esm/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +199 -0
- package/lib/esm/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -0
- package/lib/esm/components/trees/index.d.ts +4 -19
- package/lib/esm/components/trees/index.js +4 -17
- package/lib/esm/components/trees/index.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTree.d.ts +17 -72
- package/lib/esm/components/trees/models-tree/ModelsTree.js +196 -132
- package/lib/esm/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.d.ts +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js +30 -15
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.d.ts +13 -12
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js +36 -27
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/{cjs/components/trees/stateless → esm/components/trees}/models-tree/ModelsTreeDefinition.d.ts +36 -4
- package/lib/esm/components/trees/models-tree/ModelsTreeDefinition.js +613 -0
- package/lib/esm/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -0
- package/lib/esm/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.d.ts +24 -0
- package/lib/esm/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js +117 -0
- package/lib/esm/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +44 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeIdsCache.js +321 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeNode.d.ts +31 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeNode.js +37 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeNode.js.map +1 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +122 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +748 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -0
- package/lib/esm/components/trees/models-tree/internal/Tooltip.d.ts +13 -0
- package/lib/esm/components/trees/models-tree/internal/Tooltip.js +24 -0
- package/lib/esm/components/trees/models-tree/internal/Tooltip.js.map +1 -0
- package/lib/esm/components/trees/models-tree/internal/VisibilityChangeEventListener.d.ts +10 -0
- package/lib/esm/components/trees/models-tree/internal/VisibilityChangeEventListener.js +39 -0
- package/lib/esm/components/trees/models-tree/internal/VisibilityChangeEventListener.js.map +1 -0
- package/lib/esm/tree-widget-react.d.ts +3 -4
- package/lib/esm/tree-widget-react.js +3 -4
- package/lib/esm/tree-widget-react.js.map +1 -1
- package/lib/public/locales/en/TreeWidget.json +126 -62
- package/package.json +18 -11
- package/lib/cjs/components/TreeFilteringState.d.ts +0 -18
- package/lib/cjs/components/TreeFilteringState.js +0 -46
- package/lib/cjs/components/TreeFilteringState.js.map +0 -1
- package/lib/cjs/components/trees/CategoriesVisibilityUtils.d.ts +0 -25
- package/lib/cjs/components/trees/CategoriesVisibilityUtils.js.map +0 -1
- package/lib/cjs/components/trees/VisibilityTreeBase.scss +0 -82
- package/lib/cjs/components/trees/VisibilityTreeEventHandler.d.ts +0 -67
- package/lib/cjs/components/trees/VisibilityTreeEventHandler.js +0 -158
- package/lib/cjs/components/trees/VisibilityTreeEventHandler.js.map +0 -1
- package/lib/cjs/components/trees/VisibilityTreeRenderer.d.ts +0 -100
- package/lib/cjs/components/trees/VisibilityTreeRenderer.js +0 -98
- package/lib/cjs/components/trees/VisibilityTreeRenderer.js.map +0 -1
- package/lib/cjs/components/trees/category-tree/Categories.json +0 -99
- package/lib/cjs/components/trees/category-tree/CategoriesTree.d.ts +0 -60
- package/lib/cjs/components/trees/category-tree/CategoriesTree.js +0 -117
- package/lib/cjs/components/trees/category-tree/CategoriesTree.js.map +0 -1
- package/lib/cjs/components/trees/category-tree/CategoriesTreeButtons.js.map +0 -1
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.js +0 -104
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.js.map +0 -1
- package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.d.ts +0 -65
- package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.js +0 -172
- package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.js.map +0 -1
- package/lib/cjs/components/trees/common/ContextMenu.d.ts +0 -39
- package/lib/cjs/components/trees/common/ContextMenu.js +0 -44
- package/lib/cjs/components/trees/common/ContextMenu.js.map +0 -1
- package/lib/cjs/components/trees/common/ReportingTreeEventHandler.d.ts +0 -27
- package/lib/cjs/components/trees/common/ReportingTreeEventHandler.js +0 -51
- package/lib/cjs/components/trees/common/ReportingTreeEventHandler.js.map +0 -1
- package/lib/cjs/components/trees/common/TreeNodeRenderer.d.ts +0 -61
- package/lib/cjs/components/trees/common/TreeNodeRenderer.js +0 -50
- package/lib/cjs/components/trees/common/TreeNodeRenderer.js.map +0 -1
- package/lib/cjs/components/trees/common/TreeRenderer.d.ts +0 -55
- package/lib/cjs/components/trees/common/TreeRenderer.js +0 -67
- package/lib/cjs/components/trees/common/TreeRenderer.js.map +0 -1
- package/lib/cjs/components/trees/common/TreeRenderer.scss +0 -149
- package/lib/cjs/components/trees/common/Types.d.ts +0 -57
- package/lib/cjs/components/trees/common/Types.js +0 -21
- package/lib/cjs/components/trees/common/Types.js.map +0 -1
- package/lib/cjs/components/trees/common/UseVisibilityTreeState.d.ts +0 -43
- package/lib/cjs/components/trees/common/UseVisibilityTreeState.js +0 -49
- package/lib/cjs/components/trees/common/UseVisibilityTreeState.js.map +0 -1
- package/lib/cjs/components/trees/external-sources-tree/ExternalSources.json +0 -228
- package/lib/cjs/components/trees/imodel-content-tree/IModelContent.json +0 -443
- package/lib/cjs/components/trees/models-tree/ModelsTreeEventHandler.d.ts +0 -19
- package/lib/cjs/components/trees/models-tree/ModelsTreeEventHandler.js +0 -36
- package/lib/cjs/components/trees/models-tree/ModelsTreeEventHandler.js.map +0 -1
- package/lib/cjs/components/trees/models-tree/ModelsVisibilityHandler.d.ts +0 -130
- package/lib/cjs/components/trees/models-tree/ModelsVisibilityHandler.js +0 -651
- package/lib/cjs/components/trees/models-tree/ModelsVisibilityHandler.js.map +0 -1
- package/lib/cjs/components/trees/models-tree/Utils.d.ts +0 -29
- package/lib/cjs/components/trees/models-tree/Utils.js +0 -556
- package/lib/cjs/components/trees/models-tree/Utils.js.map +0 -1
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTree.d.ts +0 -20
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTree.js +0 -61
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTree.js.map +0 -1
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeComponent.d.ts +0 -16
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeComponent.js +0 -43
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeComponent.js.map +0 -1
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeDefinition.js.map +0 -1
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesVisibilityHandler.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/FocusedInstancesContext.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/FocusedInstancesContextProvider.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/UseHierarchiesLocalization.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/UseHierarchyFiltering.d.ts +0 -16
- package/lib/cjs/components/trees/stateless/common/UseHierarchyFiltering.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/UseHierarchyVisibility.d.ts +0 -21
- package/lib/cjs/components/trees/stateless/common/UseHierarchyVisibility.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/UseMultiCheckboxHandler.js +0 -34
- package/lib/cjs/components/trees/stateless/common/UseMultiCheckboxHandler.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/Utils.d.ts +0 -3
- package/lib/cjs/components/trees/stateless/common/Utils.js +0 -23
- package/lib/cjs/components/trees/stateless/common/Utils.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/components/Delayed.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/components/FilterableTree.d.ts +0 -23
- package/lib/cjs/components/trees/stateless/common/components/FilterableTree.js +0 -66
- package/lib/cjs/components/trees/stateless/common/components/FilterableTree.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/components/ProgressOverlay.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTree.d.ts +0 -26
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTree.js +0 -68
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTree.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.d.ts +0 -12
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.d.ts +0 -10
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeRenderer.d.ts +0 -16
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeRenderer.js +0 -23
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeRenderer.js.map +0 -1
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeRenderer.scss +0 -41
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTree.d.ts +0 -13
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTree.js +0 -40
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTree.js.map +0 -1
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.d.ts +0 -14
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.js +0 -25
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.js.map +0 -1
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeDefinition.js.map +0 -1
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTree.d.ts +0 -13
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTree.js +0 -48
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTree.js.map +0 -1
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.d.ts +0 -14
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.js +0 -25
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.js.map +0 -1
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeDefinition.js.map +0 -1
- package/lib/cjs/components/trees/stateless/index.d.ts +0 -5
- package/lib/cjs/components/trees/stateless/index.js +0 -16
- package/lib/cjs/components/trees/stateless/index.js.map +0 -1
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTree.d.ts +0 -16
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTree.js +0 -77
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTree.js.map +0 -1
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeComponent.d.ts +0 -17
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeComponent.js +0 -55
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeComponent.js.map +0 -1
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeDefinition.js +0 -856
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeDefinition.js.map +0 -1
- package/lib/cjs/components/trees/stateless/models-tree/ModelsVisibilityHandler.d.ts +0 -48
- package/lib/cjs/components/trees/stateless/models-tree/ModelsVisibilityHandler.js +0 -470
- package/lib/cjs/components/trees/stateless/models-tree/ModelsVisibilityHandler.js.map +0 -1
- package/lib/cjs/components/utils/UseTreeTransientState.d.ts +0 -19
- package/lib/cjs/components/utils/UseTreeTransientState.js +0 -33
- package/lib/cjs/components/utils/UseTreeTransientState.js.map +0 -1
- package/lib/esm/components/TreeFilteringState.d.ts +0 -18
- package/lib/esm/components/TreeFilteringState.js +0 -42
- package/lib/esm/components/TreeFilteringState.js.map +0 -1
- package/lib/esm/components/trees/CategoriesVisibilityUtils.d.ts +0 -25
- package/lib/esm/components/trees/CategoriesVisibilityUtils.js.map +0 -1
- package/lib/esm/components/trees/VisibilityTreeBase.scss +0 -82
- package/lib/esm/components/trees/VisibilityTreeEventHandler.d.ts +0 -67
- package/lib/esm/components/trees/VisibilityTreeEventHandler.js +0 -154
- package/lib/esm/components/trees/VisibilityTreeEventHandler.js.map +0 -1
- package/lib/esm/components/trees/VisibilityTreeRenderer.d.ts +0 -100
- package/lib/esm/components/trees/VisibilityTreeRenderer.js +0 -86
- package/lib/esm/components/trees/VisibilityTreeRenderer.js.map +0 -1
- package/lib/esm/components/trees/category-tree/Categories.json +0 -99
- package/lib/esm/components/trees/category-tree/CategoriesTree.d.ts +0 -60
- package/lib/esm/components/trees/category-tree/CategoriesTree.js +0 -110
- package/lib/esm/components/trees/category-tree/CategoriesTree.js.map +0 -1
- package/lib/esm/components/trees/category-tree/CategoriesTreeButtons.js.map +0 -1
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.js +0 -97
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.js.map +0 -1
- package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.d.ts +0 -65
- package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.js +0 -164
- package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.js.map +0 -1
- package/lib/esm/components/trees/common/ContextMenu.d.ts +0 -39
- package/lib/esm/components/trees/common/ContextMenu.js +0 -39
- package/lib/esm/components/trees/common/ContextMenu.js.map +0 -1
- package/lib/esm/components/trees/common/ReportingTreeEventHandler.d.ts +0 -27
- package/lib/esm/components/trees/common/ReportingTreeEventHandler.js +0 -47
- package/lib/esm/components/trees/common/ReportingTreeEventHandler.js.map +0 -1
- package/lib/esm/components/trees/common/TreeNodeRenderer.d.ts +0 -61
- package/lib/esm/components/trees/common/TreeNodeRenderer.js +0 -44
- package/lib/esm/components/trees/common/TreeNodeRenderer.js.map +0 -1
- package/lib/esm/components/trees/common/TreeRenderer.d.ts +0 -55
- package/lib/esm/components/trees/common/TreeRenderer.js +0 -59
- package/lib/esm/components/trees/common/TreeRenderer.js.map +0 -1
- package/lib/esm/components/trees/common/TreeRenderer.scss +0 -149
- package/lib/esm/components/trees/common/Types.d.ts +0 -57
- package/lib/esm/components/trees/common/Types.js +0 -18
- package/lib/esm/components/trees/common/Types.js.map +0 -1
- package/lib/esm/components/trees/common/UseVisibilityTreeState.d.ts +0 -43
- package/lib/esm/components/trees/common/UseVisibilityTreeState.js +0 -45
- package/lib/esm/components/trees/common/UseVisibilityTreeState.js.map +0 -1
- package/lib/esm/components/trees/external-sources-tree/ExternalSources.json +0 -228
- package/lib/esm/components/trees/imodel-content-tree/IModelContent.json +0 -443
- package/lib/esm/components/trees/models-tree/ModelsTreeEventHandler.d.ts +0 -19
- package/lib/esm/components/trees/models-tree/ModelsTreeEventHandler.js +0 -32
- package/lib/esm/components/trees/models-tree/ModelsTreeEventHandler.js.map +0 -1
- package/lib/esm/components/trees/models-tree/ModelsVisibilityHandler.d.ts +0 -130
- package/lib/esm/components/trees/models-tree/ModelsVisibilityHandler.js +0 -641
- package/lib/esm/components/trees/models-tree/ModelsVisibilityHandler.js.map +0 -1
- package/lib/esm/components/trees/models-tree/Utils.d.ts +0 -29
- package/lib/esm/components/trees/models-tree/Utils.js +0 -548
- package/lib/esm/components/trees/models-tree/Utils.js.map +0 -1
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTree.d.ts +0 -20
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTree.js +0 -57
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTree.js.map +0 -1
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeComponent.d.ts +0 -16
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeComponent.js +0 -39
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeComponent.js.map +0 -1
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeDefinition.js.map +0 -1
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesVisibilityHandler.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/FocusedInstancesContext.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/FocusedInstancesContextProvider.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/UseHierarchiesLocalization.js +0 -29
- package/lib/esm/components/trees/stateless/common/UseHierarchiesLocalization.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/UseHierarchyFiltering.d.ts +0 -16
- package/lib/esm/components/trees/stateless/common/UseHierarchyFiltering.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/UseHierarchyVisibility.d.ts +0 -21
- package/lib/esm/components/trees/stateless/common/UseHierarchyVisibility.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/UseMultiCheckboxHandler.js +0 -30
- package/lib/esm/components/trees/stateless/common/UseMultiCheckboxHandler.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/Utils.d.ts +0 -3
- package/lib/esm/components/trees/stateless/common/Utils.js +0 -19
- package/lib/esm/components/trees/stateless/common/Utils.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/components/Delayed.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/components/FilterableTree.d.ts +0 -23
- package/lib/esm/components/trees/stateless/common/components/FilterableTree.js +0 -62
- package/lib/esm/components/trees/stateless/common/components/FilterableTree.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/components/ProgressOverlay.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/components/VisibilityTree.d.ts +0 -26
- package/lib/esm/components/trees/stateless/common/components/VisibilityTree.js +0 -64
- package/lib/esm/components/trees/stateless/common/components/VisibilityTree.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.d.ts +0 -12
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.d.ts +0 -10
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.js +0 -13
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeRenderer.d.ts +0 -16
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeRenderer.js +0 -19
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeRenderer.js.map +0 -1
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeRenderer.scss +0 -41
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTree.d.ts +0 -13
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTree.js +0 -36
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTree.js.map +0 -1
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.d.ts +0 -14
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.js +0 -21
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.js.map +0 -1
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeDefinition.js.map +0 -1
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTree.d.ts +0 -13
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTree.js +0 -44
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTree.js.map +0 -1
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.d.ts +0 -14
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.js +0 -21
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.js.map +0 -1
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeDefinition.js.map +0 -1
- package/lib/esm/components/trees/stateless/index.d.ts +0 -5
- package/lib/esm/components/trees/stateless/index.js +0 -9
- package/lib/esm/components/trees/stateless/index.js.map +0 -1
- package/lib/esm/components/trees/stateless/models-tree/ModelsTree.d.ts +0 -16
- package/lib/esm/components/trees/stateless/models-tree/ModelsTree.js +0 -73
- package/lib/esm/components/trees/stateless/models-tree/ModelsTree.js.map +0 -1
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeComponent.d.ts +0 -17
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeComponent.js +0 -51
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeComponent.js.map +0 -1
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeDefinition.js +0 -852
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeDefinition.js.map +0 -1
- package/lib/esm/components/trees/stateless/models-tree/ModelsVisibilityHandler.d.ts +0 -48
- package/lib/esm/components/trees/stateless/models-tree/ModelsVisibilityHandler.js +0 -466
- package/lib/esm/components/trees/stateless/models-tree/ModelsVisibilityHandler.js.map +0 -1
- package/lib/esm/components/utils/UseTreeTransientState.d.ts +0 -19
- package/lib/esm/components/utils/UseTreeTransientState.js +0 -29
- package/lib/esm/components/utils/UseTreeTransientState.js.map +0 -1
- /package/lib/cjs/components/trees/{stateless/categories-tree → categories-tree}/CategoriesTreeDefinition.d.ts +0 -0
- /package/lib/cjs/components/trees/{stateless/common → common}/FocusedInstancesContext.js +0 -0
- /package/lib/cjs/components/trees/{stateless/common → common}/UseMultiCheckboxHandler.d.ts +0 -0
- /package/lib/cjs/components/trees/{stateless/common → common}/components/Delayed.d.ts +0 -0
- /package/lib/cjs/components/trees/{stateless/common → common}/components/Delayed.js +0 -0
- /package/lib/cjs/components/trees/{stateless/common → common}/components/ProgressOverlay.d.ts +0 -0
- /package/lib/cjs/components/trees/{stateless/common → common}/components/ProgressOverlay.js +0 -0
- /package/lib/cjs/components/trees/{stateless/common → common}/components/ProgressOverlay.scss +0 -0
- /package/lib/esm/components/trees/{stateless/categories-tree → categories-tree}/CategoriesTreeDefinition.d.ts +0 -0
- /package/lib/esm/components/trees/{stateless/common → common}/FocusedInstancesContext.js +0 -0
- /package/lib/esm/components/trees/{stateless/common → common}/UseMultiCheckboxHandler.d.ts +0 -0
- /package/lib/esm/components/trees/{stateless/common → common}/components/Delayed.d.ts +0 -0
- /package/lib/esm/components/trees/{stateless/common → common}/components/Delayed.js +0 -0
- /package/lib/esm/components/trees/{stateless/common → common}/components/ProgressOverlay.d.ts +0 -0
- /package/lib/esm/components/trees/{stateless/common → common}/components/ProgressOverlay.js +0 -0
- /package/lib/esm/components/trees/{stateless/common → common}/components/ProgressOverlay.scss +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FocusedInstancesContextProvider.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/FocusedInstancesContextProvider.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAQpE,gBAAgB;AAChB,MAAM,UAAU,+BAA+B,CAAC,EAC9C,gBAAgB,EAChB,SAAS,EACT,QAAQ,GACqE;IAC7E,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAA0B;QAC1D,OAAO,EAAE,KAAK;QACd,MAAM,EAAE,GAAG,EAAE;YACX,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC5D,CAAC;KACF,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IAE9B,SAAS,CAAC,GAAG,EAAE;QAC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,CAAC;qBACZ;iBACF;YACH,CAAC,CAAC;YAEF,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC;QACtD,CAAC,CAAC;QAEF,kBAAkB,EAAE,CAAC;QACrB,OAAO,gBAAgB,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,EAAE;YACjG,IAAI,eAAe,KAAK,SAAS,IAAI,KAAK,KAAK,CAAC,EAAE;gBAChD,OAAO;aACR;YACD,kBAAkB,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,OAAO,EAAE,SAAS,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAE3C,OAAO,KAAC,uBAAuB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAoC,CAAC;AACvG,CAAC;AAED,SAAS,eAAe,CAAC,IAAa;IACpC,OAAO,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,CAAC;AAC7D,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useEffect, useState } from \"react\";\nimport { HierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport { Selectable, Selectables } from \"@itwin/unified-selection\";\nimport { focusedInstancesContext } from \"./FocusedInstancesContext\";\n\nimport type { SelectionStorage } from \"@itwin/presentation-hierarchies-react\";\nimport type { PropsWithChildren } from \"react\";\nimport type { InstanceKey } from \"@itwin/presentation-common\";\nimport type { FocusedInstancesContext } from \"./FocusedInstancesContext\";\nimport type { GroupingHierarchyNode } from \"@itwin/presentation-hierarchies\";\n\n/** @internal */\nexport function FocusedInstancesContextProvider({\n selectionStorage,\n imodelKey,\n children,\n}: PropsWithChildren<{ selectionStorage: SelectionStorage; imodelKey: string }>) {\n const [state, setState] = useState<FocusedInstancesContext>({\n enabled: false,\n toggle: () => {\n setState((prev) => ({ ...prev, enabled: !prev.enabled }));\n },\n });\n const enabled = state.enabled;\n\n useEffect(() => {\n if (!enabled) {\n setState((prev) => ({ ...prev, loadInstanceKeys: undefined }));\n return;\n }\n\n const onSelectionChanged = () => {\n const selection = selectionStorage.getSelection({ imodelKey, level: 0 });\n if (Selectables.isEmpty(selection)) {\n setState((prev) => ({ ...prev, loadInstanceKeys: undefined }));\n return;\n }\n\n const selected: Array<InstanceKey | GroupingHierarchyNode | (() => AsyncIterableIterator<InstanceKey>)> = [];\n Selectables.forEach(selection, (selectable) => {\n if (Selectable.isInstanceKey(selectable)) {\n selected.push(selectable);\n return;\n }\n\n if (isHierarchyNode(selectable.data) && HierarchyNode.isGroupingNode(selectable.data)) {\n selected.push(selectable.data);\n return;\n }\n\n selected.push(selectable.loadInstanceKeys);\n });\n\n const loadInstanceKeys: () => AsyncIterableIterator<InstanceKey | GroupingHierarchyNode> = async function* () {\n for (const item of selected) {\n if (typeof item === \"function\") {\n yield* item();\n } else {\n yield item;\n }\n }\n };\n\n setState((prev) => ({ ...prev, loadInstanceKeys }));\n };\n\n onSelectionChanged();\n return selectionStorage.selectionChangeEvent.addListener(({ imodelKey: changeImodelKey, level }) => {\n if (changeImodelKey !== imodelKey || level !== 0) {\n return;\n }\n onSelectionChanged();\n });\n }, [enabled, imodelKey, selectionStorage]);\n\n return <focusedInstancesContext.Provider value={state}>{children}</focusedInstancesContext.Provider>;\n}\n\nfunction isHierarchyNode(data: unknown): data is HierarchyNode {\n return !!data && typeof data === \"object\" && \"key\" in data;\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Observable, ObservableInput, OperatorFunction } from "rxjs";
|
|
2
|
+
/**
|
|
3
|
+
* Applies reduce function and "returns" early if the predicate returns `false` for the accumulator.
|
|
4
|
+
*/
|
|
5
|
+
export declare function reduceWhile<TValue, TAccumulator>(predicate: (x: TAccumulator) => boolean, reduceFunc: (acc: TAccumulator, val: TValue) => TAccumulator, initial: TAccumulator): OperatorFunction<TValue, TAccumulator | undefined>;
|
|
6
|
+
/** Same as `firstValueFrom` except it won't throw if the observable emits no values. */
|
|
7
|
+
export declare function toVoidPromise(obs: Observable<any>): Promise<void>;
|
|
8
|
+
/** Returns observable results in an array */
|
|
9
|
+
export declare function collect<T>(obs: ObservableInput<T>): Promise<T[]>;
|
|
10
|
+
//# sourceMappingURL=Rxjs.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { defaultIfEmpty, from, last, scan, takeWhile } from "rxjs";
|
|
6
|
+
/**
|
|
7
|
+
* Applies reduce function and "returns" early if the predicate returns `false` for the accumulator.
|
|
8
|
+
*/
|
|
9
|
+
export function reduceWhile(predicate, reduceFunc, initial) {
|
|
10
|
+
return (obs) => {
|
|
11
|
+
return obs.pipe(scan(reduceFunc, initial), takeWhile(predicate, true), defaultIfEmpty(undefined), last());
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/** Same as `firstValueFrom` except it won't throw if the observable emits no values. */
|
|
15
|
+
export async function toVoidPromise(obs) {
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
obs.subscribe({
|
|
18
|
+
complete: () => resolve(),
|
|
19
|
+
error: reject,
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** Returns observable results in an array */
|
|
24
|
+
export async function collect(obs) {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
const arr = new Array();
|
|
27
|
+
from(obs).subscribe({
|
|
28
|
+
next(item) {
|
|
29
|
+
arr.push(item);
|
|
30
|
+
},
|
|
31
|
+
complete() {
|
|
32
|
+
resolve(arr);
|
|
33
|
+
},
|
|
34
|
+
error(reason) {
|
|
35
|
+
reject(reason);
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=Rxjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Rxjs.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/Rxjs.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAInE;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,SAAuC,EACvC,UAA4D,EAC5D,OAAqB;IAErB,OAAO,CAAC,GAAG,EAAE,EAAE;QACb,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5G,CAAC,CAAC;AACJ,CAAC;AAED,wFAAwF;AACxF,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,GAAoB;IACtD,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,GAAG,CAAC,SAAS,CAAC;YACZ,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE;YACzB,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,6CAA6C;AAC7C,MAAM,CAAC,KAAK,UAAU,OAAO,CAAI,GAAuB;IACtD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,GAAG,GAAG,IAAI,KAAK,EAAK,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC;YAClB,IAAI,CAAC,IAAO;gBACV,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjB,CAAC;YACD,QAAQ;gBACN,OAAO,CAAC,GAAG,CAAC,CAAC;YACf,CAAC;YACD,KAAK,CAAC,MAAM;gBACV,MAAM,CAAC,MAAM,CAAC,CAAC;YACjB,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { 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 */\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/** Same as `firstValueFrom` except it won't throw if the observable emits no values. */\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/** Returns observable results in an array */\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 reject(reason);\n },\n });\n });\n}\n"]}
|
|
@@ -20,4 +20,15 @@ export type UsageTrackedFeatures = "visibility-change" | "hierarchy-level-filter
|
|
|
20
20
|
* @internal
|
|
21
21
|
*/
|
|
22
22
|
export declare function useFeatureReporting(props: UseFeatureReportingProps): UseFeatureReportingResult;
|
|
23
|
+
interface UseReportingActionProps<T> {
|
|
24
|
+
action: T;
|
|
25
|
+
featureId?: UsageTrackedFeatures;
|
|
26
|
+
reportUsage?: (props: {
|
|
27
|
+
featureId?: UsageTrackedFeatures;
|
|
28
|
+
reportInteraction: true;
|
|
29
|
+
}) => void;
|
|
30
|
+
}
|
|
31
|
+
/** @internal */
|
|
32
|
+
export declare function useReportingAction<T extends (...args: any[]) => void>({ action, featureId, reportUsage }: UseReportingActionProps<T>): (...args: Parameters<T>) => void;
|
|
33
|
+
export {};
|
|
23
34
|
//# sourceMappingURL=UseFeatureReporting.d.ts.map
|
|
@@ -23,4 +23,12 @@ export function useFeatureReporting(props) {
|
|
|
23
23
|
}, [treeIdentifier]);
|
|
24
24
|
return { reportUsage };
|
|
25
25
|
}
|
|
26
|
+
/** @internal */
|
|
27
|
+
// istanbul ignore next
|
|
28
|
+
export function useReportingAction({ action, featureId, reportUsage }) {
|
|
29
|
+
return useCallback((...args) => {
|
|
30
|
+
reportUsage?.({ featureId, reportInteraction: true });
|
|
31
|
+
action(...args);
|
|
32
|
+
}, [action, reportUsage, featureId]);
|
|
33
|
+
}
|
|
26
34
|
//# sourceMappingURL=UseFeatureReporting.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseFeatureReporting.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/UseFeatureReporting.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAmBvD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IAChD,MAAM,gBAAgB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;IAE/C,SAAS,CAAC,GAAG,EAAE;QACb,gBAAgB,CAAC,OAAO,GAAG,aAAa,CAAC;IAC3C,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAoE,EAAE,EAAE;QACrG,IAAI,iBAAiB,KAAK,KAAK,EAAE;YAC/B,gBAAgB,CAAC,OAAO,EAAE,CAAC,OAAO,cAAc,EAAE,CAAC,CAAC;SACrD;QACD,IAAI,SAAS,EAAE;YACb,gBAAgB,CAAC,OAAO,EAAE,CAAC,GAAG,cAAc,IAAI,SAAS,EAAE,CAAC,CAAC;SAC9D;IACH,CAAC,EACD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,EAAE,WAAW,EAAE,CAAC;AACzB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useCallback, useEffect, useRef } from \"react\";\n\n/** @internal */\nexport interface UseFeatureReportingProps {\n treeIdentifier: string;\n onFeatureUsed?: (featureId: string) => void;\n}\n\n/** @internal */\nexport interface UseFeatureReportingResult {\n reportUsage: (props: { featureId?: UsageTrackedFeatures; reportInteraction: boolean }) => void;\n}\n\n/**\n * Features that are tracked for usage.\n * @internal\n */\nexport type UsageTrackedFeatures = \"visibility-change\" | \"hierarchy-level-filtering\" | \"filtering\" | \"hierarchy-level-size-limit-hit\" | \"zoom-to-node\";\n\n/**\n * Enables feature reporting for a tree component.\n * @internal\n */\nexport function useFeatureReporting(props: UseFeatureReportingProps): UseFeatureReportingResult {\n const { treeIdentifier, onFeatureUsed } = props;\n const onFeatureUsedRef = useRef(onFeatureUsed);\n\n useEffect(() => {\n onFeatureUsedRef.current = onFeatureUsed;\n }, [onFeatureUsed]);\n\n const reportUsage = useCallback(\n ({ featureId, reportInteraction }: { featureId?: UsageTrackedFeatures; reportInteraction: boolean }) => {\n if (reportInteraction !== false) {\n onFeatureUsedRef.current?.(`use-${treeIdentifier}`);\n }\n if (featureId) {\n onFeatureUsedRef.current?.(`${treeIdentifier}-${featureId}`);\n }\n },\n [treeIdentifier],\n );\n\n return { reportUsage };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"UseFeatureReporting.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/UseFeatureReporting.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAmBvD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EAAE,cAAc,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IAChD,MAAM,gBAAgB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;IAE/C,SAAS,CAAC,GAAG,EAAE;QACb,gBAAgB,CAAC,OAAO,GAAG,aAAa,CAAC;IAC3C,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,MAAM,WAAW,GAAG,WAAW,CAC7B,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAoE,EAAE,EAAE;QACrG,IAAI,iBAAiB,KAAK,KAAK,EAAE;YAC/B,gBAAgB,CAAC,OAAO,EAAE,CAAC,OAAO,cAAc,EAAE,CAAC,CAAC;SACrD;QACD,IAAI,SAAS,EAAE;YACb,gBAAgB,CAAC,OAAO,EAAE,CAAC,GAAG,cAAc,IAAI,SAAS,EAAE,CAAC,CAAC;SAC9D;IACH,CAAC,EACD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,EAAE,WAAW,EAAE,CAAC;AACzB,CAAC;AAQD,gBAAgB;AAChB,uBAAuB;AACvB,MAAM,UAAU,kBAAkB,CAAqC,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAA8B;IACnI,OAAO,WAAW,CAChB,CAAC,GAAG,IAAI,EAAE,EAAE;QACV,WAAW,EAAE,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IAClB,CAAC,EACD,CAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,CACjC,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useCallback, useEffect, useRef } from \"react\";\n\n/** @internal */\nexport interface UseFeatureReportingProps {\n treeIdentifier: string;\n onFeatureUsed?: (featureId: string) => void;\n}\n\n/** @internal */\nexport interface UseFeatureReportingResult {\n reportUsage: (props: { featureId?: UsageTrackedFeatures; reportInteraction: boolean }) => void;\n}\n\n/**\n * Features that are tracked for usage.\n * @internal\n */\nexport type UsageTrackedFeatures = \"visibility-change\" | \"hierarchy-level-filtering\" | \"filtering\" | \"hierarchy-level-size-limit-hit\" | \"zoom-to-node\";\n\n/**\n * Enables feature reporting for a tree component.\n * @internal\n */\nexport function useFeatureReporting(props: UseFeatureReportingProps): UseFeatureReportingResult {\n const { treeIdentifier, onFeatureUsed } = props;\n const onFeatureUsedRef = useRef(onFeatureUsed);\n\n useEffect(() => {\n onFeatureUsedRef.current = onFeatureUsed;\n }, [onFeatureUsed]);\n\n const reportUsage = useCallback(\n ({ featureId, reportInteraction }: { featureId?: UsageTrackedFeatures; reportInteraction: boolean }) => {\n if (reportInteraction !== false) {\n onFeatureUsedRef.current?.(`use-${treeIdentifier}`);\n }\n if (featureId) {\n onFeatureUsedRef.current?.(`${treeIdentifier}-${featureId}`);\n }\n },\n [treeIdentifier],\n );\n\n return { reportUsage };\n}\n\ninterface UseReportingActionProps<T> {\n action: T;\n featureId?: UsageTrackedFeatures;\n reportUsage?: (props: { featureId?: UsageTrackedFeatures; reportInteraction: true }) => void;\n}\n\n/** @internal */\n// istanbul ignore next\nexport function useReportingAction<T extends (...args: any[]) => void>({ action, featureId, reportUsage }: UseReportingActionProps<T>) {\n return useCallback<(...args: Parameters<T>) => void>(\n (...args) => {\n reportUsage?.({ featureId, reportInteraction: true });\n action(...args);\n },\n [action, reportUsage, featureId],\n );\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface UseFilteringResult {
|
|
2
|
+
filter: string;
|
|
3
|
+
activeMatchIndex: number;
|
|
4
|
+
totalMatches: number;
|
|
5
|
+
applyFilter: (filter: string) => void;
|
|
6
|
+
clearFilter: () => void;
|
|
7
|
+
onHighlightChanged: (index: number, matches?: number) => void;
|
|
8
|
+
}
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare function useFiltering(): UseFilteringResult;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=UseFiltering.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { useCallback, useState } from "react";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export function useFiltering() {
|
|
8
|
+
const [filter, setFilter] = useState("");
|
|
9
|
+
const [activeMatchIndex, setActiveMatchIndex] = useState(0);
|
|
10
|
+
const [totalMatches, setTotalMatches] = useState(0);
|
|
11
|
+
const applyFilter = useCallback((newFilter) => {
|
|
12
|
+
setActiveMatchIndex(0);
|
|
13
|
+
setFilter(newFilter);
|
|
14
|
+
}, []);
|
|
15
|
+
const clearFilter = useCallback(() => {
|
|
16
|
+
setActiveMatchIndex(0);
|
|
17
|
+
setFilter("");
|
|
18
|
+
}, []);
|
|
19
|
+
const onHighlightChanged = useCallback((index, matches) => {
|
|
20
|
+
setActiveMatchIndex(index);
|
|
21
|
+
matches && setTotalMatches(matches);
|
|
22
|
+
}, []);
|
|
23
|
+
return { filter, activeMatchIndex, totalMatches, applyFilter, clearFilter, onHighlightChanged };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=UseFiltering.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UseFiltering.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/UseFiltering.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAW9C,gBAAgB;AAChB,MAAM,UAAU,YAAY;IAC1B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACzC,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC5D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEpD,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,SAAiB,EAAE,EAAE;QACpD,mBAAmB,CAAC,CAAC,CAAC,CAAC;QACvB,SAAS,CAAC,SAAS,CAAC,CAAC;IACvB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE;QACnC,mBAAmB,CAAC,CAAC,CAAC,CAAC;QACvB,SAAS,CAAC,EAAE,CAAC,CAAC;IAChB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,kBAAkB,GAAG,WAAW,CAAC,CAAC,KAAa,EAAE,OAAgB,EAAE,EAAE;QACzE,mBAAmB,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;AAClG,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useCallback, useState } from \"react\";\n\ninterface UseFilteringResult {\n filter: string;\n activeMatchIndex: number;\n totalMatches: number;\n applyFilter: (filter: string) => void;\n clearFilter: () => void;\n onHighlightChanged: (index: number, matches?: number) => void;\n}\n\n/** @internal */\nexport function useFiltering(): UseFilteringResult {\n const [filter, setFilter] = useState(\"\");\n const [activeMatchIndex, setActiveMatchIndex] = useState(0);\n const [totalMatches, setTotalMatches] = useState(0);\n\n const applyFilter = useCallback((newFilter: string) => {\n setActiveMatchIndex(0);\n setFilter(newFilter);\n }, []);\n\n const clearFilter = useCallback(() => {\n setActiveMatchIndex(0);\n setFilter(\"\");\n }, []);\n\n const onHighlightChanged = useCallback((index: number, matches?: number) => {\n setActiveMatchIndex(index);\n matches && setTotalMatches(matches);\n }, []);\n\n return { filter, activeMatchIndex, totalMatches, applyFilter, clearFilter, onHighlightChanged };\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { TreeRenderer, useTree } from "@itwin/presentation-hierarchies-react";
|
|
2
2
|
type UseTreeLocalizedStrings = Parameters<typeof useTree>[0]["localizedStrings"];
|
|
3
3
|
type TreeRendererLocalizedStrings = Parameters<typeof TreeRenderer>[0]["localizedStrings"];
|
|
4
|
-
type
|
|
4
|
+
type UseHierarchiesLocalizationResult = UseTreeLocalizedStrings & TreeRendererLocalizedStrings;
|
|
5
5
|
/** @internal */
|
|
6
|
-
export declare function useHierarchiesLocalization():
|
|
6
|
+
export declare function useHierarchiesLocalization(): UseHierarchiesLocalizationResult;
|
|
7
7
|
export {};
|
|
8
8
|
//# sourceMappingURL=UseHierarchiesLocalization.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
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 { useMemo } from "react";
|
|
6
|
+
import { TreeWidget } from "../../../TreeWidget";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export function useHierarchiesLocalization() {
|
|
9
|
+
const stringValues = Object.values(getLocalizedStrings());
|
|
10
|
+
const localizedStrings = useMemo(getLocalizedStrings, stringValues);
|
|
11
|
+
return localizedStrings;
|
|
12
|
+
}
|
|
13
|
+
function getLocalizedStrings() {
|
|
14
|
+
return {
|
|
15
|
+
// strings for the `useUnifiedSelectionTree` hook
|
|
16
|
+
unspecified: TreeWidget.translate("presentation-hierarchies.unspecified"),
|
|
17
|
+
other: TreeWidget.translate("presentation-hierarchies.other"),
|
|
18
|
+
// strings for `TreeRenderer` and `TreeNodeRenderer`
|
|
19
|
+
loading: TreeWidget.translate("presentation-hierarchies.loading"),
|
|
20
|
+
filterHierarchyLevel: TreeWidget.translate("presentation-hierarchies.filterHierarchyLevel"),
|
|
21
|
+
clearHierarchyLevelFilter: TreeWidget.translate("presentation-hierarchies.clearHierarchyLevelFilter"),
|
|
22
|
+
noFilteredChildren: TreeWidget.translate("presentation-hierarchies.noFilteredChildren"),
|
|
23
|
+
resultLimitExceeded: TreeWidget.translate("presentation-hierarchies.resultLimitExceeded"),
|
|
24
|
+
resultLimitExceededWithFiltering: TreeWidget.translate("presentation-hierarchies.resultLimitExceededWithFiltering"),
|
|
25
|
+
increaseHierarchyLimit: TreeWidget.translate("presentation-hierarchies.increaseHierarchyLimit"),
|
|
26
|
+
increaseHierarchyLimitWithFiltering: TreeWidget.translate("presentation-hierarchies.increaseHierarchyLimitWithFiltering"),
|
|
27
|
+
retry: TreeWidget.translate("presentation-hierarchies.retry"),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=UseHierarchiesLocalization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UseHierarchiesLocalization.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/UseHierarchiesLocalization.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AASjD,gBAAgB;AAChB,MAAM,UAAU,0BAA0B;IACxC,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAG,CAAC,CAAC;IAC3D,MAAM,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,EAAE,YAAY,CAAC,CAAC;IACpE,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,SAAS,mBAAmB;IAC1B,OAAO;QACL,iDAAiD;QACjD,WAAW,EAAE,UAAU,CAAC,SAAS,CAAC,sCAAsC,CAAC;QACzE,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,gCAAgC,CAAC;QAE7D,oDAAoD;QACpD,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,kCAAkC,CAAC;QACjE,oBAAoB,EAAE,UAAU,CAAC,SAAS,CAAC,+CAA+C,CAAC;QAC3F,yBAAyB,EAAE,UAAU,CAAC,SAAS,CAAC,oDAAoD,CAAC;QACrG,kBAAkB,EAAE,UAAU,CAAC,SAAS,CAAC,6CAA6C,CAAC;QACvF,mBAAmB,EAAE,UAAU,CAAC,SAAS,CAAC,8CAA8C,CAAC;QACzF,gCAAgC,EAAE,UAAU,CAAC,SAAS,CAAC,2DAA2D,CAAC;QACnH,sBAAsB,EAAE,UAAU,CAAC,SAAS,CAAC,iDAAiD,CAAC;QAC/F,mCAAmC,EAAE,UAAU,CAAC,SAAS,CAAC,8DAA8D,CAAC;QACzH,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,gCAAgC,CAAC;KAC9D,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useMemo } from \"react\";\nimport { TreeWidget } from \"../../../TreeWidget\";\n\nimport type { TreeRenderer, useTree } from \"@itwin/presentation-hierarchies-react\";\n\ntype UseTreeLocalizedStrings = Parameters<typeof useTree>[0][\"localizedStrings\"];\ntype TreeRendererLocalizedStrings = Parameters<typeof TreeRenderer>[0][\"localizedStrings\"];\n\ntype UseHierarchiesLocalizationResult = UseTreeLocalizedStrings & TreeRendererLocalizedStrings;\n\n/** @internal */\nexport function useHierarchiesLocalization(): UseHierarchiesLocalizationResult {\n const stringValues = Object.values(getLocalizedStrings()!);\n const localizedStrings = useMemo(getLocalizedStrings, stringValues);\n return localizedStrings;\n}\n\nfunction getLocalizedStrings(): UseHierarchiesLocalizationResult {\n return {\n // strings for the `useUnifiedSelectionTree` hook\n unspecified: TreeWidget.translate(\"presentation-hierarchies.unspecified\"),\n other: TreeWidget.translate(\"presentation-hierarchies.other\"),\n\n // strings for `TreeRenderer` and `TreeNodeRenderer`\n loading: TreeWidget.translate(\"presentation-hierarchies.loading\"),\n filterHierarchyLevel: TreeWidget.translate(\"presentation-hierarchies.filterHierarchyLevel\"),\n clearHierarchyLevelFilter: TreeWidget.translate(\"presentation-hierarchies.clearHierarchyLevelFilter\"),\n noFilteredChildren: TreeWidget.translate(\"presentation-hierarchies.noFilteredChildren\"),\n resultLimitExceeded: TreeWidget.translate(\"presentation-hierarchies.resultLimitExceeded\"),\n resultLimitExceededWithFiltering: TreeWidget.translate(\"presentation-hierarchies.resultLimitExceededWithFiltering\"),\n increaseHierarchyLimit: TreeWidget.translate(\"presentation-hierarchies.increaseHierarchyLimit\"),\n increaseHierarchyLimitWithFiltering: TreeWidget.translate(\"presentation-hierarchies.increaseHierarchyLimitWithFiltering\"),\n retry: TreeWidget.translate(\"presentation-hierarchies.retry\"),\n };\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IModelConnection } from "@itwin/core-frontend";
|
|
3
|
+
import type { HierarchyLevelDetails } from "@itwin/presentation-hierarchies-react";
|
|
4
|
+
import type { UsageTrackedFeatures } from "./UseFeatureReporting";
|
|
5
|
+
interface UseHierarchyLevelFilteringProps {
|
|
6
|
+
imodel: IModelConnection;
|
|
7
|
+
defaultHierarchyLevelSizeLimit: number;
|
|
8
|
+
reportUsage?: (props: {
|
|
9
|
+
featureId?: UsageTrackedFeatures;
|
|
10
|
+
reportInteraction: true;
|
|
11
|
+
}) => void;
|
|
12
|
+
}
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLimit, reportUsage }: UseHierarchyLevelFilteringProps): {
|
|
15
|
+
onFilterClick: import("react").Dispatch<import("react").SetStateAction<HierarchyLevelDetails | undefined>>;
|
|
16
|
+
filteringDialog: JSX.Element;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=UseHierarchyFiltering.d.ts.map
|
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
/*---------------------------------------------------------------------------------------------
|
|
3
3
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
import { useCallback, useMemo, useState } from "react";
|
|
7
7
|
import { useDebouncedAsyncValue } from "@itwin/components-react";
|
|
8
|
+
import { CompressedId64Set } from "@itwin/core-bentley";
|
|
9
|
+
import { ProgressRadial } from "@itwin/itwinui-react";
|
|
8
10
|
import { DefaultContentDisplayTypes, KeySet } from "@itwin/presentation-common";
|
|
9
11
|
import { PresentationInstanceFilter, PresentationInstanceFilterDialog } from "@itwin/presentation-components";
|
|
10
12
|
import { Presentation } from "@itwin/presentation-frontend";
|
|
11
13
|
import { GenericInstanceFilter, RowsLimitExceededError } from "@itwin/presentation-hierarchies";
|
|
12
|
-
import { TreeWidget } from "
|
|
14
|
+
import { TreeWidget } from "../../../TreeWidget";
|
|
15
|
+
import { Delayed } from "./components/Delayed";
|
|
13
16
|
/** @internal */
|
|
14
|
-
export function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLimit,
|
|
17
|
+
export function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLimit, reportUsage }) {
|
|
15
18
|
const [filteringOptions, setFilteringOptions] = useState();
|
|
16
|
-
const onFilterClick = useCallback((nodeId) => {
|
|
17
|
-
const hierarchyDetails = getHierarchyLevelDetails(nodeId);
|
|
18
|
-
setFilteringOptions(hierarchyDetails ? { nodeId, hierarchyDetails } : undefined);
|
|
19
|
-
}, [getHierarchyLevelDetails]);
|
|
20
19
|
const propertiesSource = useMemo(() => {
|
|
21
20
|
if (!filteringOptions) {
|
|
22
21
|
return undefined;
|
|
23
22
|
}
|
|
24
23
|
return async () => {
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
24
|
+
const keySet = await collectInstanceKeys(filteringOptions.getInstanceKeysIterator());
|
|
25
|
+
if (keySet.isEmpty) {
|
|
27
26
|
throw new Error("Hierarchy level is empty - unable to create content descriptor.");
|
|
28
27
|
}
|
|
29
28
|
const descriptor = await Presentation.presentation.getContentDescriptor({
|
|
@@ -42,16 +41,16 @@ export function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLi
|
|
|
42
41
|
],
|
|
43
42
|
},
|
|
44
43
|
displayType: DefaultContentDisplayTypes.PropertyPane,
|
|
45
|
-
keys:
|
|
44
|
+
keys: keySet,
|
|
46
45
|
});
|
|
47
46
|
if (!descriptor) {
|
|
48
47
|
throw new Error("Failed to create content descriptor");
|
|
49
48
|
}
|
|
50
|
-
return { descriptor, inputKeys };
|
|
49
|
+
return { descriptor, inputKeys: keySet };
|
|
51
50
|
};
|
|
52
51
|
}, [filteringOptions, imodel]);
|
|
53
52
|
const getInitialFilter = useMemo(() => {
|
|
54
|
-
const currentFilter = filteringOptions?.
|
|
53
|
+
const currentFilter = filteringOptions?.instanceFilter;
|
|
55
54
|
if (!currentFilter) {
|
|
56
55
|
return undefined;
|
|
57
56
|
}
|
|
@@ -61,7 +60,8 @@ export function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLi
|
|
|
61
60
|
if (!filteringOptions) {
|
|
62
61
|
return;
|
|
63
62
|
}
|
|
64
|
-
|
|
63
|
+
reportUsage?.({ featureId: info ? "hierarchy-level-filtering" : undefined, reportInteraction: true });
|
|
64
|
+
filteringOptions.setInstanceFilter(toGenericFilter(info));
|
|
65
65
|
setFilteringOptions(undefined);
|
|
66
66
|
}, onClose: () => {
|
|
67
67
|
setFilteringOptions(undefined);
|
|
@@ -69,41 +69,59 @@ export function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLi
|
|
|
69
69
|
if (!filteringOptions) {
|
|
70
70
|
return null;
|
|
71
71
|
}
|
|
72
|
-
return (_jsx(MatchingInstancesCount, { filter: filter, hierarchyLevelDetails: filteringOptions
|
|
72
|
+
return (_jsx(MatchingInstancesCount, { filter: filter, hierarchyLevelDetails: filteringOptions, defaultHierarchyLevelSizeLimit: defaultHierarchyLevelSizeLimit }));
|
|
73
73
|
} }));
|
|
74
74
|
return {
|
|
75
|
-
onFilterClick,
|
|
75
|
+
onFilterClick: setFilteringOptions,
|
|
76
76
|
filteringDialog,
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
function MatchingInstancesCount({ filter, defaultHierarchyLevelSizeLimit, hierarchyLevelDetails }) {
|
|
80
|
-
const { value } = useDebouncedAsyncValue(useCallback(async () => {
|
|
80
|
+
const { value, inProgress } = useDebouncedAsyncValue(useCallback(async () => {
|
|
81
81
|
const instanceFilter = toGenericFilter(filter);
|
|
82
82
|
try {
|
|
83
|
-
const
|
|
83
|
+
const instanceCount = await countInstanceKeys(hierarchyLevelDetails.getInstanceKeysIterator({
|
|
84
84
|
instanceFilter,
|
|
85
85
|
hierarchyLevelSizeLimit: hierarchyLevelDetails.sizeLimit ?? defaultHierarchyLevelSizeLimit,
|
|
86
86
|
}));
|
|
87
|
-
return TreeWidget.translate("
|
|
87
|
+
return TreeWidget.translate("filteringDialog.matchingInstancesCount", {
|
|
88
|
+
instanceCount: instanceCount.toLocaleString(undefined, { useGrouping: true }),
|
|
89
|
+
});
|
|
88
90
|
}
|
|
89
91
|
catch (e) {
|
|
90
92
|
if (e instanceof RowsLimitExceededError) {
|
|
91
|
-
return TreeWidget.translate("
|
|
93
|
+
return TreeWidget.translate("filteringDialog.filterExceedsLimit", { limit: e.limit.toLocaleString(undefined, { useGrouping: true }) });
|
|
92
94
|
}
|
|
93
|
-
return TreeWidget.translate("
|
|
95
|
+
return TreeWidget.translate("filteringDialog.failedToCalculateMatchingInstancesCount");
|
|
94
96
|
}
|
|
95
97
|
}, [filter, hierarchyLevelDetails, defaultHierarchyLevelSizeLimit]));
|
|
96
|
-
if (
|
|
97
|
-
return
|
|
98
|
+
if (inProgress) {
|
|
99
|
+
return (_jsxs(Delayed, { show: true, children: [TreeWidget.translate("filteringDialog.matchingInstancesCount", { instanceCount: "" }), _jsx(ProgressRadial, { size: "x-small" })] }));
|
|
100
|
+
}
|
|
101
|
+
return value ? _jsx(_Fragment, { children: value }) : null;
|
|
102
|
+
}
|
|
103
|
+
async function countInstanceKeys(iterator) {
|
|
104
|
+
let result = 0;
|
|
105
|
+
for await (const _ of iterator) {
|
|
106
|
+
result++;
|
|
98
107
|
}
|
|
99
|
-
return
|
|
108
|
+
return result;
|
|
100
109
|
}
|
|
101
110
|
async function collectInstanceKeys(iterator) {
|
|
102
|
-
const
|
|
103
|
-
for await (const
|
|
104
|
-
|
|
111
|
+
const idsByClassName = new Map();
|
|
112
|
+
for await (const { className, id } of iterator) {
|
|
113
|
+
let idSet = idsByClassName.get(className);
|
|
114
|
+
if (!idSet) {
|
|
115
|
+
idSet = [];
|
|
116
|
+
idsByClassName.set(className, idSet);
|
|
117
|
+
}
|
|
118
|
+
idSet.push(id);
|
|
119
|
+
}
|
|
120
|
+
const instanceKeys = new Array();
|
|
121
|
+
for (const [className, ids] of idsByClassName) {
|
|
122
|
+
instanceKeys.push([className.toLowerCase(), CompressedId64Set.sortAndCompress(ids)]);
|
|
105
123
|
}
|
|
106
|
-
return
|
|
124
|
+
return KeySet.fromJSON({ instanceKeys, nodeKeys: [] });
|
|
107
125
|
}
|
|
108
126
|
function fromGenericFilter(descriptor, filter) {
|
|
109
127
|
const presentationFilter = GenericInstanceFilter.isFilterRuleGroup(filter.rules) && filter.rules.rules.length === 0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UseHierarchyFiltering.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/UseHierarchyFiltering.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAC9G,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAChG,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,O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kB,IAAI,EAAE,CAAC;aAC3C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,eAAe,CAAC;aACzH,MAAM,CAAC,CAAC,SAAS,EAA0B,EAAE,CAAC,SAAS,KAAK,SAAS,CAAC;KAC1E,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,UAA2C;IAClE,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,SAAS,CAAC;KAClB;IAED,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;QACtB,OAAO,UAAU,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC;YACtC,CAAC,CAAC;gBACE,kBAAkB,EAAE,EAAE;gBACtB,gBAAgB,EAAE,EAAE;gBACpB,kBAAkB,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC;gBACnE,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;aACtC;YACH,CAAC,CAAC,SAAS,CAAC;KACf;IAED,OAAO,0BAA0B,CAAC,uBAAuB,CAAC,UAAU,CAAC,MAAM,EAAE,UAAU,CAAC,WAAW,CAAC,CAAC;AACvG,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useCallback, useMemo, useState } from \"react\";\nimport { useDebouncedAsyncValue } from \"@itwin/components-react\";\nimport { CompressedId64Set } from \"@itwin/core-bentley\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\nimport { DefaultContentDisplayTypes, KeySet } from \"@itwin/presentation-common\";\nimport { PresentationInstanceFilter, PresentationInstanceFilterDialog } from \"@itwin/presentation-components\";\nimport { Presentation } from \"@itwin/presentation-frontend\";\nimport { GenericInstanceFilter, RowsLimitExceededError } from \"@itwin/presentation-hierarchies\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { Delayed } from \"./components/Delayed\";\n\nimport type { Id64Array, Id64String } from \"@itwin/core-bentley\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { ClassInfo, Descriptor } from \"@itwin/presentation-common\";\nimport type { PresentationInstanceFilterInfo, PresentationInstanceFilterPropertiesSource } from \"@itwin/presentation-components\";\nimport type { HierarchyLevelDetails } from \"@itwin/presentation-hierarchies-react\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\nimport type { UsageTrackedFeatures } from \"./UseFeatureReporting\";\n\ninterface UseHierarchyLevelFilteringProps {\n imodel: IModelConnection;\n defaultHierarchyLevelSizeLimit: number;\n reportUsage?: (props: { featureId?: UsageTrackedFeatures; reportInteraction: true }) => void;\n}\n\n/** @internal */\nexport function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLimit, reportUsage }: UseHierarchyLevelFilteringProps) {\n const [filteringOptions, setFilteringOptions] = useState<HierarchyLevelDetails>();\n\n const propertiesSource = useMemo<(() => Promise<PresentationInstanceFilterPropertiesSource>) | undefined>(() => {\n if (!filteringOptions) {\n return undefined;\n }\n\n return async () => {\n const keySet = await collectInstanceKeys(filteringOptions.getInstanceKeysIterator());\n if (keySet.isEmpty) {\n throw new Error(\"Hierarchy level is empty - unable to create content descriptor.\");\n }\n\n const descriptor = await Presentation.presentation.getContentDescriptor({\n imodel,\n rulesetOrId: {\n id: `Hierarchy level descriptor ruleset`,\n rules: [\n {\n ruleType: \"Content\",\n specifications: [\n {\n specType: \"SelectedNodeInstances\",\n },\n ],\n },\n ],\n },\n displayType: DefaultContentDisplayTypes.PropertyPane,\n keys: keySet,\n });\n if (!descriptor) {\n throw new Error(\"Failed to create content descriptor\");\n }\n\n return { descriptor, inputKeys: keySet };\n };\n }, [filteringOptions, imodel]);\n\n const getInitialFilter = useMemo(() => {\n const currentFilter = filteringOptions?.instanceFilter;\n if (!currentFilter) {\n return undefined;\n }\n\n return (descriptor: Descriptor) => fromGenericFilter(descriptor, currentFilter);\n }, [filteringOptions]);\n\n const filteringDialog = (\n <PresentationInstanceFilterDialog\n imodel={imodel}\n isOpen={!!filteringOptions}\n onApply={(info) => {\n if (!filteringOptions) {\n return;\n }\n reportUsage?.({ featureId: info ? \"hierarchy-level-filtering\" : undefined, reportInteraction: true });\n filteringOptions.setInstanceFilter(toGenericFilter(info));\n setFilteringOptions(undefined);\n }}\n onClose={() => {\n setFilteringOptions(undefined);\n }}\n propertiesSource={propertiesSource}\n initialFilter={getInitialFilter}\n filterResultsCountRenderer={(filter) => {\n if (!filteringOptions) {\n return null;\n }\n\n return (\n <MatchingInstancesCount filter={filter} hierarchyLevelDetails={filteringOptions} defaultHierarchyLevelSizeLimit={defaultHierarchyLevelSizeLimit} />\n );\n }}\n />\n );\n\n return {\n onFilterClick: setFilteringOptions,\n filteringDialog,\n };\n}\n\ninterface MatchingInstancesCountProps {\n filter: PresentationInstanceFilterInfo;\n hierarchyLevelDetails: HierarchyLevelDetails;\n defaultHierarchyLevelSizeLimit: number;\n}\n\nfunction MatchingInstancesCount({ filter, defaultHierarchyLevelSizeLimit, hierarchyLevelDetails }: MatchingInstancesCountProps) {\n const { value, inProgress } = useDebouncedAsyncValue(\n useCallback(async () => {\n const instanceFilter = toGenericFilter(filter);\n try {\n const instanceCount = await countInstanceKeys(\n hierarchyLevelDetails.getInstanceKeysIterator({\n instanceFilter,\n hierarchyLevelSizeLimit: hierarchyLevelDetails.sizeLimit ?? defaultHierarchyLevelSizeLimit,\n }),\n );\n return TreeWidget.translate(\"filteringDialog.matchingInstancesCount\", {\n instanceCount: instanceCount.toLocaleString(undefined, { useGrouping: true }),\n });\n } catch (e) {\n if (e instanceof RowsLimitExceededError) {\n return TreeWidget.translate(\"filteringDialog.filterExceedsLimit\", { limit: e.limit.toLocaleString(undefined, { useGrouping: true }) });\n }\n return TreeWidget.translate(\"filteringDialog.failedToCalculateMatchingInstancesCount\");\n }\n }, [filter, hierarchyLevelDetails, defaultHierarchyLevelSizeLimit]),\n );\n\n if (inProgress) {\n return (\n <Delayed show={true}>\n {TreeWidget.translate(\"filteringDialog.matchingInstancesCount\", { instanceCount: \"\" })}\n <ProgressRadial size=\"x-small\" />\n </Delayed>\n );\n }\n\n return value ? <>{value}</> : null;\n}\n\nasync function countInstanceKeys(iterator: AsyncIterableIterator<InstanceKey>) {\n let result = 0;\n for await (const _ of iterator) {\n result++;\n }\n return result;\n}\n\nasync function collectInstanceKeys(iterator: AsyncIterableIterator<InstanceKey>) {\n const idsByClassName = new Map<Id64String, Id64Array>();\n for await (const { className, id } of iterator) {\n let idSet = idsByClassName.get(className);\n if (!idSet) {\n idSet = [];\n idsByClassName.set(className, idSet);\n }\n idSet.push(id);\n }\n\n const instanceKeys = new Array<[className: string, compressedIds: CompressedId64Set]>();\n for (const [className, ids] of idsByClassName) {\n instanceKeys.push([className.toLowerCase(), CompressedId64Set.sortAndCompress(ids)]);\n }\n return KeySet.fromJSON({ instanceKeys, nodeKeys: [] });\n}\n\nfunction fromGenericFilter(descriptor: Descriptor, filter: GenericInstanceFilter): PresentationInstanceFilterInfo {\n const presentationFilter =\n GenericInstanceFilter.isFilterRuleGroup(filter.rules) && filter.rules.rules.length === 0\n ? undefined\n : PresentationInstanceFilter.fromGenericInstanceFilter(descriptor, filter);\n return {\n filter: presentationFilter,\n usedClasses: (filter.filteredClassNames ?? [])\n .map((name) => descriptor.selectClasses.find((selectClass) => selectClass.selectClassInfo.name === name)?.selectClassInfo)\n .filter((classInfo): classInfo is ClassInfo => classInfo !== undefined),\n };\n}\n\nfunction toGenericFilter(filterInfo?: PresentationInstanceFilterInfo): GenericInstanceFilter | undefined {\n if (!filterInfo) {\n return undefined;\n }\n\n if (!filterInfo.filter) {\n return filterInfo.usedClasses.length > 0\n ? {\n propertyClassNames: [],\n relatedInstances: [],\n filteredClassNames: filterInfo.usedClasses.map((info) => info.name),\n rules: { operator: \"and\", rules: [] },\n }\n : undefined;\n }\n\n return PresentationInstanceFilter.toGenericInstanceFilter(filterInfo.filter, filterInfo.usedClasses);\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { HierarchyNode, PresentationHierarchyNode } from "@itwin/presentation-hierarchies-react";
|
|
2
|
+
import type { TreeNodeCheckboxState } from "./components/TreeNodeCheckbox";
|
|
3
|
+
import type { BeEvent, IDisposable } from "@itwin/core-bentley";
|
|
4
|
+
/**
|
|
5
|
+
* Data structure that describes instance visibility status.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export interface VisibilityStatus {
|
|
9
|
+
state: "visible" | "partial" | "hidden";
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
tooltip?: string;
|
|
12
|
+
}
|
|
13
|
+
/** @internal */
|
|
14
|
+
export interface HierarchyVisibilityHandler extends IDisposable {
|
|
15
|
+
readonly onVisibilityChange: BeEvent<() => void>;
|
|
16
|
+
getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus> | VisibilityStatus;
|
|
17
|
+
changeVisibility(node: HierarchyNode, on: boolean): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
interface UseHierarchyVisibilityProps {
|
|
20
|
+
visibilityHandlerFactory: () => HierarchyVisibilityHandler;
|
|
21
|
+
}
|
|
22
|
+
interface UseHierarchyVisibilityResult {
|
|
23
|
+
onCheckboxClicked: (node: PresentationHierarchyNode, checked: boolean) => void;
|
|
24
|
+
getCheckboxState: (node: PresentationHierarchyNode) => TreeNodeCheckboxState;
|
|
25
|
+
triggerRefresh: () => void;
|
|
26
|
+
}
|
|
27
|
+
/** @internal */
|
|
28
|
+
export declare function useHierarchyVisibility({ visibilityHandlerFactory }: UseHierarchyVisibilityProps): UseHierarchyVisibilityResult;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=UseHierarchyVisibility.d.ts.map
|
|
@@ -6,53 +6,69 @@ import { useEffect, useRef, useState } from "react";
|
|
|
6
6
|
import { defer, distinct, mergeMap, Subject, takeUntil } from "rxjs";
|
|
7
7
|
/** @internal */
|
|
8
8
|
export function useHierarchyVisibility({ visibilityHandlerFactory }) {
|
|
9
|
-
const
|
|
9
|
+
const nodesStateMap = useRef(new Map());
|
|
10
10
|
const [state, setState] = useState({
|
|
11
|
-
|
|
12
|
-
onCheckboxClicked: (
|
|
11
|
+
getCheckboxState: () => ({ state: "off", isDisabled: true }),
|
|
12
|
+
onCheckboxClicked: () => { },
|
|
13
|
+
triggerRefresh: () => { },
|
|
13
14
|
});
|
|
14
15
|
useEffect(() => {
|
|
15
|
-
|
|
16
|
+
nodesStateMap.current.clear();
|
|
16
17
|
const handler = visibilityHandlerFactory();
|
|
17
18
|
const visibilityChanged = new Subject();
|
|
18
19
|
const calculate = new Subject();
|
|
19
20
|
const calculateNodeStatus = (node) => {
|
|
20
21
|
calculate.next(node);
|
|
21
22
|
};
|
|
23
|
+
const resetCache = () => {
|
|
24
|
+
nodesStateMap.current.forEach((value) => {
|
|
25
|
+
value.needsRefresh = true;
|
|
26
|
+
});
|
|
27
|
+
visibilityChanged.next();
|
|
28
|
+
};
|
|
29
|
+
const triggerCheckboxUpdate = () => {
|
|
30
|
+
setState((prev) => ({
|
|
31
|
+
...prev,
|
|
32
|
+
getCheckboxState: createStateGetter(nodesStateMap, calculateNodeStatus),
|
|
33
|
+
}));
|
|
34
|
+
};
|
|
22
35
|
const subscription = calculate
|
|
23
36
|
.pipe(distinct(undefined, visibilityChanged), mergeMap((node) => defer(async () => ({ node, status: await handler.getVisibilityStatus(node.nodeData) })).pipe(takeUntil(visibilityChanged))))
|
|
24
37
|
.subscribe({
|
|
25
38
|
next: ({ node, status }) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
39
|
+
nodesStateMap.current.set(node.id, {
|
|
40
|
+
node,
|
|
41
|
+
state: {
|
|
42
|
+
state: status.state === "visible" ? "on" : status.state === "partial" ? "partial" : "off",
|
|
43
|
+
tooltip: status.tooltip,
|
|
44
|
+
isDisabled: status.isDisabled,
|
|
45
|
+
},
|
|
46
|
+
needsRefresh: false,
|
|
47
|
+
});
|
|
48
|
+
triggerCheckboxUpdate();
|
|
31
49
|
},
|
|
32
50
|
});
|
|
33
51
|
const changeVisibility = (node, checked) => {
|
|
34
52
|
void handler.changeVisibility(node.nodeData, checked);
|
|
35
|
-
const
|
|
36
|
-
if (!
|
|
53
|
+
const entry = nodesStateMap.current.get(node.id);
|
|
54
|
+
if (!entry) {
|
|
37
55
|
return;
|
|
38
56
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
57
|
+
entry.state.state = checked ? "on" : "off";
|
|
58
|
+
entry.state.tooltip = undefined;
|
|
59
|
+
triggerCheckboxUpdate();
|
|
42
60
|
};
|
|
43
61
|
setState({
|
|
44
62
|
onCheckboxClicked: changeVisibility,
|
|
45
|
-
|
|
63
|
+
getCheckboxState: createStateGetter(nodesStateMap, calculateNodeStatus),
|
|
64
|
+
triggerRefresh: () => {
|
|
65
|
+
resetCache();
|
|
66
|
+
triggerCheckboxUpdate();
|
|
67
|
+
},
|
|
46
68
|
});
|
|
47
69
|
const removeListener = handler.onVisibilityChange.addListener(() => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
51
|
-
visibilityChanged.next();
|
|
52
|
-
setState((prev) => ({
|
|
53
|
-
...prev,
|
|
54
|
-
getCheckboxStatus: createStatusGetter(statusMap, calculateNodeStatus),
|
|
55
|
-
}));
|
|
70
|
+
resetCache();
|
|
71
|
+
triggerCheckboxUpdate();
|
|
56
72
|
});
|
|
57
73
|
return () => {
|
|
58
74
|
subscription.unsubscribe();
|
|
@@ -62,17 +78,17 @@ export function useHierarchyVisibility({ visibilityHandlerFactory }) {
|
|
|
62
78
|
}, [visibilityHandlerFactory]);
|
|
63
79
|
return state;
|
|
64
80
|
}
|
|
65
|
-
function
|
|
81
|
+
function createStateGetter(map, calculateVisibility) {
|
|
66
82
|
return (node) => {
|
|
67
|
-
const
|
|
68
|
-
if (
|
|
83
|
+
const entry = map.current.get(node.id);
|
|
84
|
+
if (entry === undefined) {
|
|
69
85
|
calculateVisibility(node);
|
|
70
|
-
return { state: "
|
|
86
|
+
return { state: "off", isDisabled: true };
|
|
71
87
|
}
|
|
72
|
-
if (
|
|
88
|
+
if (entry.needsRefresh) {
|
|
73
89
|
calculateVisibility(node);
|
|
74
90
|
}
|
|
75
|
-
return
|
|
91
|
+
return entry.state;
|
|
76
92
|
};
|
|
77
93
|
}
|
|
78
94
|
//# sourceMappingURL=UseHierarchyVisibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UseHierarchyVisibility.js","sourceRoot":"","sources":["../../../../../src/components/trees/common/UseHierarchyVisibility.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAkCrE,gBAAgB;AAChB,MAAM,UAAU,sBAAsB,CAAC,EAAE,wBAAwB,EAA+B;IAC9F,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,GAAG,EAAoG,CAAC,CAAC;IAC1I,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAA+B;QAC/D,gBAAgB,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;QAC5D,iBAAiB,EAAE,GAAG,EAAE,GAAE,CAAC;QAC3B,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;KACzB,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,aAAa,CAAC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CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,WAAW,EAAE,CAAC;YAC3B,cAAc,EAAE,CAAC;YACjB,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,wBAAwB,CAAC,CAAC,CAAC;IAE/B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,iBAAiB,CACxB,GAA4H,EAC5H,mBAA8D;IAE9D,OAAO,CAAC,IAA+B,EAAyB,EAAE;QAChE,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvC,IAAI,KAAK,KAAK,SAAS,EAAE;YACvB,mBAAmB,CAAC,IAAI,CAAC,CAAC;YAC1B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;SAC3C;QACD,IAAI,KAAK,CAAC,YAAY,EAAE;YACtB,mBAAmB,CAAC,IAAI,CAAC,CAAC;SAC3B;QAED,OAAO,KAAK,CAAC,KAAK,CAAC;IACrB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { defer, distinct, mergeMap, Subject, takeUntil } from \"rxjs\";\n\nimport type { HierarchyNode, PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { MutableRefObject } from \"react\";\nimport type { TreeNodeCheckboxState } from \"./components/TreeNodeCheckbox\";\nimport type { BeEvent, IDisposable } from \"@itwin/core-bentley\";\n\n/**\n * Data structure that describes instance visibility status.\n * @internal\n */\nexport interface VisibilityStatus {\n state: \"visible\" | \"partial\" | \"hidden\";\n isDisabled?: boolean;\n tooltip?: string;\n}\n\n/** @internal */\nexport interface HierarchyVisibilityHandler extends IDisposable {\n readonly onVisibilityChange: BeEvent<() => void>;\n getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus> | VisibilityStatus;\n changeVisibility(node: HierarchyNode, on: boolean): Promise<void>;\n}\n\ninterface UseHierarchyVisibilityProps {\n visibilityHandlerFactory: () => HierarchyVisibilityHandler;\n}\n\ninterface UseHierarchyVisibilityResult {\n onCheckboxClicked: (node: PresentationHierarchyNode, checked: boolean) => void;\n getCheckboxState: (node: PresentationHierarchyNode) => TreeNodeCheckboxState;\n triggerRefresh: () => void;\n}\n\n/** @internal */\nexport function useHierarchyVisibility({ visibilityHandlerFactory }: UseHierarchyVisibilityProps): UseHierarchyVisibilityResult {\n const nodesStateMap = useRef(new Map<string, { node: PresentationHierarchyNode; state: TreeNodeCheckboxState; needsRefresh: boolean }>());\n const [state, setState] = useState<UseHierarchyVisibilityResult>({\n getCheckboxState: () => ({ state: \"off\", isDisabled: true }),\n onCheckboxClicked: () => {},\n triggerRefresh: () => {},\n });\n\n useEffect(() => {\n nodesStateMap.current.clear();\n const handler = visibilityHandlerFactory();\n\n const visibilityChanged = new Subject<void>();\n const calculate = new Subject<PresentationHierarchyNode>();\n const calculateNodeStatus = (node: PresentationHierarchyNode) => {\n calculate.next(node);\n };\n\n const resetCache = () => {\n nodesStateMap.current.forEach((value) => {\n value.needsRefresh = true;\n });\n visibilityChanged.next();\n };\n\n const triggerCheckboxUpdate = () => {\n setState((prev) => ({\n ...prev,\n getCheckboxState: createStateGetter(nodesStateMap, calculateNodeStatus),\n }));\n };\n\n const subscription = calculate\n .pipe(\n distinct(undefined, visibilityChanged),\n mergeMap((node) => defer(async () => ({ node, status: await handler.getVisibilityStatus(node.nodeData) })).pipe(takeUntil(visibilityChanged))),\n )\n .subscribe({\n next: ({ node, status }) => {\n nodesStateMap.current.set(node.id, {\n node,\n state: {\n state: status.state === \"visible\" ? \"on\" : status.state === \"partial\" ? \"partial\" : \"off\",\n tooltip: status.tooltip,\n isDisabled: status.isDisabled,\n },\n needsRefresh: false,\n });\n triggerCheckboxUpdate();\n },\n });\n\n const changeVisibility = (node: PresentationHierarchyNode, checked: boolean) => {\n void handler.changeVisibility(node.nodeData, checked);\n const entry = nodesStateMap.current.get(node.id);\n if (!entry) {\n return;\n }\n entry.state.state = checked ? \"on\" : \"off\";\n entry.state.tooltip = undefined;\n triggerCheckboxUpdate();\n };\n\n setState({\n onCheckboxClicked: changeVisibility,\n getCheckboxState: createStateGetter(nodesStateMap, calculateNodeStatus),\n triggerRefresh: () => {\n resetCache();\n triggerCheckboxUpdate();\n },\n });\n\n const removeListener = handler.onVisibilityChange.addListener(() => {\n resetCache();\n triggerCheckboxUpdate();\n });\n\n return () => {\n subscription.unsubscribe();\n removeListener();\n handler.dispose();\n };\n }, [visibilityHandlerFactory]);\n\n return state;\n}\n\nfunction createStateGetter(\n map: MutableRefObject<Map<string, { node: PresentationHierarchyNode; state: TreeNodeCheckboxState; needsRefresh: boolean }>>,\n calculateVisibility: (node: PresentationHierarchyNode) => void,\n) {\n return (node: PresentationHierarchyNode): TreeNodeCheckboxState => {\n const entry = map.current.get(node.id);\n if (entry === undefined) {\n calculateVisibility(node);\n return { state: \"off\", isDisabled: true };\n }\n if (entry.needsRefresh) {\n calculateVisibility(node);\n }\n\n return entry.state;\n };\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IModelConnection } from "@itwin/core-frontend";
|
|
2
|
+
interface UseIModelChangeListenerProps {
|
|
3
|
+
imodel: IModelConnection;
|
|
4
|
+
action: () => void;
|
|
5
|
+
}
|
|
6
|
+
/** @internal */
|
|
7
|
+
export declare function useIModelChangeListener({ imodel, action }: UseIModelChangeListenerProps): void;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=UseIModelChangeListener.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { useEffect } from "react";
|
|
6
|
+
import { registerTxnListeners } from "@itwin/presentation-core-interop";
|
|
7
|
+
/** @internal */
|
|
8
|
+
export function useIModelChangeListener({ imodel, action }) {
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!imodel.isBriefcaseConnection()) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
registerTxnListeners(imodel.txns, action);
|
|
14
|
+
}, [imodel, action]);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=UseIModelChangeListener.js.map
|