@itwin/tree-widget-react 2.3.1 → 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 +2 -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/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/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/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/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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/Utils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAIhG,oEAAqD;AAQrD,gBAAgB;AAChB,MAAa,0BAA0B;IAErC,YAAoB,UAAsC;QAAtC,eAAU,GAAV,UAAU,CAA4B;QADlD,SAAI,GAAG,IAAI,KAAK,EAAc,CAAC;IACsB,CAAC;IAEtD,KAAK,CAAC,IAAI;QAChB,OAAO,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC;IAC9C,CAAC;IAEM,KAAK,CAAC,CAAC,aAAa;QACzB,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE;YAC1B,MAAM,EAAE,CAAC;SACV;QAED,IAAI,MAAM,CAAC;QACX,OAAO,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAA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C,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAyB,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAgB,CAAC;AAC/I,CAAC;AAhBD,kEAgBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport type { GeometricModel3dProps, ModelQueryParams } from \"@itwin/core-common\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport { NodeKey } from \"@itwin/presentation-common\";\n\nimport type { ModelInfo } from \"./ModelsTreeComponent\";\n\nimport type { Id64String } from \"@itwin/core-bentley\";\nimport type { ChildNodeSpecification, Node, Ruleset, SingleSchemaClassSpecification } from \"@itwin/presentation-common\";\nimport type { DelayLoadedTreeNodeItem } from \"@itwin/components-react\";\nimport type { ModelsTreeHierarchyConfiguration } from \"./ModelsTree\";\n/** @internal */\nexport class CachingElementIdsContainer {\n private _ids = new Array<Id64String>();\n constructor(private _generator: AsyncGenerator<Id64String>) {}\n\n private async next() {\n return (await this._generator.next()).value;\n }\n\n public async *getElementIds() {\n for (const id of this._ids) {\n yield id;\n }\n\n let nextId;\n while ((nextId = await this.next())) {\n this._ids.push(nextId);\n yield nextId;\n }\n }\n}\n\n/** @internal */\nexport type CreateRulesetProps = Omit<ModelsTreeHierarchyConfiguration, \"enableElementsClassGrouping\"> & {\n enableElementsClassGrouping?: boolean;\n};\n\n/** @internal */\nexport function createRuleset(props: CreateRulesetProps): Ruleset {\n const context: SpecificationsContext = {\n elementClassSpecification: props.elementClassSpecification ?? { schemaName: \"BisCore\", className: \"GeometricElement3d\" },\n groupElements: !!props.enableElementsClassGrouping,\n showEmptyModels: !!props.showEmptyModels,\n };\n\n return {\n id: \"tree-widget-react/ModelsTree\",\n requiredSchemas: [\n {\n name: \"BisCore\",\n },\n ],\n rules: [\n {\n ruleType: \"RootNodes\",\n autoExpand: true,\n specifications: [createRootSubjectSpecification()],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: '\"icon-imodel-hollow-2\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [createRelatedHierarchySubjectSpecification(), createRelatedNonHierarchySubjectSpecification()],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: '\"icon-folder\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [createNonContentModelsSpecification(context), createContentModelsSpecification(context)],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: '\"icon-model\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"ISubModeledElement\", \"BisCore\")`,\n specifications: [createElementModelSpecification(context)],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: '\"icon-model\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricModel3d\", \"BisCore\")`,\n specifications: [createModelCategoriesSpecification(context)],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isCategory: \"true\",\n modelId: \"ParentNode.InstanceId\",\n icon: '\"icon-layers\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"SpatialCategory\", \"BisCore\")`,\n specifications: [createCategoryElementsSpecification(context)],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n modelId: \"this.Model.Id\",\n categoryId: \"this.Category.Id\",\n icon: '\"icon-item\"',\n groupIcon: '\"icon-ec-class\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricElement3d\", \"BisCore\")`,\n specifications: [createEementElementsSpecification(context)],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n modelId: \"this.Model.Id\",\n categoryId: \"this.Category.Id\",\n icon: '\"icon-item\"',\n groupIcon: '\"icon-ec-class\"',\n },\n },\n ],\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"SpatialCategory\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n ],\n };\n}\n\n/** @internal */\nexport type CreateSearchRulesetProps = Omit<ModelsTreeHierarchyConfiguration, \"enableElementsClassGrouping\">;\n\n/** @internal */\nexport function createSearchRuleset(props: CreateSearchRulesetProps): Ruleset {\n const context: SpecificationsContext = {\n elementClassSpecification: props.elementClassSpecification ?? { schemaName: \"BisCore\", className: \"GeometricElement3d\" },\n groupElements: false,\n showEmptyModels: !!props.showEmptyModels,\n };\n\n return {\n id: \"tree-widget-react/ModelsTreeSearch\",\n rules: [\n {\n ruleType: \"RootNodes\",\n specifications: [createRootSubjectSpecification()],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: '\"icon-imodel-hollow-2\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createRelatedHierarchySubjectSpecification(),\n {\n ...createRelatedNonHierarchySubjectSpecification(),\n hideExpression: `NOT ThisNode.HasChildren ANDALSO NOT ThisNode.ChildrenArtifacts.AnyMatches(x => x.isContentModel)`,\n hideIfNoChildren: undefined,\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: '\"icon-folder\"',\n },\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n {\n ...createNonContentModelsSpecification(context),\n hasChildren: \"Unknown\",\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: '\"icon-model\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n {\n ...createContentModelsSpecification(context),\n hasChildren: \"Unknown\",\n },\n ],\n customizationRules: [\n {\n ruleType: \"NodeArtifacts\",\n items: {\n isContentModel: \"true\",\n },\n },\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: '\"icon-model\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricModel3d\", \"BisCore\")`,\n specifications: [createModelSubModelsSpecification(context)],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: '\"icon-model\"',\n },\n },\n ],\n },\n ],\n };\n}\n\ninterface SpecificationsContext {\n elementClassSpecification: SingleSchemaClassSpecification;\n groupElements: boolean;\n showEmptyModels: boolean;\n}\n\nfunction createRootSubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: [\n {\n schemaName: \"BisCore\",\n classNames: [\"Subject\"],\n },\n ],\n instanceFilter: `this.Parent = NULL`,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createRelatedHierarchySubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"SubjectOwnsSubjects\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n },\n ],\n instanceFilter: `json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") <> NULL OR ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") = \"Hierarchy\"`,\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createRelatedNonHierarchySubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"SubjectOwnsSubjects\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n },\n ],\n instanceFilter: `json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") = NULL AND ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") <> \"Hierarchy\"`,\n hideIfNoChildren: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createNonContentModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const partitionFilter = `parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)`;\n const modelHasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n\n const hasNoContent = `json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") = NULL AND json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") = NULL`;\n const instanceFilter = `(${partitionFilter}) AND NOT this.IsPrivate AND ${hasNoContent}${showEmptyModels ? \"\" : ` AND ${modelHasElements}`}`;\n\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: {\n schemaName: \"BisCore\",\n classNames: [\"GeometricModel3d\"],\n arePolymorphic: true,\n },\n relatedInstances: [\n {\n relationshipPath: {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"InformationPartitionElement\",\n },\n },\n alias: \"partition\",\n isRequired: true,\n },\n ],\n instanceFilter,\n hasChildren: showEmptyModels ? \"Unknown\" : \"Always\",\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createContentModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const partitionFilter = `parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)`;\n const modelHasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n\n const hasContent = `json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") <> NULL OR json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") <> NULL`;\n const instanceFilter = `(${partitionFilter}) AND NOT this.IsPrivate AND (${hasContent})${showEmptyModels ? \"\" : ` AND ${modelHasElements}`}`;\n\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: {\n schemaName: \"BisCore\",\n classNames: [\"GeometricModel3d\"],\n arePolymorphic: true,\n },\n relatedInstances: [\n {\n relationshipPath: {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"InformationPartitionElement\",\n },\n },\n alias: \"partition\",\n isRequired: true,\n },\n ],\n instanceFilter,\n hasChildren: showEmptyModels ? \"Unknown\" : \"Always\",\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createElementModelSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const hasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n const instanceFilter = `NOT this.IsPrivate${showEmptyModels ? \"\" : ` AND ${hasElements}`}`;\n\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Backward\",\n },\n ],\n instanceFilter,\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createModelCategoriesSpecification({ elementClassSpecification }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelContainsElements\",\n },\n direction: \"Forward\",\n targetClass: elementClassSpecification,\n },\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"GeometricElement3dIsInCategory\",\n },\n direction: \"Forward\",\n },\n ],\n ],\n instanceFilter: `NOT this.IsPrivate`,\n suppressSimilarAncestorsCheck: true,\n hideIfNoChildren: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createCategoryElementsSpecification({ elementClassSpecification, groupElements }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"GeometricElement3dIsInCategory\",\n },\n direction: \"Backward\",\n targetClass: elementClassSpecification,\n },\n ],\n instanceFilter: `this.Model.Id = parent.parent.ECInstanceId ANDALSO this.Parent = NULL`,\n groupByClass: groupElements,\n groupByLabel: false,\n };\n}\n\nfunction createEementElementsSpecification({ elementClassSpecification, groupElements }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ElementOwnsChildElements\",\n },\n direction: \"Forward\",\n targetClass: elementClassSpecification,\n },\n ],\n groupByClass: groupElements,\n groupByLabel: false,\n };\n}\n\nfunction createModelSubModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const hasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n const instanceFilter = `NOT this.IsPrivate${showEmptyModels ? \"\" : ` AND ${hasElements}`}`;\n\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelOwnsSubModel\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"GeometricModel3d\",\n },\n },\n ],\n instanceFilter,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\n/** @internal */\nexport function addModelsTreeNodeItemIcons(item: Partial<DelayLoadedTreeNodeItem>, node: Partial<Node>) {\n item.icon = node.key && NodeKey.isClassGroupingNodeKey(node.key) ? node.extendedData?.groupIcon : node.extendedData?.icon;\n}\n\n/** @internal */\nexport async function queryModelsForHeaderActions(iModel: IModelConnection) {\n const queryParams: ModelQueryParams = {\n from: \"BisCore.GeometricModel3d\",\n where: `\n EXISTS (\n SELECT 1\n FROM BisCore.Element e\n WHERE e.ECClassId IS (BisCore.GeometricElement3d, BisCore.InformationPartitionElement)\n AND e.ECInstanceId = GeometricModel3d.ModeledElement.Id\n )\n `,\n wantPrivate: false,\n };\n\n const modelProps = await iModel.models.queryProps(queryParams);\n return modelProps.map(({ id, isPlanProjection }: GeometricModel3dProps) => ({ id, isPlanProjection })).filter(({ id }) => id) as ModelInfo[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/Utils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,oEAAqD;AAUrD,gBAAgB;AAChB,MAAa,0BAA0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,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC;AAC5H,CAAC;AAFD,gEAEC;AAED,gBAAgB;AACT,KAAK,UAAU,2BAA2B,CAAC,MAAwB;IACxE,MAAM,WAAW,GAAqB;QACpC,IAAI,EAAE,0BAA0B;QAChC,KAAK,EAAE;;;;;;;OAOJ;QACH,WAAW,EAAE,KAAK;KACnB,CAAC;IAEF,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAC/D,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAyB,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAgB,CAAC;AAC/I,CAAC;AAhBD,kEAgBC","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 { NodeKey } from \"@itwin/presentation-common\";\n\nimport type { Id64String } from \"@itwin/core-bentley\";\nimport type { GeometricModel3dProps, ModelQueryParams } from \"@itwin/core-common\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { ChildNodeSpecification, Node, Ruleset, SingleSchemaClassSpecification } from \"@itwin/presentation-common\";\nimport type { DelayLoadedTreeNodeItem } from \"@itwin/components-react\";\nimport type { ModelsTreeHierarchyConfiguration } from \"./ModelsTree\";\nimport type { ModelInfo } from \"./ModelsTreeButtons\";\n\n/** @internal */\nexport class CachingElementIdsContainer {\n private _ids = new Array<Id64String>();\n constructor(private _generator: AsyncGenerator<Id64String>) {}\n\n private async next() {\n return (await this._generator.next()).value;\n }\n\n public async *getElementIds() {\n for (const id of this._ids) {\n yield id;\n }\n\n let nextId;\n while ((nextId = await this.next())) {\n this._ids.push(nextId);\n yield nextId;\n }\n }\n}\n\n/** @internal */\nexport type CreateRulesetProps = Omit<ModelsTreeHierarchyConfiguration, \"enableElementsClassGrouping\"> & {\n enableElementsClassGrouping?: boolean;\n};\n\n/** @internal */\nexport function createRuleset(props: CreateRulesetProps): Ruleset {\n const context: SpecificationsContext = {\n elementClassSpecification: props.elementClassSpecification ?? { schemaName: \"BisCore\", className: \"GeometricElement3d\" },\n groupElements: !!props.enableElementsClassGrouping,\n showEmptyModels: !!props.showEmptyModels,\n };\n\n return {\n id: \"tree-widget-react/ModelsTree\",\n requiredSchemas: [\n {\n name: \"BisCore\",\n },\n ],\n rules: [\n {\n ruleType: \"RootNodes\",\n autoExpand: true,\n specifications: [createRootSubjectSpecification()],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: '\"icon-imodel-hollow-2\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [createRelatedHierarchySubjectSpecification(), createRelatedNonHierarchySubjectSpecification()],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: '\"icon-folder\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [createNonContentModelsSpecification(context), createContentModelsSpecification(context)],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: '\"icon-model\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"ISubModeledElement\", \"BisCore\")`,\n specifications: [createElementModelSpecification(context)],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: '\"icon-model\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricModel3d\", \"BisCore\")`,\n specifications: [createModelCategoriesSpecification(context)],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isCategory: \"true\",\n modelId: \"ParentNode.InstanceId\",\n icon: '\"icon-layers\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"SpatialCategory\", \"BisCore\")`,\n specifications: [createCategoryElementsSpecification(context)],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n modelId: \"this.Model.Id\",\n categoryId: \"this.Category.Id\",\n icon: '\"icon-item\"',\n groupIcon: '\"icon-ec-class\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricElement3d\", \"BisCore\")`,\n specifications: [createEementElementsSpecification(context)],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n modelId: \"this.Model.Id\",\n categoryId: \"this.Category.Id\",\n icon: '\"icon-item\"',\n groupIcon: '\"icon-ec-class\"',\n },\n },\n ],\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"SpatialCategory\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n ],\n };\n}\n\n/** @internal */\nexport type CreateSearchRulesetProps = Omit<ModelsTreeHierarchyConfiguration, \"enableElementsClassGrouping\">;\n\n/** @internal */\nexport function createSearchRuleset(props: CreateSearchRulesetProps): Ruleset {\n const context: SpecificationsContext = {\n elementClassSpecification: props.elementClassSpecification ?? { schemaName: \"BisCore\", className: \"GeometricElement3d\" },\n groupElements: false,\n showEmptyModels: !!props.showEmptyModels,\n };\n\n return {\n id: \"tree-widget-react/ModelsTreeSearch\",\n rules: [\n {\n ruleType: \"RootNodes\",\n specifications: [createRootSubjectSpecification()],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: '\"icon-imodel-hollow-2\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createRelatedHierarchySubjectSpecification(),\n {\n ...createRelatedNonHierarchySubjectSpecification(),\n hideExpression: `NOT ThisNode.HasChildren ANDALSO NOT ThisNode.ChildrenArtifacts.AnyMatches(x => x.isContentModel)`,\n hideIfNoChildren: undefined,\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: '\"icon-folder\"',\n },\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n {\n ...createNonContentModelsSpecification(context),\n hasChildren: \"Unknown\",\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: '\"icon-model\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n {\n ...createContentModelsSpecification(context),\n hasChildren: \"Unknown\",\n },\n ],\n customizationRules: [\n {\n ruleType: \"NodeArtifacts\",\n items: {\n isContentModel: \"true\",\n },\n },\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: '\"icon-model\"',\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricModel3d\", \"BisCore\")`,\n specifications: [createModelSubModelsSpecification(context)],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: '\"icon-model\"',\n },\n },\n ],\n },\n ],\n };\n}\n\ninterface SpecificationsContext {\n elementClassSpecification: SingleSchemaClassSpecification;\n groupElements: boolean;\n showEmptyModels: boolean;\n}\n\nfunction createRootSubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: [\n {\n schemaName: \"BisCore\",\n classNames: [\"Subject\"],\n },\n ],\n instanceFilter: `this.Parent = NULL`,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createRelatedHierarchySubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"SubjectOwnsSubjects\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n },\n ],\n instanceFilter: `json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") <> NULL OR ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") = \"Hierarchy\"`,\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createRelatedNonHierarchySubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"SubjectOwnsSubjects\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n },\n ],\n instanceFilter: `json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") = NULL AND ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") <> \"Hierarchy\"`,\n hideIfNoChildren: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createNonContentModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const partitionFilter = `parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)`;\n const modelHasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n\n const hasNoContent = `json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") = NULL AND json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") = NULL`;\n const instanceFilter = `(${partitionFilter}) AND NOT this.IsPrivate AND ${hasNoContent}${showEmptyModels ? \"\" : ` AND ${modelHasElements}`}`;\n\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: {\n schemaName: \"BisCore\",\n classNames: [\"GeometricModel3d\"],\n arePolymorphic: true,\n },\n relatedInstances: [\n {\n relationshipPath: {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"InformationPartitionElement\",\n },\n },\n alias: \"partition\",\n isRequired: true,\n },\n ],\n instanceFilter,\n hasChildren: showEmptyModels ? \"Unknown\" : \"Always\",\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createContentModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const partitionFilter = `parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)`;\n const modelHasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n\n const hasContent = `json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") <> NULL OR json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") <> NULL`;\n const instanceFilter = `(${partitionFilter}) AND NOT this.IsPrivate AND (${hasContent})${showEmptyModels ? \"\" : ` AND ${modelHasElements}`}`;\n\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: {\n schemaName: \"BisCore\",\n classNames: [\"GeometricModel3d\"],\n arePolymorphic: true,\n },\n relatedInstances: [\n {\n relationshipPath: {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"InformationPartitionElement\",\n },\n },\n alias: \"partition\",\n isRequired: true,\n },\n ],\n instanceFilter,\n hasChildren: showEmptyModels ? \"Unknown\" : \"Always\",\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createElementModelSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const hasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n const instanceFilter = `NOT this.IsPrivate${showEmptyModels ? \"\" : ` AND ${hasElements}`}`;\n\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Backward\",\n },\n ],\n instanceFilter,\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createModelCategoriesSpecification({ elementClassSpecification }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelContainsElements\",\n },\n direction: \"Forward\",\n targetClass: elementClassSpecification,\n },\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"GeometricElement3dIsInCategory\",\n },\n direction: \"Forward\",\n },\n ],\n ],\n instanceFilter: `NOT this.IsPrivate`,\n suppressSimilarAncestorsCheck: true,\n hideIfNoChildren: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createCategoryElementsSpecification({ elementClassSpecification, groupElements }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"GeometricElement3dIsInCategory\",\n },\n direction: \"Backward\",\n targetClass: elementClassSpecification,\n },\n ],\n instanceFilter: `this.Model.Id = parent.parent.ECInstanceId ANDALSO this.Parent = NULL`,\n groupByClass: groupElements,\n groupByLabel: false,\n };\n}\n\nfunction createEementElementsSpecification({ elementClassSpecification, groupElements }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ElementOwnsChildElements\",\n },\n direction: \"Forward\",\n targetClass: elementClassSpecification,\n },\n ],\n groupByClass: groupElements,\n groupByLabel: false,\n };\n}\n\nfunction createModelSubModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const hasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n const instanceFilter = `NOT this.IsPrivate${showEmptyModels ? \"\" : ` AND ${hasElements}`}`;\n\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelOwnsSubModel\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"GeometricModel3d\",\n },\n },\n ],\n instanceFilter,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\n/** @internal */\nexport function addModelsTreeNodeItemIcons(item: Partial<DelayLoadedTreeNodeItem>, node: Partial<Node>) {\n item.icon = node.key && NodeKey.isClassGroupingNodeKey(node.key) ? node.extendedData?.groupIcon : node.extendedData?.icon;\n}\n\n/** @internal */\nexport async function queryModelsForHeaderActions(iModel: IModelConnection) {\n const queryParams: ModelQueryParams = {\n from: \"BisCore.GeometricModel3d\",\n where: `\n EXISTS (\n SELECT 1\n FROM BisCore.Element e\n WHERE e.ECClassId IS (BisCore.GeometricElement3d, BisCore.InformationPartitionElement)\n AND e.ECInstanceId = GeometricModel3d.ModeledElement.Id\n )\n `,\n wantPrivate: false,\n };\n\n const modelProps = await iModel.models.queryProps(queryParams);\n return modelProps.map(({ id, isPlanProjection }: GeometricModel3dProps) => ({ id, isPlanProjection })).filter(({ id }) => id) as ModelInfo[];\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { VisibilityTree } from "../common/components/VisibilityTree";
|
|
2
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
3
|
+
import type { CategoryInfo } from "../../category-tree/CategoriesTreeButtons";
|
|
4
|
+
import type { ViewManager, Viewport } from "@itwin/core-frontend";
|
|
5
|
+
import type { HierarchyLevelConfig } from "../../common/Types";
|
|
6
|
+
interface StatelessCategoriesTreeOwnProps {
|
|
7
|
+
filter: string;
|
|
8
|
+
activeView: Viewport;
|
|
9
|
+
categories: CategoryInfo[];
|
|
10
|
+
viewManager?: ViewManager;
|
|
11
|
+
allViewports?: boolean;
|
|
12
|
+
hierarchyLevelConfig?: Omit<HierarchyLevelConfig, "isFilteringEnabled">;
|
|
13
|
+
onPerformanceMeasured?: (featureId: string, duration: number) => void;
|
|
14
|
+
}
|
|
15
|
+
type VisibilityTreeProps = ComponentPropsWithoutRef<typeof VisibilityTree>;
|
|
16
|
+
type StatelessModelsTreeProps = StatelessCategoriesTreeOwnProps & Pick<VisibilityTreeProps, "imodel" | "getSchemaContext" | "height" | "width" | "density" | "selectionMode">;
|
|
17
|
+
/** @internal */
|
|
18
|
+
export declare function StatelessCategoriesTree({ imodel, viewManager, categories, allViewports, getSchemaContext, height, width, activeView, filter, density, hierarchyLevelConfig, selectionMode, onPerformanceMeasured, }: StatelessModelsTreeProps): JSX.Element;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=CategoriesTree.d.ts.map
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatelessCategoriesTree = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/*---------------------------------------------------------------------------------------------
|
|
6
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
7
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
|
+
*--------------------------------------------------------------------------------------------*/
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const core_frontend_1 = require("@itwin/core-frontend");
|
|
11
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
12
|
+
const TreeWidget_1 = require("../../../../TreeWidget");
|
|
13
|
+
const VisibilityTree_1 = require("../common/components/VisibilityTree");
|
|
14
|
+
const CategoriesTreeDefinition_1 = require("./CategoriesTreeDefinition");
|
|
15
|
+
const CategoriesVisibilityHandler_1 = require("./CategoriesVisibilityHandler");
|
|
16
|
+
const StatelessCategoriesTreeId = "categories-tree-v2";
|
|
17
|
+
/** @internal */
|
|
18
|
+
function StatelessCategoriesTree({ imodel, viewManager, categories, allViewports, getSchemaContext, height, width, activeView, filter, density, hierarchyLevelConfig, selectionMode, onPerformanceMeasured, }) {
|
|
19
|
+
const visibilityHandlerFactory = (0, react_1.useCallback)(() => {
|
|
20
|
+
const visibilityHandler = new CategoriesVisibilityHandler_1.StatelessCategoriesVisibilityHandler({
|
|
21
|
+
imodel,
|
|
22
|
+
viewport: activeView,
|
|
23
|
+
viewManager: viewManager ?? core_frontend_1.IModelApp.viewManager,
|
|
24
|
+
categories,
|
|
25
|
+
allViewports,
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
getVisibilityStatus: async (node) => visibilityHandler.getVisibilityStatus(node),
|
|
29
|
+
changeVisibility: async (node, on) => visibilityHandler.changeVisibility(node, on),
|
|
30
|
+
onVisibilityChange: visibilityHandler.onVisibilityChange,
|
|
31
|
+
dispose: () => visibilityHandler.dispose(),
|
|
32
|
+
};
|
|
33
|
+
}, [activeView, allViewports, categories, imodel, viewManager]);
|
|
34
|
+
const getDefinitionsProvider = (0, react_1.useCallback)((props) => {
|
|
35
|
+
return new CategoriesTreeDefinition_1.CategoriesTreeDefinition({ ...props, viewType: activeView.view.is2d() ? "2d" : "3d" });
|
|
36
|
+
}, [activeView]);
|
|
37
|
+
const getSearchFilteredPaths = (0, react_1.useMemo)(() => {
|
|
38
|
+
if (!filter) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
return async ({ imodelAccess }) => CategoriesTreeDefinition_1.CategoriesTreeDefinition.createInstanceKeyPaths({ imodelAccess, label: filter, viewType: activeView.view.is2d() ? "2d" : "3d" });
|
|
42
|
+
}, [filter, activeView]);
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)(VisibilityTree_1.VisibilityTree, { height: height, width: width, imodel: imodel, treeName: "StatelessCategoriesTree", getSchemaContext: getSchemaContext, visibilityHandlerFactory: visibilityHandlerFactory, getHierarchyDefinition: getDefinitionsProvider, getFilteredPaths: getSearchFilteredPaths, hierarchyLevelSizeLimit: hierarchyLevelConfig?.sizeLimit, getIcon: getIcon, getSublabel: getSublabel, density: density, noDataMessage: getNoDataMessage(filter), selectionMode: selectionMode ?? "none", onPerformanceMeasured: (action, duration) => {
|
|
44
|
+
onPerformanceMeasured?.(`${StatelessCategoriesTreeId}-${action}`, duration);
|
|
45
|
+
} }));
|
|
46
|
+
}
|
|
47
|
+
exports.StatelessCategoriesTree = StatelessCategoriesTree;
|
|
48
|
+
function getNoDataMessage(filter) {
|
|
49
|
+
if (filter) {
|
|
50
|
+
return (0, jsx_runtime_1.jsx)(itwinui_react_1.Text, { children: TreeWidget_1.TreeWidget.translate("stateless.noNodesMatchFilter", { filter }) });
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
function getSublabel(node) {
|
|
55
|
+
return (0, jsx_runtime_1.jsx)("div", { style: { marginBottom: "10px" }, children: node.extendedData?.description });
|
|
56
|
+
}
|
|
57
|
+
function getIcon() {
|
|
58
|
+
// empty icon aligns nodes with and without an expander
|
|
59
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=CategoriesTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoriesTree.js","sourceRoot":"","sources":["../../../../../../src/components/trees/stateless/categories-tree/CategoriesTree.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,iCAA6C;AAC7C,wDAAiD;AACjD,wDAA4C;AAC5C,uDAAoD;AACpD,wEAAqE;AACrE,yEAAsE;AACtE,+EAAqF;AA0BrF,MAAM,yBAAyB,GAAG,oBAAoB,CAAC;AAEvD,gBAAgB;AAChB,SAAgB,uBAAuB,CAAC,EACtC,MAAM,EACN,WAAW,EACX,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,MAAM,EACN,KAAK,EACL,UAAU,EACV,MAAM,EACN,OAAO,EACP,oBAAoB,EACpB,aAAa,EACb,qBAAqB,GACI;IACzB,MAAM,wBAAwB,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAChD,MAAM,iBAAiB,GAAG,IAAI,kEAAoC,CAAC;YACjE,MAAM;YACN,QAAQ,EAAE,UAAU;YACpB,WAAW,EAAE,WAAW,IAAI,yBAAS,CAAC,WAAW;YACjD,UAAU;YACV,YAAY;SACb,CAAC,CAAC;QACH,OAAO;YACL,mBAAmB,EAAE,KAAK,EAAE,IAAmB,EAAE,EAAE,CAAC,iBAAiB,CAAC,mBAAmB,CAAC,IAAI,CAAC;YAC/F,gBAAgB,EAAE,KAAK,EAAE,IAAmB,EAAE,EAAW,EAAE,EAAE,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,CAAC;YAC1G,kBAAkB,EAAE,iBAAiB,CAAC,kBAAkB;YACxD,OAAO,EAAE,GAAG,EAAE,C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AAgB,CAAC,MAAM,CAAC,EACvC,aAAa,EAAE,aAAa,IAAI,MAAM,EACtC,qBAAqB,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,EAAE;YAC1C,qBAAqB,EAAE,CAAC,GAAG,yBAAyB,IAAI,MAAM,EAAE,EAAE,QAAQ,CAAC,CAAC;QAC9E,CAAC,GACD,CACH,CAAC;AACJ,CAAC;AAnED,0DAmEC;AAED,SAAS,gBAAgB,CAAC,MAAc;IACtC,IAAI,MAAM,EAAE;QACV,OAAO,uBAAC,oBAAI,cAAE,uBAAU,CAAC,SAAS,CAAC,8BAA8B,EAAE,EAAE,MAAM,EAAE,CAAC,GAAQ,CAAC;KACxF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,WAAW,CAAC,IAA+B;IAClD,OAAO,gCAAK,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,YAAG,IAAI,CAAC,YAAY,EAAE,WAAW,GAAO,CAAC;AACtF,CAAC;AAED,SAAS,OAAO;IACd,uDAAuD;IACvD,OAAO,kDAAK,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 { useCallback, useMemo } from \"react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { TreeWidget } from \"../../../../TreeWidget\";\nimport { VisibilityTree } from \"../common/components/VisibilityTree\";\nimport { CategoriesTreeDefinition } from \"./CategoriesTreeDefinition\";\nimport { StatelessCategoriesVisibilityHandler } from \"./CategoriesVisibilityHandler\";\n\nimport type { ComponentPropsWithoutRef, ReactElement } from \"react\";\nimport type { CategoryInfo } from \"../../category-tree/CategoriesTreeButtons\";\nimport type { ViewManager, Viewport } from \"@itwin/core-frontend\";\nimport type { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { HierarchyLevelConfig } from \"../../common/Types\";\n\ninterface StatelessCategoriesTreeOwnProps {\n filter: string;\n activeView: Viewport;\n categories: CategoryInfo[];\n viewManager?: ViewManager;\n allViewports?: boolean;\n hierarchyLevelConfig?: Omit<HierarchyLevelConfig, \"isFilteringEnabled\">;\n onPerformanceMeasured?: (featureId: string, duration: number) => void;\n}\n\ntype VisibilityTreeProps = ComponentPropsWithoutRef<typeof VisibilityTree>;\ntype GetFilteredPathsCallback = VisibilityTreeProps[\"getFilteredPaths\"];\ntype GetHierarchyDefinitionCallback = VisibilityTreeProps[\"getHierarchyDefinition\"];\n\ntype StatelessModelsTreeProps = StatelessCategoriesTreeOwnProps &\n Pick<VisibilityTreeProps, \"imodel\" | \"getSchemaContext\" | \"height\" | \"width\" | \"density\" | \"selectionMode\">;\n\nconst StatelessCategoriesTreeId = \"categories-tree-v2\";\n\n/** @internal */\nexport function StatelessCategoriesTree({\n imodel,\n viewManager,\n categories,\n allViewports,\n getSchemaContext,\n height,\n width,\n activeView,\n filter,\n density,\n hierarchyLevelConfig,\n selectionMode,\n onPerformanceMeasured,\n}: StatelessModelsTreeProps) {\n const visibilityHandlerFactory = useCallback(() => {\n const visibilityHandler = new StatelessCategoriesVisibilityHandler({\n imodel,\n viewport: activeView,\n viewManager: viewManager ?? IModelApp.viewManager,\n categories,\n allViewports,\n });\n return {\n getVisibilityStatus: async (node: HierarchyNode) => visibilityHandler.getVisibilityStatus(node),\n changeVisibility: async (node: HierarchyNode, on: boolean) => visibilityHandler.changeVisibility(node, on),\n onVisibilityChange: visibilityHandler.onVisibilityChange,\n dispose: () => visibilityHandler.dispose(),\n };\n }, [activeView, allViewports, categories, imodel, viewManager]);\n\n const getDefinitionsProvider = useCallback(\n (props: Parameters<GetHierarchyDefinitionCallback>[0]) => {\n return new CategoriesTreeDefinition({ ...props, viewType: activeView.view.is2d() ? \"2d\" : \"3d\" });\n },\n [activeView],\n );\n\n const getSearchFilteredPaths = useMemo<GetFilteredPathsCallback | undefined>(() => {\n if (!filter) {\n return undefined;\n }\n return async ({ imodelAccess }) =>\n CategoriesTreeDefinition.createInstanceKeyPaths({ imodelAccess, label: filter, viewType: activeView.view.is2d() ? \"2d\" : \"3d\" });\n }, [filter, activeView]);\n\n return (\n <VisibilityTree\n height={height}\n width={width}\n imodel={imodel}\n treeName=\"StatelessCategoriesTree\"\n getSchemaContext={getSchemaContext}\n visibilityHandlerFactory={visibilityHandlerFactory}\n getHierarchyDefinition={getDefinitionsProvider}\n getFilteredPaths={getSearchFilteredPaths}\n hierarchyLevelSizeLimit={hierarchyLevelConfig?.sizeLimit}\n getIcon={getIcon}\n getSublabel={getSublabel}\n density={density}\n noDataMessage={getNoDataMessage(filter)}\n selectionMode={selectionMode ?? \"none\"}\n onPerformanceMeasured={(action, duration) => {\n onPerformanceMeasured?.(`${StatelessCategoriesTreeId}-${action}`, duration);\n }}\n />\n );\n}\n\nfunction getNoDataMessage(filter: string) {\n if (filter) {\n return <Text>{TreeWidget.translate(\"stateless.noNodesMatchFilter\", { filter })}</Text>;\n }\n return undefined;\n}\n\nfunction getSublabel(node: PresentationHierarchyNode): ReactElement | undefined {\n return <div style={{ marginBottom: \"10px\" }}>{node.extendedData?.description}</div>;\n}\n\nfunction getIcon(): ReactElement | undefined {\n // empty icon aligns nodes with and without an expander\n return <></>;\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StatelessCategoriesTree } from "./CategoriesTree";
|
|
2
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
3
|
+
import type { SelectionStorage } from "@itwin/presentation-hierarchies-react";
|
|
4
|
+
import type { CategoriesTreeHeaderButtonProps } from "../../category-tree/CategoriesTreeButtons";
|
|
5
|
+
type StatelessCategoriesTreeProps = ComponentPropsWithoutRef<typeof StatelessCategoriesTree>;
|
|
6
|
+
interface StatelessCategoriesTreeComponentProps extends Pick<StatelessCategoriesTreeProps, "getSchemaContext" | "density" | "hierarchyLevelConfig" | "selectionMode" | "onPerformanceMeasured"> {
|
|
7
|
+
headerButtons?: Array<(props: CategoriesTreeHeaderButtonProps) => React.ReactNode>;
|
|
8
|
+
selectionStorage: SelectionStorage;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A component that renders [[StatelessCategoriesTree]] and a header with filtering capabilities and header buttons.
|
|
12
|
+
* @beta
|
|
13
|
+
*/
|
|
14
|
+
export declare const StatelessCategoriesTreeComponent: (props: StatelessCategoriesTreeComponentProps) => JSX.Element | null;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=CategoriesTreeComponent.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StatelessCategoriesTreeComponent = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/*---------------------------------------------------------------------------------------------
|
|
6
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
7
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
|
+
*--------------------------------------------------------------------------------------------*/
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const appui_react_1 = require("@itwin/appui-react");
|
|
11
|
+
const core_frontend_1 = require("@itwin/core-frontend");
|
|
12
|
+
const presentation_hierarchies_react_1 = require("@itwin/presentation-hierarchies-react");
|
|
13
|
+
const TreeHeader_1 = require("../../../tree-header/TreeHeader");
|
|
14
|
+
const AutoSizer_1 = require("../../../utils/AutoSizer");
|
|
15
|
+
const CategoriesTreeButtons_1 = require("../../category-tree/CategoriesTreeButtons");
|
|
16
|
+
const CategoryVisibilityHandler_1 = require("../../category-tree/CategoryVisibilityHandler");
|
|
17
|
+
const CategoriesTree_1 = require("./CategoriesTree");
|
|
18
|
+
/**
|
|
19
|
+
* A component that renders [[StatelessCategoriesTree]] and a header with filtering capabilities and header buttons.
|
|
20
|
+
* @beta
|
|
21
|
+
*/
|
|
22
|
+
const StatelessCategoriesTreeComponent = (props) => {
|
|
23
|
+
const iModel = (0, appui_react_1.useActiveIModelConnection)();
|
|
24
|
+
const viewport = (0, appui_react_1.useActiveViewport)();
|
|
25
|
+
if (!iModel || !viewport) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return (0, jsx_runtime_1.jsx)(CategoriesTreeComponentImpl, { ...props, iModel: iModel, viewport: viewport });
|
|
29
|
+
};
|
|
30
|
+
exports.StatelessCategoriesTreeComponent = StatelessCategoriesTreeComponent;
|
|
31
|
+
function CategoriesTreeComponentImpl({ iModel, viewport, headerButtons, selectionStorage, ...treeProps }) {
|
|
32
|
+
const categories = (0, CategoryVisibilityHandler_1.useCategories)(core_frontend_1.IModelApp.viewManager, iModel, viewport);
|
|
33
|
+
const [filter, setFilter] = (0, react_1.useState)("");
|
|
34
|
+
const density = treeProps.density;
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "tree-widget-tree-with-header", children: (0, jsx_runtime_1.jsxs)(presentation_hierarchies_react_1.UnifiedSelectionProvider, { storage: selectionStorage, children: [(0, jsx_runtime_1.jsx)(TreeHeader_1.TreeHeader, { onFilterClear: () => setFilter(""), onFilterStart: (newFilter) => setFilter(newFilter), onSelectedChanged: () => { }, density: density, children: headerButtons
|
|
36
|
+
? headerButtons.map((btn, index) => (0, jsx_runtime_1.jsx)(react_1.Fragment, { children: btn({ viewport, categories }) }, index))
|
|
37
|
+
: [
|
|
38
|
+
(0, jsx_runtime_1.jsx)(CategoriesTreeButtons_1.ShowAllButton, { viewport: viewport, categories: categories, density: density }, "show-all-btn"),
|
|
39
|
+
(0, jsx_runtime_1.jsx)(CategoriesTreeButtons_1.HideAllButton, { viewport: viewport, categories: categories, density: density }, "hide-all-btn"),
|
|
40
|
+
(0, jsx_runtime_1.jsx)(CategoriesTreeButtons_1.InvertAllButton, { viewport: viewport, categories: categories, density: density }, "invert-all-btn"),
|
|
41
|
+
] }), (0, jsx_runtime_1.jsx)(AutoSizer_1.AutoSizer, { children: ({ width, height }) => ((0, jsx_runtime_1.jsx)(CategoriesTree_1.StatelessCategoriesTree, { ...treeProps, imodel: iModel, categories: categories, activeView: viewport, width: width, height: height, filter: filter })) })] }) }));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=CategoriesTreeComponent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoriesTreeComponent.js","sourceRoot":"","sources":["../../../../../../src/components/trees/stateless/categories-tree/CategoriesTreeComponent.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,iCAA2C;AAC3C,oDAAkF;AAClF,wDAAiD;AACjD,0FAAiF;AACjF,gEAA6D;AAC7D,wDAAqD;AACrD,qFAA0G;AAC1G,6FAA8E;AAC9E,qDAA2D;AAe3D;;;GAGG;AACI,MAAM,gCAAgC,GAAG,CAAC,KAA4C,EAAE,EAAE;IAC/F,MAAM,MAAM,GAAG,IAAA,uCAAyB,GAAE,CAAC;IAC3C,MAAM,QAAQ,GAAG,IAAA,+BAAiB,GAAE,CAAC;IAErC,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE;QACxB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,uBAAC,2BAA2B,OAAK,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;AACxF,CAAC,CAAC;AATW,QAAA,gCAAgC,oCAS3C;AAEF,SAAS,2BAA2B,CAAC,EACnC,MAAM,EACN,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,GAAG,SAAS,EACmF;IAC/F,MAAM,UAAU,GAAG,IAAA,yCAAa,EAAC,yBAAS,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC1E,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IACzC,MAAM,OAA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ourcesContent":["/*---------------------------------------------------------------------------------------------\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,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.CategoriesTreeDefinition = void 0;
|
|
8
|
+
const presentation_hierarchies_1 = require("@itwin/presentation-hierarchies");
|
|
9
|
+
const presentation_shared_1 = require("@itwin/presentation-shared");
|
|
10
|
+
class CategoriesTreeDefinition {
|
|
11
|
+
constructor(props) {
|
|
12
|
+
this._impl = (0, presentation_hierarchies_1.createClassBasedHierarchyDefinition)({
|
|
13
|
+
classHierarchyInspector: props.imodelAccess,
|
|
14
|
+
hierarchy: {
|
|
15
|
+
rootNodes: async (requestProps) => this.createRootHierarchyLevelDefinition({ ...requestProps, viewType: props.viewType }),
|
|
16
|
+
childNodes: [
|
|
17
|
+
{
|
|
18
|
+
parentNodeClassName: "BisCore.Category",
|
|
19
|
+
definitions: async (requestProps) => this.createSubcategoryQuery(requestProps),
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
this._selectQueryFactory = (0, presentation_hierarchies_1.createNodesQueryClauseFactory)({ imodelAccess: props.imodelAccess });
|
|
25
|
+
this._nodeLabelSelectClauseFactory = (0, presentation_shared_1.createBisInstanceLabelSelectClauseFactory)({ classHierarchyInspector: props.imodelAccess });
|
|
26
|
+
}
|
|
27
|
+
async defineHierarchyLevel(props) {
|
|
28
|
+
return this._impl.defineHierarchyLevel(props);
|
|
29
|
+
}
|
|
30
|
+
async createRootHierarchyLevelDefinition(props) {
|
|
31
|
+
const { categoryClass, categoryElementClass } = getClassesByView(props.viewType);
|
|
32
|
+
const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({
|
|
33
|
+
filter: props.instanceFilter,
|
|
34
|
+
contentClass: { fullName: categoryClass, alias: "this" },
|
|
35
|
+
});
|
|
36
|
+
return [
|
|
37
|
+
{
|
|
38
|
+
fullClassName: categoryClass,
|
|
39
|
+
query: {
|
|
40
|
+
ecsql: `
|
|
41
|
+
SELECT
|
|
42
|
+
${await this._selectQueryFactory.createSelectClause({
|
|
43
|
+
ecClassId: { selector: presentation_shared_1.ECSql.createRawPropertyValueSelector("this", "ECClassId") },
|
|
44
|
+
ecInstanceId: { selector: "this.ECInstanceId" },
|
|
45
|
+
nodeLabel: {
|
|
46
|
+
selector: await this._nodeLabelSelectClauseFactory.createSelectClause({
|
|
47
|
+
classAlias: "this",
|
|
48
|
+
className: categoryClass,
|
|
49
|
+
}),
|
|
50
|
+
},
|
|
51
|
+
hasChildren: {
|
|
52
|
+
selector: `
|
|
53
|
+
IFNULL((
|
|
54
|
+
SELECT 1
|
|
55
|
+
FROM (
|
|
56
|
+
SELECT COUNT(1) AS ChildCount
|
|
57
|
+
FROM BisCore.SubCategory sc
|
|
58
|
+
WHERE sc.Parent.Id = this.ECInstanceId
|
|
59
|
+
)
|
|
60
|
+
WHERE ChildCount > 1
|
|
61
|
+
), 0)
|
|
62
|
+
`,
|
|
63
|
+
},
|
|
64
|
+
extendedData: {
|
|
65
|
+
description: { selector: "this.Description" },
|
|
66
|
+
},
|
|
67
|
+
supportsFiltering: true,
|
|
68
|
+
})}
|
|
69
|
+
FROM ${instanceFilterClauses.from} this
|
|
70
|
+
${instanceFilterClauses.joins}
|
|
71
|
+
JOIN BisCore.Model m ON m.ECInstanceId = this.Model.Id
|
|
72
|
+
WHERE
|
|
73
|
+
NOT this.IsPrivate
|
|
74
|
+
AND (NOT m.IsPrivate OR m.ECClassId IS (BisCore.DictionaryModel))
|
|
75
|
+
AND EXISTS (SELECT 1 FROM ${categoryElementClass} e WHERE e.Category.Id = this.ECInstanceId)
|
|
76
|
+
${instanceFilterClauses.where ? `AND ${instanceFilterClauses.where}` : ""}
|
|
77
|
+
`,
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
async createSubcategoryQuery({ parentNodeInstanceIds: elementIds, instanceFilter, }) {
|
|
83
|
+
const instanceFilterClauses = await this._selectQueryFactory.createFilterClauses({
|
|
84
|
+
filter: instanceFilter,
|
|
85
|
+
contentClass: { fullName: "BisCore.SubCategory", alias: "this" },
|
|
86
|
+
});
|
|
87
|
+
return [
|
|
88
|
+
{
|
|
89
|
+
fullClassName: "BisCore.SubCategory",
|
|
90
|
+
query: {
|
|
91
|
+
ecsql: `
|
|
92
|
+
SELECT
|
|
93
|
+
${await this._selectQueryFactory.createSelectClause({
|
|
94
|
+
ecClassId: { selector: "this.ECClassId" },
|
|
95
|
+
ecInstanceId: { selector: "this.ECInstanceId" },
|
|
96
|
+
nodeLabel: {
|
|
97
|
+
selector: await this._nodeLabelSelectClauseFactory.createSelectClause({
|
|
98
|
+
classAlias: "this",
|
|
99
|
+
className: "BisCore.SubCategory",
|
|
100
|
+
}),
|
|
101
|
+
},
|
|
102
|
+
extendedData: {
|
|
103
|
+
categoryId: { selector: "printf('0x%x', this.Parent.Id)" },
|
|
104
|
+
},
|
|
105
|
+
supportsFiltering: false,
|
|
106
|
+
})}
|
|
107
|
+
FROM ${instanceFilterClauses.from} this
|
|
108
|
+
${instanceFilterClauses.joins}
|
|
109
|
+
WHERE
|
|
110
|
+
NOT this.IsPrivate AND this.Parent.Id IN (${elementIds.map(() => "?").join(",")})
|
|
111
|
+
${instanceFilterClauses.where ? `AND ${instanceFilterClauses.where}` : ""}
|
|
112
|
+
`,
|
|
113
|
+
bindings: elementIds.map((id) => ({ type: "id", value: id })),
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
];
|
|
117
|
+
}
|
|
118
|
+
static async createInstanceKeyPaths(props) {
|
|
119
|
+
const labelsFactory = (0, presentation_shared_1.createBisInstanceLabelSelectClauseFactory)({ classHierarchyInspector: props.imodelAccess });
|
|
120
|
+
return createInstanceKeyPathsFromInstanceLabel({ ...props, labelsFactory });
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.CategoriesTreeDefinition = CategoriesTreeDefinition;
|
|
124
|
+
function getClassesByView(viewType) {
|
|
125
|
+
return viewType === "2d"
|
|
126
|
+
? { categoryClass: "BisCore.DrawingCategory", categoryElementClass: "BisCore:GeometricElement2d" }
|
|
127
|
+
: { categoryClass: "BisCore.SpatialCategory", categoryElementClass: "BisCore:GeometricElement3d" };
|
|
128
|
+
}
|
|
129
|
+
async function createInstanceKeyPathsFromInstanceLabel(props) {
|
|
130
|
+
const { categoryClass, categoryElementClass } = getClassesByView(props.viewType);
|
|
131
|
+
const reader = props.imodelAccess.createQueryReader({
|
|
132
|
+
ctes: [
|
|
133
|
+
`RootCategories(ClassName, ECInstanceId, ChildCount) as (
|
|
134
|
+
SELECT
|
|
135
|
+
ec_classname(this.ECClassId, 's.c'),
|
|
136
|
+
this.ECInstanceId,
|
|
137
|
+
COUNT(sc.ECInstanceId)
|
|
138
|
+
FROM ${categoryClass} this
|
|
139
|
+
JOIN BisCore.Model m ON m.ECInstanceId = this.Model.Id
|
|
140
|
+
JOIN BisCore.SubCategory sc ON sc.Parent.Id = this.ECInstanceId
|
|
141
|
+
WHERE
|
|
142
|
+
NOT this.IsPrivate
|
|
143
|
+
AND (NOT m.IsPrivate OR m.ECClassId IS (BisCore.DictionaryModel))
|
|
144
|
+
AND EXISTS (SELECT 1 FROM ${categoryElementClass} e WHERE e.Category.Id = this.ECInstanceId)
|
|
145
|
+
GROUP BY this.ECInstanceId
|
|
146
|
+
)`,
|
|
147
|
+
`SubCategoriesWithLabels(ClassName, ECInstanceId, ParentId, DisplayLabel) as (
|
|
148
|
+
SELECT
|
|
149
|
+
ec_classname(this.ECClassId, 's.c'),
|
|
150
|
+
this.ECInstanceId,
|
|
151
|
+
this.Parent.Id,
|
|
152
|
+
${await props.labelsFactory.createSelectClause({
|
|
153
|
+
classAlias: "this",
|
|
154
|
+
className: "BisCore.SubCategory",
|
|
155
|
+
})}
|
|
156
|
+
FROM BisCore.SubCategory this
|
|
157
|
+
WHERE NOT this.IsPrivate
|
|
158
|
+
)`,
|
|
159
|
+
],
|
|
160
|
+
ecsql: `
|
|
161
|
+
SELECT
|
|
162
|
+
c.ClassName AS CategoryClass,
|
|
163
|
+
c.ECInstanceId AS CategoryId,
|
|
164
|
+
IIF(c.ChildCount > 1, sc.ClassName, NULL) AS SubcategoryClass,
|
|
165
|
+
IIF(c.ChildCount > 1, sc.ECInstanceId, NULL) AS SubcategoryId
|
|
166
|
+
FROM RootCategories c
|
|
167
|
+
JOIN SubCategoriesWithLabels sc ON sc.ParentId = c.ECInstanceId
|
|
168
|
+
WHERE sc.DisplayLabel LIKE '%' || ? || '%'
|
|
169
|
+
`,
|
|
170
|
+
bindings: [{ type: "string", value: props.label }],
|
|
171
|
+
}, { restartToken: "tree-widget/categories-tree/filter-by-label-query" });
|
|
172
|
+
const paths = new Array();
|
|
173
|
+
for await (const row of reader) {
|
|
174
|
+
const path = [{ className: row.CategoryClass, id: row.CategoryId }];
|
|
175
|
+
row.SubcategoryId && path.push({ className: row.SubcategoryClass, id: row.SubcategoryId });
|
|
176
|
+
paths.push(path);
|
|
177
|
+
}
|
|
178
|
+
return paths;
|
|
179
|
+
}
|
|
180
|
+
//# 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;;;AAEhG,8EAAqH;AACrH,oEAA8F;AAyB9F,MAAa,wBAAwB;IAKnC,YAAmB,KAAoC;QACrD,IAAI,CAAC,KAAK,GAAG,IAAA,8DAAmC,EAAC;YAC/C,uBAAuB,EAAE,KAAK,CAAC,YAAY;YAC3C,SAAS,EAAE;gBACT,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,kCAAkC,CAAC,EAAE,GAAG,YAAY,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACzH,UAAU,EAAE;oBACV;wBACE,mBAAmB,EAAE,kBAAkB;wBACvC,WAAW,EAAE,KAAK,EAAE,YAAwD,EAAE,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,YAAY,CAAC;qBAC3H;iBACF;aACF;SACF,CAAC,CAAC;QACH,IAAI,CAAC,mBAAmB,GAAG,IAAA,wDAA6B,EAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC;QAC/F,IAAI,CAAC,6BAA6B,GAAG,IAAA,+DAAyC,EAAC,EAAE,uBAAuB,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC;IAClI,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,KAAgC;QAChE,OAAO,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAEO,KAAK,CAAC,kCAAkC,CAAC,KAAgE;QAC/G,MAAM,EAAE,aAAa,EAAE,oBAAoB,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,QA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B,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
|