@itwin/tree-widget-react 2.3.0 → 3.0.0-dev.0
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 +10 -2
- package/lib/cjs/TreeWidget.d.ts +2 -3
- package/lib/cjs/TreeWidget.js.map +1 -1
- package/lib/cjs/components/tree-header/TreeHeader.js +11 -3
- package/lib/cjs/components/tree-header/TreeHeader.js.map +1 -1
- package/lib/cjs/components/trees/CategoriesVisibilityUtils.d.ts +1 -1
- package/lib/cjs/components/trees/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/cjs/components/trees/category-tree/CategoriesTree.d.ts +1 -1
- package/lib/cjs/components/trees/category-tree/CategoriesTree.js.map +1 -1
- package/lib/cjs/components/trees/category-tree/CategoriesTreeButtons.d.ts +28 -0
- package/lib/cjs/components/trees/category-tree/CategoriesTreeButtons.js +38 -0
- package/lib/cjs/components/trees/category-tree/CategoriesTreeButtons.js.map +1 -0
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.d.ts +2 -17
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.js +7 -26
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.d.ts +1 -8
- package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.js.map +1 -1
- package/lib/cjs/components/trees/index.d.ts +3 -0
- package/lib/cjs/components/trees/index.js +1 -0
- package/lib/cjs/components/trees/index.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTree.js +2 -3
- package/lib/cjs/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.d.ts +33 -0
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js +86 -0
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js.map +1 -0
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.d.ts +2 -24
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js +24 -76
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsVisibilityHandler.d.ts +1 -0
- package/lib/cjs/components/trees/models-tree/ModelsVisibilityHandler.js +13 -3
- package/lib/cjs/components/trees/models-tree/ModelsVisibilityHandler.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/Utils.d.ts +2 -2
- package/lib/cjs/components/trees/models-tree/Utils.js.map +1 -1
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTree.d.ts +20 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTree.js +61 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTree.js.map +1 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeComponent.d.ts +16 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeComponent.js +43 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeComponent.js.map +1 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeDefinition.d.ts +23 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeDefinition.js +180 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeDefinition.js.map +1 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesVisibilityHandler.d.ts +36 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesVisibilityHandler.js +94 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesVisibilityHandler.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/FocusedInstancesContext.d.ts +13 -0
- package/lib/cjs/components/trees/stateless/common/FocusedInstancesContext.js +16 -0
- package/lib/cjs/components/trees/stateless/common/FocusedInstancesContext.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/FocusedInstancesContextProvider.d.ts +8 -0
- package/lib/cjs/components/trees/stateless/common/FocusedInstancesContextProvider.js +47 -0
- package/lib/cjs/components/trees/stateless/common/FocusedInstancesContextProvider.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchiesLocalization.d.ts +8 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchiesLocalization.js +33 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchiesLocalization.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchyFiltering.d.ts +16 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchyFiltering.js +139 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchyFiltering.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchyVisibility.d.ts +21 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchyVisibility.js +82 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchyVisibility.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/UseMultiCheckboxHandler.d.ts +13 -0
- package/lib/cjs/components/trees/stateless/common/UseMultiCheckboxHandler.js +34 -0
- package/lib/cjs/components/trees/stateless/common/UseMultiCheckboxHandler.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/Utils.d.ts +3 -0
- package/lib/cjs/components/trees/stateless/common/Utils.js +23 -0
- package/lib/cjs/components/trees/stateless/common/Utils.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/components/Delayed.d.ts +6 -0
- package/lib/cjs/components/trees/stateless/common/components/Delayed.js +31 -0
- package/lib/cjs/components/trees/stateless/common/components/Delayed.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/components/FilterableTree.d.ts +23 -0
- package/lib/cjs/components/trees/stateless/common/components/FilterableTree.js +66 -0
- package/lib/cjs/components/trees/stateless/common/components/FilterableTree.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/components/ProgressOverlay.d.ts +5 -0
- package/lib/cjs/components/trees/stateless/common/components/ProgressOverlay.js +16 -0
- package/lib/cjs/components/trees/stateless/common/components/ProgressOverlay.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/components/ProgressOverlay.scss +21 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTree.d.ts +26 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTree.js +68 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTree.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.d.ts +12 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.js +24 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.d.ts +10 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.js +20 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeRenderer.d.ts +16 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeRenderer.js +23 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeRenderer.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeRenderer.scss +41 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTree.d.ts +13 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTree.js +40 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTree.js.map +1 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.d.ts +14 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.js +25 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +20 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeDefinition.js +244 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeDefinition.js.map +1 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTree.d.ts +13 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTree.js +48 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTree.js.map +1 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.d.ts +14 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.js +25 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.js.map +1 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeDefinition.d.ts +25 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeDefinition.js +639 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -0
- package/lib/cjs/components/trees/stateless/index.d.ts +5 -0
- package/lib/cjs/components/trees/stateless/index.js +16 -0
- package/lib/cjs/components/trees/stateless/index.js.map +1 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTree.d.ts +16 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTree.js +77 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTree.js.map +1 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeComponent.d.ts +17 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeComponent.js +55 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeComponent.js.map +1 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeDefinition.d.ts +35 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeDefinition.js +856 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeDefinition.js.map +1 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsVisibilityHandler.d.ts +48 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsVisibilityHandler.js +470 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsVisibilityHandler.js.map +1 -0
- package/lib/esm/TreeWidget.d.ts +2 -3
- package/lib/esm/TreeWidget.js.map +1 -1
- package/lib/esm/components/tree-header/TreeHeader.js +11 -3
- package/lib/esm/components/tree-header/TreeHeader.js.map +1 -1
- package/lib/esm/components/trees/CategoriesVisibilityUtils.d.ts +1 -1
- package/lib/esm/components/trees/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/esm/components/trees/category-tree/CategoriesTree.d.ts +1 -1
- package/lib/esm/components/trees/category-tree/CategoriesTree.js.map +1 -1
- package/lib/esm/components/trees/category-tree/CategoriesTreeButtons.d.ts +28 -0
- package/lib/esm/components/trees/category-tree/CategoriesTreeButtons.js +32 -0
- package/lib/esm/components/trees/category-tree/CategoriesTreeButtons.js.map +1 -0
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.d.ts +2 -17
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.js +2 -21
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.d.ts +1 -8
- package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.js.map +1 -1
- package/lib/esm/components/trees/index.d.ts +3 -0
- package/lib/esm/components/trees/index.js +1 -0
- package/lib/esm/components/trees/index.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTree.js +2 -3
- package/lib/esm/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.d.ts +33 -0
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js +77 -0
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js.map +1 -0
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.d.ts +2 -24
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js +20 -72
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsVisibilityHandler.d.ts +1 -0
- package/lib/esm/components/trees/models-tree/ModelsVisibilityHandler.js +13 -3
- package/lib/esm/components/trees/models-tree/ModelsVisibilityHandler.js.map +1 -1
- package/lib/esm/components/trees/models-tree/Utils.d.ts +2 -2
- package/lib/esm/components/trees/models-tree/Utils.js.map +1 -1
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTree.d.ts +20 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTree.js +57 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTree.js.map +1 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeComponent.d.ts +16 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeComponent.js +39 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeComponent.js.map +1 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeDefinition.d.ts +23 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeDefinition.js +176 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeDefinition.js.map +1 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesVisibilityHandler.d.ts +36 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesVisibilityHandler.js +90 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesVisibilityHandler.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/FocusedInstancesContext.d.ts +13 -0
- package/lib/esm/components/trees/stateless/common/FocusedInstancesContext.js +12 -0
- package/lib/esm/components/trees/stateless/common/FocusedInstancesContext.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/FocusedInstancesContextProvider.d.ts +8 -0
- package/lib/esm/components/trees/stateless/common/FocusedInstancesContextProvider.js +43 -0
- package/lib/esm/components/trees/stateless/common/FocusedInstancesContextProvider.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchiesLocalization.d.ts +8 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchiesLocalization.js +29 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchiesLocalization.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchyFiltering.d.ts +16 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchyFiltering.js +135 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchyFiltering.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchyVisibility.d.ts +21 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchyVisibility.js +78 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchyVisibility.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/UseMultiCheckboxHandler.d.ts +13 -0
- package/lib/esm/components/trees/stateless/common/UseMultiCheckboxHandler.js +30 -0
- package/lib/esm/components/trees/stateless/common/UseMultiCheckboxHandler.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/Utils.d.ts +3 -0
- package/lib/esm/components/trees/stateless/common/Utils.js +19 -0
- package/lib/esm/components/trees/stateless/common/Utils.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/components/Delayed.d.ts +6 -0
- package/lib/esm/components/trees/stateless/common/components/Delayed.js +27 -0
- package/lib/esm/components/trees/stateless/common/components/Delayed.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/components/FilterableTree.d.ts +23 -0
- package/lib/esm/components/trees/stateless/common/components/FilterableTree.js +62 -0
- package/lib/esm/components/trees/stateless/common/components/FilterableTree.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/components/ProgressOverlay.d.ts +5 -0
- package/lib/esm/components/trees/stateless/common/components/ProgressOverlay.js +12 -0
- package/lib/esm/components/trees/stateless/common/components/ProgressOverlay.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/components/ProgressOverlay.scss +21 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTree.d.ts +26 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTree.js +64 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTree.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.d.ts +12 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.js +20 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.d.ts +10 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.js +13 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeRenderer.d.ts +16 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeRenderer.js +19 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeRenderer.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeRenderer.scss +41 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTree.d.ts +13 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTree.js +36 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTree.js.map +1 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.d.ts +14 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.js +21 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +20 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeDefinition.js +240 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeDefinition.js.map +1 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTree.d.ts +13 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTree.js +44 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTree.js.map +1 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.d.ts +14 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.js +21 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.js.map +1 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeDefinition.d.ts +25 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeDefinition.js +635 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -0
- package/lib/esm/components/trees/stateless/index.d.ts +5 -0
- package/lib/esm/components/trees/stateless/index.js +9 -0
- package/lib/esm/components/trees/stateless/index.js.map +1 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTree.d.ts +16 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTree.js +73 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTree.js.map +1 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeComponent.d.ts +17 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeComponent.js +51 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeComponent.js.map +1 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeDefinition.d.ts +35 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeDefinition.js +852 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeDefinition.js.map +1 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsVisibilityHandler.d.ts +48 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsVisibilityHandler.js +466 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsVisibilityHandler.js.map +1 -0
- package/lib/public/locales/en/TreeWidget.json +21 -0
- package/package.json +7 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoriesTreeComponent.js","sourceRoot":"","sources":["../../../../../../src/components/trees/stateless/categories-tree/CategoriesTreeComponent.tsx"],"names":[],"mappings":";A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,CACL,cAAK,SAAS,EAAC,8BAA8B,YAC3C,MAAC,wBAAwB,IAAC,OAAO,EAAE,gBAAgB,aACjD,KAAC,UAAU,IAAC,aAAa,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,iBAAiB,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,OAAO,EAAE,OAAO,YAC9I,aAAa;wBACZ,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,KAAC,QAAQ,cAAc,GAAG,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,IAArC,KAAK,CAA4C,CAAC;wBACrG,CAAC,CAAC;4BACE,KAAC,aAAa,IAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAqB,OAAO,EAAE,OAAO,IAA/B,cAAc,CAAqB;4BAClG,KAAC,aAAa,IAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAqB,OAAO,EAAE,OAAO,IAA/B,cAAc,CAAqB;4BAClG,KAAC,eAAe,IAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAuB,OAAO,EAAE,OAAO,IAAjC,gBAAgB,CAAqB;yBACvG,GACM,EACb,KAAC,SAAS,cACP,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CACtB,KAAC,uBAAuB,OAClB,SAAS,EACb,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,QAAQ,EACpB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACd,CACH,GACS,IACa,GACvB,CACP,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 { Fragment, useState } from \"react\";\nimport { useActiveIModelConnection, useActiveViewport } from \"@itwin/appui-react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { UnifiedSelectionProvider } from \"@itwin/presentation-hierarchies-react\";\nimport { TreeHeader } from \"../../../tree-header/TreeHeader\";\nimport { AutoSizer } from \"../../../utils/AutoSizer\";\nimport { HideAllButton, InvertAllButton, ShowAllButton } from \"../../category-tree/CategoriesTreeButtons\";\nimport { useCategories } from \"../../category-tree/CategoryVisibilityHandler\";\nimport { StatelessCategoriesTree } from \"./CategoriesTree\";\n\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { IModelConnection, ScreenViewport } from \"@itwin/core-frontend\";\nimport type { SelectionStorage } from \"@itwin/presentation-hierarchies-react\";\nimport type { CategoriesTreeHeaderButtonProps } from \"../../category-tree/CategoriesTreeButtons\";\n\ntype StatelessCategoriesTreeProps = ComponentPropsWithoutRef<typeof StatelessCategoriesTree>;\n\ninterface StatelessCategoriesTreeComponentProps\n extends Pick<StatelessCategoriesTreeProps, \"getSchemaContext\" | \"density\" | \"hierarchyLevelConfig\" | \"selectionMode\" | \"onPerformanceMeasured\"> {\n headerButtons?: Array<(props: CategoriesTreeHeaderButtonProps) => React.ReactNode>;\n selectionStorage: SelectionStorage;\n}\n\n/**\n * A component that renders [[StatelessCategoriesTree]] and a header with filtering capabilities and header buttons.\n * @beta\n */\nexport const StatelessCategoriesTreeComponent = (props: StatelessCategoriesTreeComponentProps) => {\n const iModel = useActiveIModelConnection();\n const viewport = useActiveViewport();\n\n if (!iModel || !viewport) {\n return null;\n }\n\n return <CategoriesTreeComponentImpl {...props} iModel={iModel} viewport={viewport} />;\n};\n\nfunction CategoriesTreeComponentImpl({\n iModel,\n viewport,\n headerButtons,\n selectionStorage,\n ...treeProps\n}: StatelessCategoriesTreeComponentProps & { iModel: IModelConnection; viewport: ScreenViewport }) {\n const categories = useCategories(IModelApp.viewManager, iModel, viewport);\n const [filter, setFilter] = useState(\"\");\n const density = treeProps.density;\n\n return (\n <div className=\"tree-widget-tree-with-header\">\n <UnifiedSelectionProvider storage={selectionStorage}>\n <TreeHeader onFilterClear={() => setFilter(\"\")} onFilterStart={(newFilter) => setFilter(newFilter)} onSelectedChanged={() => {}} density={density}>\n {headerButtons\n ? headerButtons.map((btn, index) => <Fragment key={index}>{btn({ viewport, categories })}</Fragment>)\n : [\n <ShowAllButton viewport={viewport} categories={categories} key=\"show-all-btn\" density={density} />,\n <HideAllButton viewport={viewport} categories={categories} key=\"hide-all-btn\" density={density} />,\n <InvertAllButton viewport={viewport} categories={categories} key=\"invert-all-btn\" density={density} />,\n ]}\n </TreeHeader>\n <AutoSizer>\n {({ width, height }) => (\n <StatelessCategoriesTree\n {...treeProps}\n imodel={iModel}\n categories={categories}\n activeView={viewport}\n width={width}\n height={height}\n filter={filter}\n />\n )}\n </AutoSizer>\n </UnifiedSelectionProvider>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ECClassHierarchyInspector, ECSchemaProvider } from "@itwin/presentation-shared";
|
|
2
|
+
import type { DefineHierarchyLevelProps, HierarchyDefinition, HierarchyLevelDefinition, HierarchyNodeIdentifiersPath, LimitingECSqlQueryExecutor } from "@itwin/presentation-hierarchies";
|
|
3
|
+
interface CategoriesTreeDefinitionProps {
|
|
4
|
+
imodelAccess: ECSchemaProvider & ECClassHierarchyInspector;
|
|
5
|
+
viewType: "2d" | "3d";
|
|
6
|
+
}
|
|
7
|
+
interface CategoriesTreeInstanceKeyPathsFromInstanceLabelProps {
|
|
8
|
+
imodelAccess: ECClassHierarchyInspector & LimitingECSqlQueryExecutor;
|
|
9
|
+
label: string;
|
|
10
|
+
viewType: "2d" | "3d";
|
|
11
|
+
}
|
|
12
|
+
export declare class CategoriesTreeDefinition implements HierarchyDefinition {
|
|
13
|
+
private _impl;
|
|
14
|
+
private _selectQueryFactory;
|
|
15
|
+
private _nodeLabelSelectClauseFactory;
|
|
16
|
+
constructor(props: CategoriesTreeDefinitionProps);
|
|
17
|
+
defineHierarchyLevel(props: DefineHierarchyLevelProps): Promise<HierarchyLevelDefinition>;
|
|
18
|
+
private createRootHierarchyLevelDefinition;
|
|
19
|
+
private createSubcategoryQuery;
|
|
20
|
+
static createInstanceKeyPaths(props: CategoriesTreeInstanceKeyPathsFromInstanceLabelProps): Promise<HierarchyNodeIdentifiersPath[]>;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=CategoriesTreeDefinition.d.ts.map
|
|
@@ -0,0 +1,176 @@
|
|
|
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 { createClassBasedHierarchyDefinition, createNodesQueryClauseFactory } from "@itwin/presentation-hierarchies";
|
|
6
|
+
import { createBisInstanceLabelSelectClauseFactory, ECSql } from "@itwin/presentation-shared";
|
|
7
|
+
export class CategoriesTreeDefinition {
|
|
8
|
+
constructor(props) {
|
|
9
|
+
this._impl = createClassBasedHierarchyDefinition({
|
|
10
|
+
classHierarchyInspector: props.imodelAccess,
|
|
11
|
+
hierarchy: {
|
|
12
|
+
rootNodes: async (requestProps) => this.createRootHierarchyLevelDefinition({ ...requestProps, viewType: props.viewType }),
|
|
13
|
+
childNodes: [
|
|
14
|
+
{
|
|
15
|
+
parentNodeClassName: "BisCore.Category",
|
|
16
|
+
definitions: async (requestProps) => this.createSubcategoryQuery(requestProps),
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
this._selectQueryFactory = createNodesQueryClauseFactory({ imodelAccess: props.imodelAccess });
|
|
22
|
+
this._nodeLabelSelectClauseFactory = createBisInstanceLabelSelectClauseFactory({ classHierarchyInspector: props.imodelAccess });
|
|
23
|
+
}
|
|
24
|
+
async defineHierarchyLevel(props) {
|
|
25
|
+
return this._impl.defineHierarchyLevel(props);
|
|
26
|
+
}
|
|
27
|
+
async createRootHierarchyLevelDefinition(props) {
|
|
28
|
+
const { categoryClass, categoryElementClass } = getClassesByView(props.viewType);
|
|
29
|
+
const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({
|
|
30
|
+
filter: props.instanceFilter,
|
|
31
|
+
contentClass: { fullName: categoryClass, alias: "this" },
|
|
32
|
+
});
|
|
33
|
+
return [
|
|
34
|
+
{
|
|
35
|
+
fullClassName: categoryClass,
|
|
36
|
+
query: {
|
|
37
|
+
ecsql: `
|
|
38
|
+
SELECT
|
|
39
|
+
${await this._selectQueryFactory.createSelectClause({
|
|
40
|
+
ecClassId: { selector: ECSql.createRawPropertyValueSelector("this", "ECClassId") },
|
|
41
|
+
ecInstanceId: { selector: "this.ECInstanceId" },
|
|
42
|
+
nodeLabel: {
|
|
43
|
+
selector: await this._nodeLabelSelectClauseFactory.createSelectClause({
|
|
44
|
+
classAlias: "this",
|
|
45
|
+
className: categoryClass,
|
|
46
|
+
}),
|
|
47
|
+
},
|
|
48
|
+
hasChildren: {
|
|
49
|
+
selector: `
|
|
50
|
+
IFNULL((
|
|
51
|
+
SELECT 1
|
|
52
|
+
FROM (
|
|
53
|
+
SELECT COUNT(1) AS ChildCount
|
|
54
|
+
FROM BisCore.SubCategory sc
|
|
55
|
+
WHERE sc.Parent.Id = this.ECInstanceId
|
|
56
|
+
)
|
|
57
|
+
WHERE ChildCount > 1
|
|
58
|
+
), 0)
|
|
59
|
+
`,
|
|
60
|
+
},
|
|
61
|
+
extendedData: {
|
|
62
|
+
description: { selector: "this.Description" },
|
|
63
|
+
},
|
|
64
|
+
supportsFiltering: true,
|
|
65
|
+
})}
|
|
66
|
+
FROM ${instanceFilterClauses.from} this
|
|
67
|
+
${instanceFilterClauses.joins}
|
|
68
|
+
JOIN BisCore.Model m ON m.ECInstanceId = this.Model.Id
|
|
69
|
+
WHERE
|
|
70
|
+
NOT this.IsPrivate
|
|
71
|
+
AND (NOT m.IsPrivate OR m.ECClassId IS (BisCore.DictionaryModel))
|
|
72
|
+
AND EXISTS (SELECT 1 FROM ${categoryElementClass} e WHERE e.Category.Id = this.ECInstanceId)
|
|
73
|
+
${instanceFilterClauses.where ? `AND ${instanceFilterClauses.where}` : ""}
|
|
74
|
+
`,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
async createSubcategoryQuery({ parentNodeInstanceIds: elementIds, instanceFilter, }) {
|
|
80
|
+
const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({
|
|
81
|
+
filter: instanceFilter,
|
|
82
|
+
contentClass: { fullName: "BisCore.SubCategory", alias: "this" },
|
|
83
|
+
});
|
|
84
|
+
return [
|
|
85
|
+
{
|
|
86
|
+
fullClassName: "BisCore.SubCategory",
|
|
87
|
+
query: {
|
|
88
|
+
ecsql: `
|
|
89
|
+
SELECT
|
|
90
|
+
${await this._selectQueryFactory.createSelectClause({
|
|
91
|
+
ecClassId: { selector: "this.ECClassId" },
|
|
92
|
+
ecInstanceId: { selector: "this.ECInstanceId" },
|
|
93
|
+
nodeLabel: {
|
|
94
|
+
selector: await this._nodeLabelSelectClauseFactory.createSelectClause({
|
|
95
|
+
classAlias: "this",
|
|
96
|
+
className: "BisCore.SubCategory",
|
|
97
|
+
}),
|
|
98
|
+
},
|
|
99
|
+
extendedData: {
|
|
100
|
+
categoryId: { selector: "printf('0x%x', this.Parent.Id)" },
|
|
101
|
+
},
|
|
102
|
+
supportsFiltering: false,
|
|
103
|
+
})}
|
|
104
|
+
FROM ${instanceFilterClauses.from} this
|
|
105
|
+
${instanceFilterClauses.joins}
|
|
106
|
+
WHERE
|
|
107
|
+
NOT this.IsPrivate AND this.Parent.Id IN (${elementIds.map(() => "?").join(",")})
|
|
108
|
+
${instanceFilterClauses.where ? `AND ${instanceFilterClauses.where}` : ""}
|
|
109
|
+
`,
|
|
110
|
+
bindings: elementIds.map((id) => ({ type: "id", value: id })),
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
}
|
|
115
|
+
static async createInstanceKeyPaths(props) {
|
|
116
|
+
const labelsFactory = createBisInstanceLabelSelectClauseFactory({ classHierarchyInspector: props.imodelAccess });
|
|
117
|
+
return createInstanceKeyPathsFromInstanceLabel({ ...props, labelsFactory });
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function getClassesByView(viewType) {
|
|
121
|
+
return viewType === "2d"
|
|
122
|
+
? { categoryClass: "BisCore.DrawingCategory", categoryElementClass: "BisCore:GeometricElement2d" }
|
|
123
|
+
: { categoryClass: "BisCore.SpatialCategory", categoryElementClass: "BisCore:GeometricElement3d" };
|
|
124
|
+
}
|
|
125
|
+
async function createInstanceKeyPathsFromInstanceLabel(props) {
|
|
126
|
+
const { categoryClass, categoryElementClass } = getClassesByView(props.viewType);
|
|
127
|
+
const reader = props.imodelAccess.createQueryReader({
|
|
128
|
+
ctes: [
|
|
129
|
+
`RootCategories(ClassName, ECInstanceId, ChildCount) as (
|
|
130
|
+
SELECT
|
|
131
|
+
ec_classname(this.ECClassId, 's.c'),
|
|
132
|
+
this.ECInstanceId,
|
|
133
|
+
COUNT(sc.ECInstanceId)
|
|
134
|
+
FROM ${categoryClass} this
|
|
135
|
+
JOIN BisCore.Model m ON m.ECInstanceId = this.Model.Id
|
|
136
|
+
JOIN BisCore.SubCategory sc ON sc.Parent.Id = this.ECInstanceId
|
|
137
|
+
WHERE
|
|
138
|
+
NOT this.IsPrivate
|
|
139
|
+
AND (NOT m.IsPrivate OR m.ECClassId IS (BisCore.DictionaryModel))
|
|
140
|
+
AND EXISTS (SELECT 1 FROM ${categoryElementClass} e WHERE e.Category.Id = this.ECInstanceId)
|
|
141
|
+
GROUP BY this.ECInstanceId
|
|
142
|
+
)`,
|
|
143
|
+
`SubCategoriesWithLabels(ClassName, ECInstanceId, ParentId, DisplayLabel) as (
|
|
144
|
+
SELECT
|
|
145
|
+
ec_classname(this.ECClassId, 's.c'),
|
|
146
|
+
this.ECInstanceId,
|
|
147
|
+
this.Parent.Id,
|
|
148
|
+
${await props.labelsFactory.createSelectClause({
|
|
149
|
+
classAlias: "this",
|
|
150
|
+
className: "BisCore.SubCategory",
|
|
151
|
+
})}
|
|
152
|
+
FROM BisCore.SubCategory this
|
|
153
|
+
WHERE NOT this.IsPrivate
|
|
154
|
+
)`,
|
|
155
|
+
],
|
|
156
|
+
ecsql: `
|
|
157
|
+
SELECT
|
|
158
|
+
c.ClassName AS CategoryClass,
|
|
159
|
+
c.ECInstanceId AS CategoryId,
|
|
160
|
+
IIF(c.ChildCount > 1, sc.ClassName, NULL) AS SubcategoryClass,
|
|
161
|
+
IIF(c.ChildCount > 1, sc.ECInstanceId, NULL) AS SubcategoryId
|
|
162
|
+
FROM RootCategories c
|
|
163
|
+
JOIN SubCategoriesWithLabels sc ON sc.ParentId = c.ECInstanceId
|
|
164
|
+
WHERE sc.DisplayLabel LIKE '%' || ? || '%'
|
|
165
|
+
`,
|
|
166
|
+
bindings: [{ type: "string", value: props.label }],
|
|
167
|
+
}, { restartToken: "tree-widget/categories-tree/filter-by-label-query" });
|
|
168
|
+
const paths = new Array();
|
|
169
|
+
for await (const row of reader) {
|
|
170
|
+
const path = [{ className: row.CategoryClass, id: row.CategoryId }];
|
|
171
|
+
row.SubcategoryId && path.push({ className: row.SubcategoryClass, id: row.SubcategoryId });
|
|
172
|
+
paths.push(path);
|
|
173
|
+
}
|
|
174
|
+
return paths;
|
|
175
|
+
}
|
|
176
|
+
//# sourceMappingURL=CategoriesTreeDefinition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoriesTreeDefinition.js","sourceRoot":"","sources":["../../../../../../src/components/trees/stateless/categories-tree/CategoriesTreeDefinition.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAE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EAAE,yBAAyB,EAAE,oBAAoB,EAAE,4BAA4B,EAAE;QAClG,CAAC,CAAC,EAAE,aAAa,EAAE,yBAAyB,EAAE,oBAAoB,EAAE,4BAA4B,EAAE,CAAC;AACvG,CAAC;AAED,KAAK,UAAU,uCAAuC,CACpD,KAAkH;IAElH,MAAM,EAAE,aAAa,EAAE,oBAAoB,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACjF,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,iBAAiB,CACjD;QACE,IAAI,EAAE;YACJ;;;;;iBAKS,aAAa;;;;;;wCAMU,oBAAoB;;UAElD;YACF;;;;;cAKM,MAAM,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC;gBAC7C,UAAU,EAAE,MAAM;gBAClB,SAAS,EAAE,qBAAqB;aACjC,CAAC;;;UAGJ;SACH;QACD,KAAK,EAAE;;;;;;;;;OASN;QACD,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;KACnD,EACD,EAAE,YAAY,EAAE,mDAAmD,EAAE,CACtE,CAAC;IACF,MAAM,KAAK,GAAG,IAAI,KAAK,EAAgC,CAAC;IACxD,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,MAAM,EAAE;QAC9B,MAAM,IAAI,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,aAAa,EAAE,EAAE,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;QACpE,GAAG,CAAC,aAAa,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,gBAAgB,EAAE,EAAE,EAAE,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC;QAC3F,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAClB;IACD,OAAO,KAAK,CAAC;AACf,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 { createClassBasedHierarchyDefinition, createNodesQueryClauseFactory } from \"@itwin/presentation-hierarchies\";\nimport { createBisInstanceLabelSelectClauseFactory, ECSql } from \"@itwin/presentation-shared\";\n\nimport type { ECClassHierarchyInspector, ECSchemaProvider, IInstanceLabelSelectClauseFactory } from \"@itwin/presentation-shared\";\nimport type {\n DefineHierarchyLevelProps,\n DefineInstanceNodeChildHierarchyLevelProps,\n DefineRootHierarchyLevelProps,\n HierarchyDefinition,\n HierarchyLevelDefinition,\n HierarchyNodeIdentifiersPath,\n LimitingECSqlQueryExecutor,\n NodesQueryClauseFactory,\n} from \"@itwin/presentation-hierarchies\";\n\ninterface CategoriesTreeDefinitionProps {\n imodelAccess: ECSchemaProvider & ECClassHierarchyInspector;\n viewType: \"2d\" | \"3d\";\n}\n\ninterface CategoriesTreeInstanceKeyPathsFromInstanceLabelProps {\n imodelAccess: ECClassHierarchyInspector & LimitingECSqlQueryExecutor;\n label: string;\n viewType: \"2d\" | \"3d\";\n}\n\nexport class CategoriesTreeDefinition implements HierarchyDefinition {\n private _impl: HierarchyDefinition;\n private _selectQueryFactory: NodesQueryClauseFactory;\n private _nodeLabelSelectClauseFactory: IInstanceLabelSelectClauseFactory;\n\n public constructor(props: CategoriesTreeDefinitionProps) {\n this._impl = createClassBasedHierarchyDefinition({\n classHierarchyInspector: props.imodelAccess,\n hierarchy: {\n rootNodes: async (requestProps) => this.createRootHierarchyLevelDefinition({ ...requestProps, viewType: props.viewType }),\n childNodes: [\n {\n parentNodeClassName: \"BisCore.Category\",\n definitions: async (requestProps: DefineInstanceNodeChildHierarchyLevelProps) => this.createSubcategoryQuery(requestProps),\n },\n ],\n },\n });\n this._selectQueryFactory = createNodesQueryClauseFactory({ imodelAccess: props.imodelAccess });\n this._nodeLabelSelectClauseFactory = createBisInstanceLabelSelectClauseFactory({ classHierarchyInspector: props.imodelAccess });\n }\n\n public async defineHierarchyLevel(props: DefineHierarchyLevelProps) {\n return this._impl.defineHierarchyLevel(props);\n }\n\n private async createRootHierarchyLevelDefinition(props: DefineRootHierarchyLevelProps & { viewType: \"2d\" | \"3d\" }): Promise<HierarchyLevelDefinition> {\n const { categoryClass, categoryElementClass } = getClassesByView(props.viewType);\n const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({\n filter: props.instanceFilter,\n contentClass: { fullName: categoryClass, alias: \"this\" },\n });\n return [\n {\n fullClassName: categoryClass,\n query: {\n ecsql: `\n SELECT\n ${await this._selectQueryFactory.createSelectClause({\n ecClassId: { selector: ECSql.createRawPropertyValueSelector(\"this\", \"ECClassId\") },\n ecInstanceId: { selector: \"this.ECInstanceId\" },\n nodeLabel: {\n selector: await this._nodeLabelSelectClauseFactory.createSelectClause({\n classAlias: \"this\",\n className: categoryClass,\n }),\n },\n hasChildren: {\n selector: `\n IFNULL((\n SELECT 1\n FROM (\n SELECT COUNT(1) AS ChildCount\n FROM BisCore.SubCategory sc\n WHERE sc.Parent.Id = this.ECInstanceId\n )\n WHERE ChildCount > 1\n ), 0)\n `,\n },\n extendedData: {\n description: { selector: \"this.Description\" },\n },\n supportsFiltering: true,\n })}\n FROM ${instanceFilterClauses.from} this\n ${instanceFilterClauses.joins}\n JOIN BisCore.Model m ON m.ECInstanceId = this.Model.Id\n WHERE\n NOT this.IsPrivate\n AND (NOT m.IsPrivate OR m.ECClassId IS (BisCore.DictionaryModel))\n AND EXISTS (SELECT 1 FROM ${categoryElementClass} e WHERE e.Category.Id = this.ECInstanceId)\n ${instanceFilterClauses.where ? `AND ${instanceFilterClauses.where}` : \"\"}\n `,\n },\n },\n ];\n }\n\n private async createSubcategoryQuery({\n parentNodeInstanceIds: elementIds,\n instanceFilter,\n }: DefineInstanceNodeChildHierarchyLevelProps): Promise<HierarchyLevelDefinition> {\n const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({\n filter: instanceFilter,\n contentClass: { fullName: \"BisCore.SubCategory\", alias: \"this\" },\n });\n return [\n {\n fullClassName: \"BisCore.SubCategory\",\n query: {\n ecsql: `\n SELECT\n ${await this._selectQueryFactory.createSelectClause({\n ecClassId: { selector: \"this.ECClassId\" },\n ecInstanceId: { selector: \"this.ECInstanceId\" },\n nodeLabel: {\n selector: await this._nodeLabelSelectClauseFactory.createSelectClause({\n classAlias: \"this\",\n className: \"BisCore.SubCategory\",\n }),\n },\n extendedData: {\n categoryId: { selector: \"printf('0x%x', this.Parent.Id)\" },\n },\n supportsFiltering: false,\n })}\n FROM ${instanceFilterClauses.from} this\n ${instanceFilterClauses.joins}\n WHERE\n NOT this.IsPrivate AND this.Parent.Id IN (${elementIds.map(() => \"?\").join(\",\")})\n ${instanceFilterClauses.where ? `AND ${instanceFilterClauses.where}` : \"\"}\n `,\n bindings: elementIds.map((id) => ({ type: \"id\", value: id })),\n },\n },\n ];\n }\n\n public static async createInstanceKeyPaths(props: CategoriesTreeInstanceKeyPathsFromInstanceLabelProps) {\n const labelsFactory = createBisInstanceLabelSelectClauseFactory({ classHierarchyInspector: props.imodelAccess });\n return createInstanceKeyPathsFromInstanceLabel({ ...props, labelsFactory });\n }\n}\n\nfunction getClassesByView(viewType: \"2d\" | \"3d\") {\n return viewType === \"2d\"\n ? { categoryClass: \"BisCore.DrawingCategory\", categoryElementClass: \"BisCore:GeometricElement2d\" }\n : { categoryClass: \"BisCore.SpatialCategory\", categoryElementClass: \"BisCore:GeometricElement3d\" };\n}\n\nasync function createInstanceKeyPathsFromInstanceLabel(\n props: CategoriesTreeInstanceKeyPathsFromInstanceLabelProps & { labelsFactory: IInstanceLabelSelectClauseFactory },\n) {\n const { categoryClass, categoryElementClass } = getClassesByView(props.viewType);\n const reader = props.imodelAccess.createQueryReader(\n {\n ctes: [\n `RootCategories(ClassName, ECInstanceId, ChildCount) as (\n SELECT\n ec_classname(this.ECClassId, 's.c'),\n this.ECInstanceId,\n COUNT(sc.ECInstanceId)\n FROM ${categoryClass} this\n JOIN BisCore.Model m ON m.ECInstanceId = this.Model.Id\n JOIN BisCore.SubCategory sc ON sc.Parent.Id = this.ECInstanceId\n WHERE\n NOT this.IsPrivate\n AND (NOT m.IsPrivate OR m.ECClassId IS (BisCore.DictionaryModel))\n AND EXISTS (SELECT 1 FROM ${categoryElementClass} e WHERE e.Category.Id = this.ECInstanceId)\n GROUP BY this.ECInstanceId\n )`,\n `SubCategoriesWithLabels(ClassName, ECInstanceId, ParentId, DisplayLabel) as (\n SELECT\n ec_classname(this.ECClassId, 's.c'),\n this.ECInstanceId,\n this.Parent.Id,\n ${await props.labelsFactory.createSelectClause({\n classAlias: \"this\",\n className: \"BisCore.SubCategory\",\n })}\n FROM BisCore.SubCategory this\n WHERE NOT this.IsPrivate\n )`,\n ],\n ecsql: `\n SELECT\n c.ClassName AS CategoryClass,\n c.ECInstanceId AS CategoryId,\n IIF(c.ChildCount > 1, sc.ClassName, NULL) AS SubcategoryClass,\n IIF(c.ChildCount > 1, sc.ECInstanceId, NULL) AS SubcategoryId\n FROM RootCategories c\n JOIN SubCategoriesWithLabels sc ON sc.ParentId = c.ECInstanceId\n WHERE sc.DisplayLabel LIKE '%' || ? || '%'\n `,\n bindings: [{ type: \"string\", value: props.label }],\n },\n { restartToken: \"tree-widget/categories-tree/filter-by-label-query\" },\n );\n const paths = new Array<HierarchyNodeIdentifiersPath>();\n for await (const row of reader) {\n const path = [{ className: row.CategoryClass, id: row.CategoryId }];\n row.SubcategoryId && path.push({ className: row.SubcategoryClass, id: row.SubcategoryId });\n paths.push(path);\n }\n return paths;\n}\n"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { BeEvent } from "@itwin/core-bentley";
|
|
2
|
+
import { HierarchyNode } from "@itwin/presentation-hierarchies";
|
|
3
|
+
import type { CategoryInfo } from "../../category-tree/CategoriesTreeButtons";
|
|
4
|
+
import type { VisibilityChangeListener, VisibilityStatus } from "../../VisibilityTreeEventHandler";
|
|
5
|
+
import type { IModelConnection, ViewManager, Viewport } from "@itwin/core-frontend";
|
|
6
|
+
interface StatelessCategoriesVisibilityHandlerProps {
|
|
7
|
+
viewManager: ViewManager;
|
|
8
|
+
imodel: IModelConnection;
|
|
9
|
+
categories: CategoryInfo[];
|
|
10
|
+
viewport: Viewport;
|
|
11
|
+
allViewports?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare class StatelessCategoriesVisibilityHandler {
|
|
15
|
+
private _viewManager;
|
|
16
|
+
private _imodel;
|
|
17
|
+
private _pendingVisibilityChange;
|
|
18
|
+
private _viewport;
|
|
19
|
+
private _useAllViewports;
|
|
20
|
+
constructor(props: StatelessCategoriesVisibilityHandlerProps);
|
|
21
|
+
dispose(): void;
|
|
22
|
+
onVisibilityChange: BeEvent<VisibilityChangeListener>;
|
|
23
|
+
/** Returns visibility status of the tree node. */
|
|
24
|
+
getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus> | VisibilityStatus;
|
|
25
|
+
changeVisibility(node: HierarchyNode, on: boolean): Promise<void>;
|
|
26
|
+
getSubCategoryVisibility(node: HierarchyNode): "visible" | "hidden";
|
|
27
|
+
getCategoryVisibility(node: HierarchyNode): "visible" | "hidden";
|
|
28
|
+
private onDisplayStyleChanged;
|
|
29
|
+
private onViewedCategoriesChanged;
|
|
30
|
+
private onVisibilityChangeInternal;
|
|
31
|
+
static getInstanceIdFromHierarchyNode(node: HierarchyNode): string;
|
|
32
|
+
enableCategory(ids: string[], enabled: boolean, enableAllSubCategories?: boolean): Promise<void>;
|
|
33
|
+
enableSubCategory(key: string, enabled: boolean): void;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=CategoriesVisibilityHandler.d.ts.map
|
|
@@ -0,0 +1,90 @@
|
|
|
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 { BeEvent } from "@itwin/core-bentley";
|
|
6
|
+
import { HierarchyNode } from "@itwin/presentation-hierarchies";
|
|
7
|
+
import { enableCategory, enableSubCategory } from "../../CategoriesVisibilityUtils";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export class StatelessCategoriesVisibilityHandler {
|
|
10
|
+
constructor(props) {
|
|
11
|
+
this.onVisibilityChange = new BeEvent();
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
13
|
+
this.onDisplayStyleChanged = () => {
|
|
14
|
+
this.onVisibilityChangeInternal();
|
|
15
|
+
};
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
17
|
+
this.onViewedCategoriesChanged = () => {
|
|
18
|
+
this.onVisibilityChangeInternal();
|
|
19
|
+
};
|
|
20
|
+
this._viewManager = props.viewManager;
|
|
21
|
+
this._imodel = props.imodel;
|
|
22
|
+
this._viewport = props.viewport;
|
|
23
|
+
// istanbul ignore next
|
|
24
|
+
this._useAllViewports = props.allViewports ?? false;
|
|
25
|
+
this._viewport.onDisplayStyleChanged.addListener(this.onDisplayStyleChanged);
|
|
26
|
+
this._viewport.onViewedCategoriesChanged.addListener(this.onViewedCategoriesChanged);
|
|
27
|
+
}
|
|
28
|
+
dispose() {
|
|
29
|
+
this._viewport.onDisplayStyleChanged.removeListener(this.onDisplayStyleChanged);
|
|
30
|
+
this._viewport.onViewedCategoriesChanged.removeListener(this.onViewedCategoriesChanged);
|
|
31
|
+
clearTimeout(this._pendingVisibilityChange);
|
|
32
|
+
}
|
|
33
|
+
/** Returns visibility status of the tree node. */
|
|
34
|
+
getVisibilityStatus(node) {
|
|
35
|
+
if (!HierarchyNode.isInstancesNode(node)) {
|
|
36
|
+
return { state: "hidden", isDisabled: true };
|
|
37
|
+
}
|
|
38
|
+
return { state: node.parentKeys.length ? this.getSubCategoryVisibility(node) : this.getCategoryVisibility(node) };
|
|
39
|
+
}
|
|
40
|
+
async changeVisibility(node, on) {
|
|
41
|
+
if (!HierarchyNode.isInstancesNode(node)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// handle subcategory visibility change
|
|
45
|
+
if (node.parentKeys.length) {
|
|
46
|
+
const childId = StatelessCategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);
|
|
47
|
+
const parentCategoryId = node.extendedData?.categoryId;
|
|
48
|
+
// make sure parent category is enabled
|
|
49
|
+
if (on && parentCategoryId) {
|
|
50
|
+
await this.enableCategory([parentCategoryId], true, false);
|
|
51
|
+
}
|
|
52
|
+
this.enableSubCategory(childId, on);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const instanceId = StatelessCategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);
|
|
56
|
+
await this.enableCategory([instanceId], on, true);
|
|
57
|
+
}
|
|
58
|
+
getSubCategoryVisibility(node) {
|
|
59
|
+
const parentCategoryId = node.extendedData?.categoryId;
|
|
60
|
+
if (!parentCategoryId) {
|
|
61
|
+
return "hidden";
|
|
62
|
+
}
|
|
63
|
+
const subcategoryId = StatelessCategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);
|
|
64
|
+
const isVisible = this._viewport.view.viewsCategory(parentCategoryId) && this._viewport.isSubCategoryVisible(subcategoryId);
|
|
65
|
+
return isVisible ? "visible" : "hidden";
|
|
66
|
+
}
|
|
67
|
+
getCategoryVisibility(node) {
|
|
68
|
+
const instanceId = StatelessCategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);
|
|
69
|
+
return this._viewport.view.viewsCategory(instanceId) ? "visible" : "hidden";
|
|
70
|
+
}
|
|
71
|
+
onVisibilityChangeInternal() {
|
|
72
|
+
if (this._pendingVisibilityChange) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this._pendingVisibilityChange = setTimeout(() => {
|
|
76
|
+
this.onVisibilityChange.raiseEvent();
|
|
77
|
+
this._pendingVisibilityChange = undefined;
|
|
78
|
+
}, 0);
|
|
79
|
+
}
|
|
80
|
+
static getInstanceIdFromHierarchyNode(node) {
|
|
81
|
+
return HierarchyNode.isInstancesNode(node) && node.key.instanceKeys.length > 0 ? node.key.instanceKeys[0].id : /* istanbul ignore next */ "";
|
|
82
|
+
}
|
|
83
|
+
async enableCategory(ids, enabled, enableAllSubCategories = true) {
|
|
84
|
+
await enableCategory(this._viewManager, this._imodel, ids, enabled, this._useAllViewports, enableAllSubCategories);
|
|
85
|
+
}
|
|
86
|
+
enableSubCategory(key, enabled) {
|
|
87
|
+
enableSubCategory(this._viewManager, key, enabled, this._useAllViewports);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=CategoriesVisibilityHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoriesVisibilityHandler.js","sourceRoot":"","sources":["../../../../../../src/components/trees/stateless/categories-tree/CategoriesVisibilityHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAcpF,gBAAgB;AAChB,MAAM,OAAO,oCAAoC;IAO/C,YAAY,KAAgD;QAgBrD,uBAAkB,GAAG,IAAI,OAAO,EAA4B,CAAC;QAiDpE,gEAAgE;QACxD,0BAAqB,GAAG,GAAG,EAAE;YACnC,IAAI,CAAC,0BAA0B,EAAE,CAAC;QACpC,CAAC,CAAC;QAEF,gEAAgE;QACxD,8BAAyB,GAAG,GAAG,EAAE;YACvC,IAAI,CAAC,0BAA0B,EAAE,CAAC;QACpC,CAAC,CAAC;QAxEA,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC;Q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O;SACR;QAED,IAAI,CAAC,wBAAwB,GAAG,UAAU,CAAC,GAAG,EAAE;YAC9C,IAAI,CAAC,kBAAkB,CAAC,UAAU,EAAE,CAAC;YACrC,IAAI,CAAC,wBAAwB,GAAG,SAAS,CAAC;QAC5C,CAAC,EAAE,CAAC,CAAC,CAAC;IACR,CAAC;IAEM,MAAM,CAAC,8BAA8B,CAAC,IAAmB;QAC9D,OAAO,aAAa,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,0BAA0B,CAAC,EAAE,CAAC;IAC/I,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,GAAa,EAAE,OAAgB,EAAE,sBAAsB,GAAG,IAAI;QACxF,MAAM,cAAc,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,CAAC;IACrH,CAAC;IAEM,iBAAiB,CAAC,GAAW,EAAE,OAAgB;QACpD,iBAAiB,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC5E,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport { enableCategory, enableSubCategory } from \"../../CategoriesVisibilityUtils\";\n\nimport type { CategoryInfo } from \"../../category-tree/CategoriesTreeButtons\";\nimport type { VisibilityChangeListener, VisibilityStatus } from \"../../VisibilityTreeEventHandler\";\nimport type { IModelConnection, ViewManager, Viewport } from \"@itwin/core-frontend\";\n\ninterface StatelessCategoriesVisibilityHandlerProps {\n viewManager: ViewManager;\n imodel: IModelConnection;\n categories: CategoryInfo[];\n viewport: Viewport;\n allViewports?: boolean;\n}\n\n/** @internal */\nexport class StatelessCategoriesVisibilityHandler {\n private _viewManager: ViewManager;\n private _imodel: IModelConnection;\n private _pendingVisibilityChange: any | undefined;\n private _viewport: Viewport;\n private _useAllViewports: boolean;\n\n constructor(props: StatelessCategoriesVisibilityHandlerProps) {\n this._viewManager = props.viewManager;\n this._imodel = props.imodel;\n this._viewport = props.viewport;\n // istanbul ignore next\n this._useAllViewports = props.allViewports ?? false;\n this._viewport.onDisplayStyleChanged.addListener(this.onDisplayStyleChanged);\n this._viewport.onViewedCategoriesChanged.addListener(this.onViewedCategoriesChanged);\n }\n\n public dispose() {\n this._viewport.onDisplayStyleChanged.removeListener(this.onDisplayStyleChanged);\n this._viewport.onViewedCategoriesChanged.removeListener(this.onViewedCategoriesChanged);\n clearTimeout(this._pendingVisibilityChange);\n }\n\n public onVisibilityChange = new BeEvent<VisibilityChangeListener>();\n\n /** Returns visibility status of the tree node. */\n public getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus> | VisibilityStatus {\n if (!HierarchyNode.isInstancesNode(node)) {\n return { state: \"hidden\", isDisabled: true };\n }\n return { state: node.parentKeys.length ? this.getSubCategoryVisibility(node) : this.getCategoryVisibility(node) };\n }\n\n public async changeVisibility(node: HierarchyNode, on: boolean) {\n if (!HierarchyNode.isInstancesNode(node)) {\n return;\n }\n\n // handle subcategory visibility change\n if (node.parentKeys.length) {\n const childId = StatelessCategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);\n const parentCategoryId = node.extendedData?.categoryId;\n\n // make sure parent category is enabled\n if (on && parentCategoryId) {\n await this.enableCategory([parentCategoryId], true, false);\n }\n\n this.enableSubCategory(childId, on);\n return;\n }\n\n const instanceId = StatelessCategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);\n await this.enableCategory([instanceId], on, true);\n }\n\n public getSubCategoryVisibility(node: HierarchyNode) {\n const parentCategoryId = node.extendedData?.categoryId;\n if (!parentCategoryId) {\n return \"hidden\";\n }\n\n const subcategoryId = StatelessCategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);\n const isVisible = this._viewport.view.viewsCategory(parentCategoryId) && this._viewport.isSubCategoryVisible(subcategoryId);\n return isVisible ? \"visible\" : \"hidden\";\n }\n\n public getCategoryVisibility(node: HierarchyNode) {\n const instanceId = StatelessCategoriesVisibilityHandler.getInstanceIdFromHierarchyNode(node);\n return this._viewport.view.viewsCategory(instanceId) ? \"visible\" : \"hidden\";\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private onDisplayStyleChanged = () => {\n this.onVisibilityChangeInternal();\n };\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private onViewedCategoriesChanged = () => {\n this.onVisibilityChangeInternal();\n };\n\n private onVisibilityChangeInternal() {\n if (this._pendingVisibilityChange) {\n return;\n }\n\n this._pendingVisibilityChange = setTimeout(() => {\n this.onVisibilityChange.raiseEvent();\n this._pendingVisibilityChange = undefined;\n }, 0);\n }\n\n public static getInstanceIdFromHierarchyNode(node: HierarchyNode) {\n return HierarchyNode.isInstancesNode(node) && node.key.instanceKeys.length > 0 ? node.key.instanceKeys[0].id : /* istanbul ignore next */ \"\";\n }\n\n public async enableCategory(ids: string[], enabled: boolean, enableAllSubCategories = true) {\n await enableCategory(this._viewManager, this._imodel, ids, enabled, this._useAllViewports, enableAllSubCategories);\n }\n\n public enableSubCategory(key: string, enabled: boolean) {\n enableSubCategory(this._viewManager, key, enabled, this._useAllViewports);\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { InstanceKey } from "@itwin/presentation-shared";
|
|
3
|
+
/** @internal */
|
|
4
|
+
export interface FocusedInstancesContext {
|
|
5
|
+
instanceKeys?: InstanceKey[];
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
toggle: () => void;
|
|
8
|
+
}
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare const focusedInstancesContext: import("react").Context<FocusedInstancesContext>;
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare function useFocusedInstancesContext(): FocusedInstancesContext;
|
|
13
|
+
//# sourceMappingURL=FocusedInstancesContext.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
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 { createContext, useContext } from "react";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export const focusedInstancesContext = createContext({ enabled: false, toggle: () => { } });
|
|
8
|
+
/** @internal */
|
|
9
|
+
export function useFocusedInstancesContext() {
|
|
10
|
+
return useContext(focusedInstancesContext);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=FocusedInstancesContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FocusedInstancesContext.js","sourceRoot":"","sources":["../../../../../../src/components/trees/stateless/common/FocusedInstancesContext.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAWlD,gBAAgB;AAChB,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAA0B,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC,CAAC;AAEpH,gBAAgB;AAChB,MAAM,UAAU,0BAA0B;IACxC,OAAO,UAAU,CAAC,uBAAuB,CAAC,CAAC;AAC7C,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 { createContext, useContext } from \"react\";\n\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\n\n/** @internal */\nexport interface FocusedInstancesContext {\n instanceKeys?: InstanceKey[];\n enabled: boolean;\n toggle: () => void;\n}\n\n/** @internal */\nexport const focusedInstancesContext = createContext<FocusedInstancesContext>({ enabled: false, toggle: () => {} });\n\n/** @internal */\nexport function useFocusedInstancesContext() {\n return useContext(focusedInstancesContext);\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PropsWithChildren } from "react";
|
|
2
|
+
import type { SelectionStorage } from "@itwin/presentation-hierarchies-react";
|
|
3
|
+
/** @internal */
|
|
4
|
+
export declare function FocusedInstancesContextProvider({ selectionStorage, imodelKey, children, }: PropsWithChildren<{
|
|
5
|
+
selectionStorage: SelectionStorage;
|
|
6
|
+
imodelKey: string;
|
|
7
|
+
}>): JSX.Element;
|
|
8
|
+
//# sourceMappingURL=FocusedInstancesContextProvider.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import { Selectable, Selectables } from "@itwin/unified-selection";
|
|
8
|
+
import { focusedInstancesContext } from "./FocusedInstancesContext";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export function FocusedInstancesContextProvider({ selectionStorage, imodelKey, children, }) {
|
|
11
|
+
const [state, setState] = useState({
|
|
12
|
+
enabled: false,
|
|
13
|
+
toggle: () => {
|
|
14
|
+
setState((prev) => ({ ...prev, enabled: !prev.enabled }));
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
const enabled = state.enabled;
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (!enabled) {
|
|
20
|
+
setState((prev) => ({ ...prev, instanceKeys: undefined }));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const onSelectionChanged = () => {
|
|
24
|
+
const selection = selectionStorage.getSelection({ imodelKey, level: 0 });
|
|
25
|
+
const selectedInstanceKeys = [];
|
|
26
|
+
Selectables.forEach(selection, (key) => {
|
|
27
|
+
if (Selectable.isInstanceKey(key)) {
|
|
28
|
+
selectedInstanceKeys.push(key);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
setState((prev) => ({ ...prev, instanceKeys: selectedInstanceKeys.length === 0 ? undefined : selectedInstanceKeys }));
|
|
32
|
+
};
|
|
33
|
+
onSelectionChanged();
|
|
34
|
+
return selectionStorage.selectionChangeEvent.addListener(({ imodelKey: changeImodelKey, level }) => {
|
|
35
|
+
if (changeImodelKey !== imodelKey || level !== 0) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
onSelectionChanged();
|
|
39
|
+
});
|
|
40
|
+
}, [enabled, imodelKey, selectionStorage]);
|
|
41
|
+
return _jsx(focusedInstancesContext.Provider, { value: state, children: children });
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=FocusedInstancesContextProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FocusedInstancesContextProvider.js","sourceRoot":"","sources":["../../../../../../src/components/trees/stateless/common/FocusedInstancesContextProvider.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAOpE,gBAAgB;AAChB,MAAM,UAAU,+BAA+B,CAAC,EAC9C,gBAAgB,EAChB,SAAS,EACT,QAA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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","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 { Selectable, Selectables } from \"@itwin/unified-selection\";\nimport { focusedInstancesContext } from \"./FocusedInstancesContext\";\n\nimport type { PropsWithChildren } from \"react\";\nimport type { InstanceKey } from \"@itwin/presentation-common\";\nimport type { SelectionStorage } from \"@itwin/presentation-hierarchies-react\";\nimport type { FocusedInstancesContext } from \"./FocusedInstancesContext\";\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, instanceKeys: undefined }));\n return;\n }\n\n const onSelectionChanged = () => {\n const selection = selectionStorage.getSelection({ imodelKey, level: 0 });\n const selectedInstanceKeys: InstanceKey[] = [];\n Selectables.forEach(selection, (key) => {\n if (Selectable.isInstanceKey(key)) {\n selectedInstanceKeys.push(key);\n }\n });\n setState((prev) => ({ ...prev, instanceKeys: selectedInstanceKeys.length === 0 ? undefined : selectedInstanceKeys }));\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"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TreeRenderer, useTree } from "@itwin/presentation-hierarchies-react";
|
|
2
|
+
type UseTreeLocalizedStrings = Parameters<typeof useTree>[0]["localizedStrings"];
|
|
3
|
+
type TreeRendererLocalizedStrings = Parameters<typeof TreeRenderer>[0]["localizedStrings"];
|
|
4
|
+
type useHierarchiesLocalizationResult = UseTreeLocalizedStrings & TreeRendererLocalizedStrings;
|
|
5
|
+
/** @internal */
|
|
6
|
+
export declare function useHierarchiesLocalization(): useHierarchiesLocalizationResult;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=UseHierarchiesLocalization.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
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("stateless.hierarchies.unspecified"),
|
|
17
|
+
other: TreeWidget.translate("stateless.hierarchies.other"),
|
|
18
|
+
// strings for `TreeRenderer` and `TreeNodeRenderer`
|
|
19
|
+
loading: TreeWidget.translate("stateless.hierarchies.loading"),
|
|
20
|
+
filterHierarchyLevel: TreeWidget.translate("stateless.hierarchies.filterHierarchyLevel"),
|
|
21
|
+
clearHierarchyLevelFilter: TreeWidget.translate("stateless.hierarchies.clearHierarchyLevelFilter"),
|
|
22
|
+
noFilteredChildren: TreeWidget.translate("stateless.hierarchies.noFilteredChildren"),
|
|
23
|
+
resultLimitExceeded: TreeWidget.translate("stateless.hierarchies.resultLimitExceeded"),
|
|
24
|
+
resultLimitExceededWithFiltering: TreeWidget.translate("stateless.hierarchies.resultLimitExceededWithFiltering"),
|
|
25
|
+
increaseHierarchyLimit: TreeWidget.translate("stateless.hierarchies.increaseHierarchyLimit"),
|
|
26
|
+
increaseHierarchyLimitWithFiltering: TreeWidget.translate("stateless.hierarchies.increaseHierarchyLimitWithFiltering"),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=UseHierarchiesLocalization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UseHierarchiesLocalization.js","sourceRoot":"","sources":["../../../../../../src/components/trees/stateless/common/UseHierarchiesLocalization.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AASpD,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;IAEpE,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,SAAS,mBAAmB;IAC1B,OAAO;QACL,iDAAiD;QACjD,WAAW,EAAE,UAAU,CAAC,SAAS,CAAC,mCAAmC,CAAC;QACtE,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,6BAA6B,CAAC;QAE1D,oDAAoD;QACpD,OAAO,EAAE,UAAU,CAAC,SAAS,CAAC,+BAA+B,CAAC;QAC9D,oBAAoB,EAAE,UAAU,CAAC,SAAS,CAAC,4CAA4C,CAAC;QACxF,yBAAyB,EAAE,UAAU,CAAC,SAAS,CAAC,iDAAiD,CAAC;QAClG,kBAAkB,EAAE,UAAU,CAAC,SAAS,CAAC,0CAA0C,CAAC;QACpF,mBAAmB,EAAE,UAAU,CAAC,SAAS,CAAC,2CAA2C,CAAC;QACtF,gCAAgC,EAAE,UAAU,CAAC,SAAS,CAAC,wDAAwD,CAAC;QAChH,sBAAsB,EAAE,UAAU,CAAC,SAAS,CAAC,8CAA8C,CAAC;QAC5F,mCAAmC,EAAE,UAAU,CAAC,SAAS,CAAC,2DAA2D,CAAC;KACvH,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\n return localizedStrings;\n}\n\nfunction getLocalizedStrings(): useHierarchiesLocalizationResult {\n return {\n // strings for the `useUnifiedSelectionTree` hook\n unspecified: TreeWidget.translate(\"stateless.hierarchies.unspecified\"),\n other: TreeWidget.translate(\"stateless.hierarchies.other\"),\n\n // strings for `TreeRenderer` and `TreeNodeRenderer`\n loading: TreeWidget.translate(\"stateless.hierarchies.loading\"),\n filterHierarchyLevel: TreeWidget.translate(\"stateless.hierarchies.filterHierarchyLevel\"),\n clearHierarchyLevelFilter: TreeWidget.translate(\"stateless.hierarchies.clearHierarchyLevelFilter\"),\n noFilteredChildren: TreeWidget.translate(\"stateless.hierarchies.noFilteredChildren\"),\n resultLimitExceeded: TreeWidget.translate(\"stateless.hierarchies.resultLimitExceeded\"),\n resultLimitExceededWithFiltering: TreeWidget.translate(\"stateless.hierarchies.resultLimitExceededWithFiltering\"),\n increaseHierarchyLimit: TreeWidget.translate(\"stateless.hierarchies.increaseHierarchyLimit\"),\n increaseHierarchyLimitWithFiltering: TreeWidget.translate(\"stateless.hierarchies.increaseHierarchyLimitWithFiltering\"),\n };\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IModelConnection } from "@itwin/core-frontend";
|
|
3
|
+
import type { useTree } from "@itwin/presentation-hierarchies-react";
|
|
4
|
+
type UseTreeResult = ReturnType<typeof useTree>;
|
|
5
|
+
interface UseHierarchyLevelFilteringOwnProps {
|
|
6
|
+
imodel: IModelConnection;
|
|
7
|
+
defaultHierarchyLevelSizeLimit: number;
|
|
8
|
+
}
|
|
9
|
+
type UseHierarchyLevelFilteringProps = UseHierarchyLevelFilteringOwnProps & Pick<UseTreeResult, "getHierarchyLevelDetails">;
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare function useHierarchyLevelFiltering({ imodel, defaultHierarchyLevelSizeLimit, getHierarchyLevelDetails }: UseHierarchyLevelFilteringProps): {
|
|
12
|
+
onFilterClick: (nodeId: string | undefined) => void;
|
|
13
|
+
filteringDialog: JSX.Element;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=UseHierarchyFiltering.d.ts.map
|