@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
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
import { useEffect, useMemo, useState } from "react";
|
|
7
|
+
import { SvgVisibilityHalf, SvgVisibilityHide, SvgVisibilityShow } from "@itwin/itwinui-icons-react";
|
|
8
|
+
import { Button, IconButton } from "@itwin/itwinui-react";
|
|
9
|
+
import { TreeWidget } from "../../../TreeWidget";
|
|
10
|
+
import { areAllModelsVisible, hideAllModels, invertAllModels, showAllModels, toggleModels } from "./ModelsVisibilityHandler";
|
|
11
|
+
import { queryModelsForHeaderActions } from "./Utils";
|
|
12
|
+
/** @internal */
|
|
13
|
+
export function useAvailableModels(imodel) {
|
|
14
|
+
const [availableModels, setAvailableModels] = useState([]);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
queryModelsForHeaderActions(imodel)
|
|
17
|
+
.then((modelInfos) => {
|
|
18
|
+
setAvailableModels(modelInfos);
|
|
19
|
+
})
|
|
20
|
+
.catch((_e) => {
|
|
21
|
+
setAvailableModels([]);
|
|
22
|
+
});
|
|
23
|
+
}, [imodel]);
|
|
24
|
+
return availableModels;
|
|
25
|
+
}
|
|
26
|
+
/** @internal */
|
|
27
|
+
export function ShowAllButton(props) {
|
|
28
|
+
return (_jsx(IconButton, { size: props.density === "enlarged" ? "large" : "small", styleType: "borderless", title: TreeWidget.translate("showAll"), onClick: () => {
|
|
29
|
+
props.onFeatureUsed?.("showall");
|
|
30
|
+
void showAllModels(props.models.map((model) => model.id), props.viewport);
|
|
31
|
+
}, children: _jsx(SvgVisibilityShow, {}) }));
|
|
32
|
+
}
|
|
33
|
+
/** @internal */
|
|
34
|
+
export function HideAllButton(props) {
|
|
35
|
+
return (_jsx(IconButton, { size: props.density === "enlarged" ? "large" : "small", styleType: "borderless", title: TreeWidget.translate("hideAll"), onClick: () => {
|
|
36
|
+
props.onFeatureUsed?.("hideall");
|
|
37
|
+
void hideAllModels(props.models.map((model) => model.id), props.viewport);
|
|
38
|
+
}, children: _jsx(SvgVisibilityHide, {}) }));
|
|
39
|
+
}
|
|
40
|
+
/** @internal */
|
|
41
|
+
export function InvertButton(props) {
|
|
42
|
+
return (_jsx(IconButton, { size: props.density === "enlarged" ? "large" : "small", styleType: "borderless", title: TreeWidget.translate("invert"), onClick: () => {
|
|
43
|
+
props.onFeatureUsed?.("invert");
|
|
44
|
+
void invertAllModels(props.models.map((model) => model.id), props.viewport);
|
|
45
|
+
}, children: _jsx(SvgVisibilityHalf, {}) }));
|
|
46
|
+
}
|
|
47
|
+
/** @internal */
|
|
48
|
+
export function View2DButton(props) {
|
|
49
|
+
const models2d = useMemo(() => {
|
|
50
|
+
return props.models.filter((model) => model.isPlanProjection).map((model) => model.id);
|
|
51
|
+
}, [props.models]);
|
|
52
|
+
const [is2dToggleActive, setIs2dToggleActive] = useState(false);
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
setIs2dToggleActive(areAllModelsVisible(models2d, props.viewport));
|
|
55
|
+
return props.viewport.onViewedModelsChanged.addListener((vp) => setIs2dToggleActive(areAllModelsVisible(models2d, vp)));
|
|
56
|
+
}, [models2d, props.viewport]);
|
|
57
|
+
return (_jsx(Button, { size: props.density === "enlarged" ? "large" : "small", styleType: "borderless", title: TreeWidget.translate("toggle2DViews"), onClick: () => {
|
|
58
|
+
props.onFeatureUsed?.("view2d");
|
|
59
|
+
void toggleModels(models2d, is2dToggleActive, props.viewport);
|
|
60
|
+
}, disabled: models2d.length === 0, endIcon: is2dToggleActive ? _jsx(SvgVisibilityShow, {}) : _jsx(SvgVisibilityHide, {}), children: TreeWidget.translate("label2D") }));
|
|
61
|
+
}
|
|
62
|
+
/** @internal */
|
|
63
|
+
export function View3DButton(props) {
|
|
64
|
+
const models3d = useMemo(() => {
|
|
65
|
+
return props.models.filter((model) => !model.isPlanProjection).map((model) => model.id);
|
|
66
|
+
}, [props.models]);
|
|
67
|
+
const [is3dToggleActive, setIs3dToggleActive] = useState(false);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
setIs3dToggleActive(areAllModelsVisible(models3d, props.viewport));
|
|
70
|
+
return props.viewport.onViewedModelsChanged.addListener((vp) => setIs3dToggleActive(areAllModelsVisible(models3d, vp)));
|
|
71
|
+
}, [models3d, props.viewport]);
|
|
72
|
+
return (_jsx(Button, { size: props.density === "enlarged" ? "large" : "small", styleType: "borderless", title: TreeWidget.translate("toggle3DViews"), onClick: () => {
|
|
73
|
+
props.onFeatureUsed?.("view3d");
|
|
74
|
+
void toggleModels(models3d, is3dToggleActive, props.viewport);
|
|
75
|
+
}, disabled: models3d.length === 0, endIcon: is3dToggleActive ? _jsx(SvgVisibilityShow, {}) : _jsx(SvgVisibilityHide, {}), children: TreeWidget.translate("label3D") }));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=ModelsTreeButtons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModelsTreeButtons.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/ModelsTreeButtons.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACrG,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC7H,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AAwBtD,gBAAgB;AAChB,MAAM,UAAU,kBAAkB,CAAC,MAAwB;IACzD,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAc,EAAE,CAAC,CAAC;IAExE,SAAS,CAAC,GAAG,EAAE;QACb,2BAA2B,CAAC,MAAM,CAAC;aAChC,IAAI,CAAC,CAAC,UAAuB,EAAE,EAAE;YAChC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QACjC,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE;YACZ,kBAAkB,CAAC,EAAE,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACP,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,KAAkC;IAC9D,OAAO,CACL,KAAC,UAAU,IACT,IAAI,EAAE,KAAK,CAAC,OAAO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EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE/B,OAAO,CACL,KAAC,MAAM,IACL,IAAI,EAAE,KAAK,CAAC,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EACtD,SAAS,EAAC,YAAY,EACtB,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,eAAe,CAAC,EAC5C,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,CAAC,aAAa,EAAE,CAAC,QAAQ,CAAC,CAAC;YAChC,KAAK,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChE,CAAC,EACD,QAAQ,EAAE,QAAQ,CAAC,MAAM,KAAK,CAAC,EAC/B,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAC,iBAAiB,KAAG,CAAC,CAAC,CAAC,KAAC,iBAAiB,KAAG,YAExE,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,GACzB,CACV,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useEffect, useMemo, useState } from \"react\";\nimport { SvgVisibilityHalf, SvgVisibilityHide, SvgVisibilityShow } from \"@itwin/itwinui-icons-react\";\nimport { Button, IconButton } from \"@itwin/itwinui-react\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { areAllModelsVisible, hideAllModels, invertAllModels, showAllModels, toggleModels } from \"./ModelsVisibilityHandler\";\nimport { queryModelsForHeaderActions } from \"./Utils\";\n\nimport type { TreeHeaderButtonProps } from \"../../tree-header/TreeHeader\";\nimport type { IModelConnection, Viewport } from \"@itwin/core-frontend\";\n\n/**\n * Information about a single Model.\n * @public\n */\nexport interface ModelInfo {\n id: string;\n isPlanProjection?: boolean;\n}\n\n/**\n * Props that get passed to [[ModelsTreeComponent]] header button renderer.\n * @see ModelTreeComponentProps.headerButtons\n * @public\n */\nexport interface ModelsTreeHeaderButtonProps extends TreeHeaderButtonProps {\n /** A list of models available in the iModel. */\n models: ModelInfo[];\n}\n\n/** @internal */\nexport function useAvailableModels(imodel: IModelConnection) {\n const [availableModels, setAvailableModels] = useState<ModelInfo[]>([]);\n\n useEffect(() => {\n queryModelsForHeaderActions(imodel)\n .then((modelInfos: ModelInfo[]) => {\n setAvailableModels(modelInfos);\n })\n .catch((_e) => {\n setAvailableModels([]);\n });\n }, [imodel]);\n\n return availableModels;\n}\n\n/** @internal */\nexport function ShowAllButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"showAll\")}\n onClick={() => {\n props.onFeatureUsed?.(\"showall\");\n void showAllModels(\n props.models.map((model) => model.id),\n props.viewport,\n );\n }}\n >\n <SvgVisibilityShow />\n </IconButton>\n );\n}\n\n/** @internal */\nexport function HideAllButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"hideAll\")}\n onClick={() => {\n props.onFeatureUsed?.(\"hideall\");\n void hideAllModels(\n props.models.map((model) => model.id),\n props.viewport,\n );\n }}\n >\n <SvgVisibilityHide />\n </IconButton>\n );\n}\n\n/** @internal */\nexport function InvertButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"invert\")}\n onClick={() => {\n props.onFeatureUsed?.(\"invert\");\n void invertAllModels(\n props.models.map((model) => model.id),\n props.viewport,\n );\n }}\n >\n <SvgVisibilityHalf />\n </IconButton>\n );\n}\n\n/** @internal */\nexport function View2DButton(props: ModelsTreeHeaderButtonProps) {\n const models2d = useMemo(() => {\n return props.models.filter((model) => model.isPlanProjection).map((model) => model.id);\n }, [props.models]);\n\n const [is2dToggleActive, setIs2dToggleActive] = useState(false);\n\n useEffect(() => {\n setIs2dToggleActive(areAllModelsVisible(models2d, props.viewport));\n return props.viewport.onViewedModelsChanged.addListener((vp: Viewport) => setIs2dToggleActive(areAllModelsVisible(models2d, vp)));\n }, [models2d, props.viewport]);\n\n return (\n <Button\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"toggle2DViews\")}\n onClick={() => {\n props.onFeatureUsed?.(\"view2d\");\n void toggleModels(models2d, is2dToggleActive, props.viewport);\n }}\n disabled={models2d.length === 0}\n endIcon={is2dToggleActive ? <SvgVisibilityShow /> : <SvgVisibilityHide />}\n >\n {TreeWidget.translate(\"label2D\")}\n </Button>\n );\n}\n\n/** @internal */\nexport function View3DButton(props: ModelsTreeHeaderButtonProps) {\n const models3d = useMemo(() => {\n return props.models.filter((model) => !model.isPlanProjection).map((model) => model.id);\n }, [props.models]);\n\n const [is3dToggleActive, setIs3dToggleActive] = useState(false);\n\n useEffect(() => {\n setIs3dToggleActive(areAllModelsVisible(models3d, props.viewport));\n return props.viewport.onViewedModelsChanged.addListener((vp: Viewport) => setIs3dToggleActive(areAllModelsVisible(models3d, vp)));\n }, [models3d, props.viewport]);\n\n return (\n <Button\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"toggle3DViews\")}\n onClick={() => {\n props.onFeatureUsed?.(\"view3d\");\n void toggleModels(models3d, is3dToggleActive, props.viewport);\n }}\n disabled={models3d.length === 0}\n endIcon={is3dToggleActive ? <SvgVisibilityShow /> : <SvgVisibilityHide />}\n >\n {TreeWidget.translate(\"label3D\")}\n </Button>\n );\n}\n"]}
|
|
@@ -1,24 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "../VisibilityTreeBase.scss";
|
|
3
|
-
import
|
|
3
|
+
import { HideAllButton, InvertButton, ShowAllButton, View2DButton, View3DButton } from "./ModelsTreeButtons";
|
|
4
4
|
import type { ModelsTreeProps } from "./ModelsTree";
|
|
5
|
-
|
|
6
|
-
* Information about a single Model.
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
export interface ModelInfo {
|
|
10
|
-
id: string;
|
|
11
|
-
isPlanProjection?: boolean;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Props that get passed to [[ModelsTreeComponent]] header button renderer.
|
|
15
|
-
* @see ModelTreeComponentProps.headerButtons
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
export interface ModelsTreeHeaderButtonProps extends TreeHeaderButtonProps {
|
|
19
|
-
/** A list of models available in the iModel. */
|
|
20
|
-
models: ModelInfo[];
|
|
21
|
-
}
|
|
5
|
+
import type { ModelsTreeHeaderButtonProps } from "./ModelsTreeButtons";
|
|
22
6
|
/**
|
|
23
7
|
* Props for [[ModelsTreeComponent]].
|
|
24
8
|
* @public
|
|
@@ -81,10 +65,4 @@ export declare const ModelsTreeComponent: {
|
|
|
81
65
|
*/
|
|
82
66
|
getLabel(): string;
|
|
83
67
|
};
|
|
84
|
-
declare function ShowAllButton(props: ModelsTreeHeaderButtonProps): JSX.Element;
|
|
85
|
-
declare function HideAllButton(props: ModelsTreeHeaderButtonProps): JSX.Element;
|
|
86
|
-
declare function InvertButton(props: ModelsTreeHeaderButtonProps): JSX.Element;
|
|
87
|
-
declare function View2DButton(props: ModelsTreeHeaderButtonProps): JSX.Element;
|
|
88
|
-
declare function View3DButton(props: ModelsTreeHeaderButtonProps): JSX.Element;
|
|
89
|
-
export {};
|
|
90
68
|
//# sourceMappingURL=ModelsTreeComponent.d.ts.map
|
|
@@ -5,17 +5,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
import "../VisibilityTreeBase.scss";
|
|
7
7
|
import classNames from "classnames";
|
|
8
|
-
import { Fragment,
|
|
8
|
+
import { Fragment, useMemo } from "react";
|
|
9
9
|
import { useActiveIModelConnection, useActiveViewport } from "@itwin/appui-react";
|
|
10
|
-
import { SvgVisibilityHalf, SvgVisibilityHide, SvgVisibilityShow } from "@itwin/itwinui-icons-react";
|
|
11
|
-
import { Button, IconButton } from "@itwin/itwinui-react";
|
|
12
10
|
import { TreeWidget } from "../../../TreeWidget";
|
|
13
11
|
import { TreeHeader } from "../../tree-header/TreeHeader";
|
|
14
12
|
import { useTreeFilteringState } from "../../TreeFilteringState";
|
|
15
13
|
import { AutoSizer } from "../../utils/AutoSizer";
|
|
16
14
|
import { ModelsTree } from "./ModelsTree";
|
|
17
|
-
import {
|
|
18
|
-
import { queryModelsForHeaderActions } from "./Utils";
|
|
15
|
+
import { HideAllButton, InvertButton, ShowAllButton, useAvailableModels, View2DButton, View3DButton } from "./ModelsTreeButtons";
|
|
19
16
|
/**
|
|
20
17
|
* A component that renders [[ModelsTree]] and a header with filtering capabilities
|
|
21
18
|
* and header buttons.
|
|
@@ -64,75 +61,26 @@ ModelsTreeComponent.id = "models-tree";
|
|
|
64
61
|
* @public
|
|
65
62
|
*/
|
|
66
63
|
ModelsTreeComponent.getLabel = () => TreeWidget.translate("models");
|
|
67
|
-
function ModelsTreeComponentImpl(
|
|
68
|
-
const
|
|
69
|
-
const
|
|
64
|
+
function ModelsTreeComponentImpl({ iModel, viewport, headerButtons, ...treeProps }) {
|
|
65
|
+
const availableModels = useAvailableModels(iModel);
|
|
66
|
+
const density = treeProps.density;
|
|
70
67
|
const { searchOptions, filterString, onFilterApplied } = useTreeFilteringState();
|
|
71
|
-
const contentClassName = classNames("tree-widget-tree-content",
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
queryModelsForHeaderActions(iModel)
|
|
74
|
-
.then((modelInfos) => {
|
|
75
|
-
setAvailableModels(modelInfos);
|
|
76
|
-
})
|
|
77
|
-
.catch((_e) => {
|
|
78
|
-
setAvailableModels([]);
|
|
79
|
-
});
|
|
80
|
-
}, [iModel]);
|
|
68
|
+
const contentClassName = classNames("tree-widget-tree-content", density === "enlarged" && "enlarge");
|
|
81
69
|
const filterInfo = useMemo(() => ({ filter: filterString, activeMatchIndex: searchOptions.activeMatchIndex }), [filterString, searchOptions.activeMatchIndex]);
|
|
82
|
-
|
|
83
|
-
|
|
70
|
+
// istanbul ignore next
|
|
71
|
+
const onModelsTreeFeatureUsed = (feature) => {
|
|
72
|
+
if (treeProps.onFeatureUsed) {
|
|
73
|
+
treeProps.onFeatureUsed(`${ModelsTreeComponent.id}-${feature}`);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return (_jsxs("div", { className: "tree-widget-tree-with-header", children: [_jsx(TreeHeader, { onFilterClear: searchOptions.onFilterCancel, onFilterStart: searchOptions.onFilterStart, onSelectedChanged: searchOptions.onResultSelectedChanged, resultCount: searchOptions.matchedResultCount, selectedIndex: searchOptions.activeMatchIndex, density: density, children: headerButtons
|
|
77
|
+
? headerButtons.map((btn, index) => (_jsx(Fragment, { children: btn({ viewport, models: availableModels, density: treeProps.density, onFeatureUsed: onModelsTreeFeatureUsed }) }, index)))
|
|
84
78
|
: [
|
|
85
|
-
_jsx(ShowAllButton, { viewport: viewport, models: availableModels, density:
|
|
86
|
-
_jsx(HideAllButton, { viewport: viewport, models: availableModels, density:
|
|
87
|
-
_jsx(InvertButton, { viewport: viewport, models: availableModels, density:
|
|
88
|
-
_jsx(View2DButton, { viewport: viewport, models: availableModels, density:
|
|
89
|
-
_jsx(View3DButton, { viewport: viewport, models: availableModels, density:
|
|
90
|
-
] }), _jsx("div", { className: contentClassName, children: _jsx(AutoSizer, { children: ({ width, height }) => (_jsx(ModelsTree, { ...
|
|
91
|
-
}
|
|
92
|
-
function ShowAllButton(props) {
|
|
93
|
-
return (_jsx(IconButton, { size: props.density === "enlarged" ? "large" : "small", styleType: "borderless", title: TreeWidget.translate("showAll"), onClick: () => {
|
|
94
|
-
props.onFeatureUsed?.(`${ModelsTreeComponent.id}-showall`);
|
|
95
|
-
void showAllModels(props.models.map((model) => model.id), props.viewport);
|
|
96
|
-
}, children: _jsx(SvgVisibilityShow, {}) }));
|
|
97
|
-
}
|
|
98
|
-
function HideAllButton(props) {
|
|
99
|
-
return (_jsx(IconButton, { size: props.density === "enlarged" ? "large" : "small", styleType: "borderless", title: TreeWidget.translate("hideAll"), onClick: () => {
|
|
100
|
-
props.onFeatureUsed?.(`${ModelsTreeComponent.id}-hideall`);
|
|
101
|
-
void hideAllModels(props.models.map((model) => model.id), props.viewport);
|
|
102
|
-
}, children: _jsx(SvgVisibilityHide, {}) }));
|
|
103
|
-
}
|
|
104
|
-
function InvertButton(props) {
|
|
105
|
-
return (_jsx(IconButton, { size: props.density === "enlarged" ? "large" : "small", styleType: "borderless", title: TreeWidget.translate("invert"), onClick: () => {
|
|
106
|
-
props.onFeatureUsed?.(`${ModelsTreeComponent.id}-invert`);
|
|
107
|
-
void invertAllModels(props.models.map((model) => model.id), props.viewport);
|
|
108
|
-
}, children: _jsx(SvgVisibilityHalf, {}) }));
|
|
109
|
-
}
|
|
110
|
-
function View2DButton(props) {
|
|
111
|
-
const models2d = useMemo(() => {
|
|
112
|
-
return props.models.filter((model) => model.isPlanProjection).map((model) => model.id);
|
|
113
|
-
}, [props.models]);
|
|
114
|
-
const [is2dToggleActive, setIs2dToggleActive] = useState(false);
|
|
115
|
-
useEffect(() => {
|
|
116
|
-
setIs2dToggleActive(areAllModelsVisible(models2d, props.viewport));
|
|
117
|
-
return props.viewport.onViewedModelsChanged.addListener((vp) => setIs2dToggleActive(areAllModelsVisible(models2d, vp)));
|
|
118
|
-
}, [models2d, props.viewport]);
|
|
119
|
-
return (_jsx(Button, { size: props.density === "enlarged" ? "large" : "small", styleType: "borderless", title: TreeWidget.translate("toggle2DViews"), onClick: () => {
|
|
120
|
-
props.onFeatureUsed?.(`${ModelsTreeComponent.id}-view2d`);
|
|
121
|
-
void toggleModels(models2d, is2dToggleActive, props.viewport);
|
|
122
|
-
}, disabled: models2d.length === 0, endIcon: is2dToggleActive ? _jsx(SvgVisibilityShow, {}) : _jsx(SvgVisibilityHide, {}), children: TreeWidget.translate("label2D") }));
|
|
123
|
-
}
|
|
124
|
-
function View3DButton(props) {
|
|
125
|
-
const models3d = useMemo(() => {
|
|
126
|
-
return props.models.filter((model) => !model.isPlanProjection).map((model) => model.id);
|
|
127
|
-
}, [props.models]);
|
|
128
|
-
const [is3dToggleActive, setIs3dToggleActive] = useState(false);
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
setIs3dToggleActive(areAllModelsVisible(models3d, props.viewport));
|
|
131
|
-
return props.viewport.onViewedModelsChanged.addListener((vp) => setIs3dToggleActive(areAllModelsVisible(models3d, vp)));
|
|
132
|
-
}, [models3d, props.viewport]);
|
|
133
|
-
return (_jsx(Button, { size: props.density === "enlarged" ? "large" : "small", styleType: "borderless", title: TreeWidget.translate("toggle3DViews"), onClick: () => {
|
|
134
|
-
props.onFeatureUsed?.(`${ModelsTreeComponent.id}-view3d`);
|
|
135
|
-
void toggleModels(models3d, is3dToggleActive, props.viewport);
|
|
136
|
-
}, disabled: models3d.length === 0, endIcon: is3dToggleActive ? _jsx(SvgVisibilityShow, {}) : _jsx(SvgVisibilityHide, {}), children: TreeWidget.translate("label3D") }));
|
|
79
|
+
_jsx(ShowAllButton, { viewport: viewport, models: availableModels, density: treeProps.density, onFeatureUsed: onModelsTreeFeatureUsed }, "show-all-btn"),
|
|
80
|
+
_jsx(HideAllButton, { viewport: viewport, models: availableModels, density: treeProps.density, onFeatureUsed: onModelsTreeFeatureUsed }, "hide-all-btn"),
|
|
81
|
+
_jsx(InvertButton, { viewport: viewport, models: availableModels, density: treeProps.density, onFeatureUsed: onModelsTreeFeatureUsed }, "invert-all-btn"),
|
|
82
|
+
_jsx(View2DButton, { viewport: viewport, models: availableModels, density: treeProps.density, onFeatureUsed: onModelsTreeFeatureUsed }, "view-2d-btn"),
|
|
83
|
+
_jsx(View3DButton, { viewport: viewport, models: availableModels, density: treeProps.density, onFeatureUsed: onModelsTreeFeatureUsed }, "view-3d-btn"),
|
|
84
|
+
] }), _jsx("div", { className: contentClassName, children: _jsx(AutoSizer, { children: ({ width, height }) => (_jsx(ModelsTree, { ...treeProps, iModel: iModel, activeView: viewport, width: width, height: height, filterInfo: filterInfo, onFilterApplied: onFilterApplied })) }) })] }));
|
|
137
85
|
}
|
|
138
86
|
//# sourceMappingURL=ModelsTreeComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelsTreeComponent.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/ModelsTreeComponent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,4BAA4B,CAAC;AACpC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACrG,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC7H,OAAO,EAAE,2BAA2B,EAAE,MAAM,SAAS,CAAC;AA4CtD;;;;GAIG;AACH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AO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EACtD,SAAS,EAAC,YAAY,EACtB,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,eAAe,CAAC,EAC5C,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,CAAC,aAAa,EAAE,CAAC,GAAG,mBAAmB,CAAC,EAAE,SAAS,CAAC,CAAC;YAC1D,KAAK,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChE,CAAC,EACD,QAAQ,EAAE,QAAQ,CAAC,MAAM,KAAK,CAAC,EAC/B,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAC,iBAAiB,KAAG,CAAC,CAAC,CAAC,KAAC,iBAAiB,KAAG,YAExE,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,GACzB,CACV,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport \"../VisibilityTreeBase.scss\";\nimport classNames from \"classnames\";\nimport { Fragment, useEffect, useMemo, useState } from \"react\";\nimport { useActiveIModelConnection, useActiveViewport } from \"@itwin/appui-react\";\nimport { SvgVisibilityHalf, SvgVisibilityHide, SvgVisibilityShow } from \"@itwin/itwinui-icons-react\";\nimport { Button, IconButton } from \"@itwin/itwinui-react\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { TreeHeader } from \"../../tree-header/TreeHeader\";\nimport { useTreeFilteringState } from \"../../TreeFilteringState\";\nimport { AutoSizer } from \"../../utils/AutoSizer\";\nimport { ModelsTree } from \"./ModelsTree\";\nimport { areAllModelsVisible, hideAllModels, invertAllModels, showAllModels, toggleModels } from \"./ModelsVisibilityHandler\";\nimport { queryModelsForHeaderActions } from \"./Utils\";\n\nimport type { IModelConnection, ScreenViewport, Viewport } from \"@itwin/core-frontend\";\nimport type { TreeHeaderButtonProps } from \"../../tree-header/TreeHeader\";\nimport type { ModelsTreeProps } from \"./ModelsTree\";\n/**\n * Information about a single Model.\n * @public\n */\nexport interface ModelInfo {\n id: string;\n isPlanProjection?: boolean;\n}\n\n/**\n * Props that get passed to [[ModelsTreeComponent]] header button renderer.\n * @see ModelTreeComponentProps.headerButtons\n * @public\n */\nexport interface ModelsTreeHeaderButtonProps extends TreeHeaderButtonProps {\n /** A list of models available in the iModel. */\n models: ModelInfo[];\n}\n\n/**\n * Props for [[ModelsTreeComponent]].\n * @public\n */\nexport interface ModelTreeComponentProps extends Omit<ModelsTreeProps, \"iModel\" | \"activeView\" | \"width\" | \"height\" | \"filterInfo\" | \"onFilterApplied\"> {\n /**\n * Renderers of header buttons. Defaults to:\n * ```ts\n * [\n * ModelsTreeComponent.ShowAllButton,\n * ModelsTreeComponent.HideAllButton,\n * ModelsTreeComponent.InvertButton,\n * ModelsTreeComponent.View2DButton,\n * ModelsTreeComponent.View3DButton,\n * ]\n * ```\n */\n headerButtons?: Array<(props: ModelsTreeHeaderButtonProps) => React.ReactNode>;\n}\n\n/**\n * A component that renders [[ModelsTree]] and a header with filtering capabilities\n * and header buttons.\n * @public\n */\nexport const ModelsTreeComponent = (props: ModelTreeComponentProps) => {\n const iModel = useActiveIModelConnection();\n const viewport = useActiveViewport();\n\n if (!iModel || !viewport) {\n return null;\n }\n\n return <ModelsTreeComponentImpl {...props} iModel={iModel} viewport={viewport} />;\n};\n\n/**\n * Renders a \"Show all\" button that enables display of all models.\n * @public\n */\nModelsTreeComponent.ShowAllButton = ShowAllButton;\n\n/**\n * Renders a \"Hide all\" button that disables display of all models.\n * @public\n */\nModelsTreeComponent.HideAllButton = HideAllButton;\n\n/**\n * Renders an \"Invert all\" button that inverts display of all models.\n * @public\n */\nModelsTreeComponent.InvertButton = InvertButton;\n\n/**\n * Renders a \"View 2D\" button that enables display of all plan projection models and disables all others.\n * @public\n */\nModelsTreeComponent.View2DButton = View2DButton;\n\n/**\n * Renders a \"View 3D\" button that enables display of all non-plan projection models and disables all plan projection ones.\n * @public\n */\nModelsTreeComponent.View3DButton = View3DButton;\n\n/**\n * Id of the component. May be used when a creating a [[TreeDefinition]] for [[SelectableTree]].\n * @public\n */\nModelsTreeComponent.id = \"models-tree\";\n\n/**\n * Label of the component. May be used when a creating a [[TreeDefinition]] for [[SelectableTree]].\n * @public\n */\nModelsTreeComponent.getLabel = () => TreeWidget.translate(\"models\");\n\nfunction ModelsTreeComponentImpl(props: ModelTreeComponentProps & { iModel: IModelConnection; viewport: ScreenViewport }) {\n const [availableModels, setAvailableModels] = useState<ModelInfo[]>([]);\n const { viewport, iModel } = props;\n const { searchOptions, filterString, onFilterApplied } = useTreeFilteringState();\n const contentClassName = classNames(\"tree-widget-tree-content\", props.density === \"enlarged\" && \"enlarge\");\n\n useEffect(() => {\n queryModelsForHeaderActions(iModel)\n .then((modelInfos: ModelInfo[]) => {\n setAvailableModels(modelInfos);\n })\n .catch((_e) => {\n setAvailableModels([]);\n });\n }, [iModel]);\n\n const filterInfo = useMemo(\n () => ({ filter: filterString, activeMatchIndex: searchOptions.activeMatchIndex }),\n [filterString, searchOptions.activeMatchIndex],\n );\n\n return (\n <div className=\"tree-widget-tree-with-header\">\n <TreeHeader\n onFilterClear={searchOptions.onFilterCancel}\n onFilterStart={searchOptions.onFilterStart}\n onSelectedChanged={searchOptions.onResultSelectedChanged}\n resultCount={searchOptions.matchedResultCount}\n selectedIndex={searchOptions.activeMatchIndex}\n density={props.density}\n >\n {props.headerButtons\n ? props.headerButtons.map((btn, index) => (\n <Fragment key={index}>{btn({ viewport, models: availableModels, density: props.density, onFeatureUsed: props.onFeatureUsed })}</Fragment>\n ))\n : [\n <ShowAllButton viewport={viewport} models={availableModels} key=\"show-all-btn\" density={props.density} onFeatureUsed={props.onFeatureUsed} />,\n <HideAllButton viewport={viewport} models={availableModels} key=\"hide-all-btn\" density={props.density} onFeatureUsed={props.onFeatureUsed} />,\n <InvertButton viewport={viewport} models={availableModels} key=\"invert-all-btn\" density={props.density} onFeatureUsed={props.onFeatureUsed} />,\n <View2DButton viewport={viewport} models={availableModels} key=\"view-2d-btn\" density={props.density} onFeatureUsed={props.onFeatureUsed} />,\n <View3DButton viewport={viewport} models={availableModels} key=\"view-3d-btn\" density={props.density} onFeatureUsed={props.onFeatureUsed} />,\n ]}\n </TreeHeader>\n <div className={contentClassName}>\n <AutoSizer>\n {({ width, height }) => (\n <ModelsTree\n {...props}\n iModel={iModel}\n activeView={viewport}\n width={width}\n height={height}\n filterInfo={filterInfo}\n onFilterApplied={onFilterApplied}\n />\n )}\n </AutoSizer>\n </div>\n </div>\n );\n}\n\nfunction ShowAllButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"showAll\")}\n onClick={() => {\n props.onFeatureUsed?.(`${ModelsTreeComponent.id}-showall`);\n void showAllModels(\n props.models.map((model) => model.id),\n props.viewport,\n );\n }}\n >\n <SvgVisibilityShow />\n </IconButton>\n );\n}\n\nfunction HideAllButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"hideAll\")}\n onClick={() => {\n props.onFeatureUsed?.(`${ModelsTreeComponent.id}-hideall`);\n void hideAllModels(\n props.models.map((model) => model.id),\n props.viewport,\n );\n }}\n >\n <SvgVisibilityHide />\n </IconButton>\n );\n}\n\nfunction InvertButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"invert\")}\n onClick={() => {\n props.onFeatureUsed?.(`${ModelsTreeComponent.id}-invert`);\n void invertAllModels(\n props.models.map((model) => model.id),\n props.viewport,\n );\n }}\n >\n <SvgVisibilityHalf />\n </IconButton>\n );\n}\n\nfunction View2DButton(props: ModelsTreeHeaderButtonProps) {\n const models2d = useMemo(() => {\n return props.models.filter((model) => model.isPlanProjection).map((model) => model.id);\n }, [props.models]);\n\n const [is2dToggleActive, setIs2dToggleActive] = useState(false);\n\n useEffect(() => {\n setIs2dToggleActive(areAllModelsVisible(models2d, props.viewport));\n return props.viewport.onViewedModelsChanged.addListener((vp: Viewport) => setIs2dToggleActive(areAllModelsVisible(models2d, vp)));\n }, [models2d, props.viewport]);\n\n return (\n <Button\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"toggle2DViews\")}\n onClick={() => {\n props.onFeatureUsed?.(`${ModelsTreeComponent.id}-view2d`);\n void toggleModels(models2d, is2dToggleActive, props.viewport);\n }}\n disabled={models2d.length === 0}\n endIcon={is2dToggleActive ? <SvgVisibilityShow /> : <SvgVisibilityHide />}\n >\n {TreeWidget.translate(\"label2D\")}\n </Button>\n );\n}\n\nfunction View3DButton(props: ModelsTreeHeaderButtonProps) {\n const models3d = useMemo(() => {\n return props.models.filter((model) => !model.isPlanProjection).map((model) => model.id);\n }, [props.models]);\n\n const [is3dToggleActive, setIs3dToggleActive] = useState(false);\n\n useEffect(() => {\n setIs3dToggleActive(areAllModelsVisible(models3d, props.viewport));\n return props.viewport.onViewedModelsChanged.addListener((vp: Viewport) => setIs3dToggleActive(areAllModelsVisible(models3d, vp)));\n }, [models3d, props.viewport]);\n\n return (\n <Button\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"toggle3DViews\")}\n onClick={() => {\n props.onFeatureUsed?.(`${ModelsTreeComponent.id}-view3d`);\n void toggleModels(models3d, is3dToggleActive, props.viewport);\n }}\n disabled={models3d.length === 0}\n endIcon={is3dToggleActive ? <SvgVisibilityShow /> : <SvgVisibilityHide />}\n >\n {TreeWidget.translate(\"label3D\")}\n </Button>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ModelsTreeComponent.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/ModelsTreeComponent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,4BAA4B,CAAC;AACpC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AA0BjI;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAA8B,EAAE,EAAE;IACpE,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAC3C,MAAM,QAAQ,GAAG,iBAAiB,EAAE,CAAC;IAErC,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE;QACxB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAC,uBAAuB,OAAK,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;AACpF,CAAC,CAAC;AAEF;;;GAGG;AACH,mBAAmB,CAAC,aAAa,GAAG,aAAa,CAAC;AAElD;;;GAGG;AACH,mBAAmB,CAAC,aAAa,GAAG,aAAa,CAAC;AAElD;;;GAGG;AACH,mBAAmB,CAAC,YAAY,GAAG,YAAY,CAAC;AAEhD;;;GAGG;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,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CACtB,KAAC,UAAU,OACL,SAAS,EACb,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,QAAQ,EACpB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,eAAe,GAChC,CACH,GACS,GACR,IACF,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport \"../VisibilityTreeBase.scss\";\nimport classNames from \"classnames\";\nimport { Fragment, useMemo } from \"react\";\nimport { useActiveIModelConnection, useActiveViewport } from \"@itwin/appui-react\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { TreeHeader } from \"../../tree-header/TreeHeader\";\nimport { useTreeFilteringState } from \"../../TreeFilteringState\";\nimport { AutoSizer } from \"../../utils/AutoSizer\";\nimport { ModelsTree } from \"./ModelsTree\";\nimport { HideAllButton, InvertButton, ShowAllButton, useAvailableModels, View2DButton, View3DButton } from \"./ModelsTreeButtons\";\n\nimport type { ModelsTreeProps } from \"./ModelsTree\";\nimport type { IModelConnection, ScreenViewport } from \"@itwin/core-frontend\";\nimport type { ModelsTreeHeaderButtonProps } from \"./ModelsTreeButtons\";\n\n/**\n * Props for [[ModelsTreeComponent]].\n * @public\n */\nexport interface ModelTreeComponentProps extends Omit<ModelsTreeProps, \"iModel\" | \"activeView\" | \"width\" | \"height\" | \"filterInfo\" | \"onFilterApplied\"> {\n /**\n * Renderers of header buttons. Defaults to:\n * ```ts\n * [\n * ModelsTreeComponent.ShowAllButton,\n * ModelsTreeComponent.HideAllButton,\n * ModelsTreeComponent.InvertButton,\n * ModelsTreeComponent.View2DButton,\n * ModelsTreeComponent.View3DButton,\n * ]\n * ```\n */\n headerButtons?: Array<(props: ModelsTreeHeaderButtonProps) => React.ReactNode>;\n}\n\n/**\n * A component that renders [[ModelsTree]] and a header with filtering capabilities\n * and header buttons.\n * @public\n */\nexport const ModelsTreeComponent = (props: ModelTreeComponentProps) => {\n const iModel = useActiveIModelConnection();\n const viewport = useActiveViewport();\n\n if (!iModel || !viewport) {\n return null;\n }\n\n return <ModelsTreeComponentImpl {...props} iModel={iModel} viewport={viewport} />;\n};\n\n/**\n * Renders a \"Show all\" button that enables display of all models.\n * @public\n */\nModelsTreeComponent.ShowAllButton = ShowAllButton;\n\n/**\n * Renders a \"Hide all\" button that disables display of all models.\n * @public\n */\nModelsTreeComponent.HideAllButton = HideAllButton;\n\n/**\n * Renders an \"Invert all\" button that inverts display of all models.\n * @public\n */\nModelsTreeComponent.InvertButton = InvertButton;\n\n/**\n * Renders a \"View 2D\" button that enables display of all plan projection models and disables all others.\n * @public\n */\nModelsTreeComponent.View2DButton = View2DButton;\n\n/**\n * Renders a \"View 3D\" button that enables display of all non-plan projection models and disables all plan projection ones.\n * @public\n */\nModelsTreeComponent.View3DButton = View3DButton;\n\n/**\n * Id of the component. May be used when a creating a [[TreeDefinition]] for [[SelectableTree]].\n * @public\n */\nModelsTreeComponent.id = \"models-tree\";\n\n/**\n * Label of the component. May be used when a creating a [[TreeDefinition]] for [[SelectableTree]].\n * @public\n */\nModelsTreeComponent.getLabel = () => TreeWidget.translate(\"models\");\n\nfunction ModelsTreeComponentImpl({\n iModel,\n viewport,\n headerButtons,\n ...treeProps\n}: ModelTreeComponentProps & { iModel: IModelConnection; viewport: ScreenViewport }) {\n const availableModels = useAvailableModels(iModel);\n const density = treeProps.density;\n const { searchOptions, filterString, onFilterApplied } = useTreeFilteringState();\n const contentClassName = classNames(\"tree-widget-tree-content\", density === \"enlarged\" && \"enlarge\");\n\n const filterInfo = useMemo(\n () => ({ filter: filterString, activeMatchIndex: searchOptions.activeMatchIndex }),\n [filterString, searchOptions.activeMatchIndex],\n );\n\n // istanbul ignore next\n const onModelsTreeFeatureUsed = (feature: string) => {\n if (treeProps.onFeatureUsed) {\n treeProps.onFeatureUsed(`${ModelsTreeComponent.id}-${feature}`);\n }\n };\n\n return (\n <div className=\"tree-widget-tree-with-header\">\n <TreeHeader\n onFilterClear={searchOptions.onFilterCancel}\n onFilterStart={searchOptions.onFilterStart}\n onSelectedChanged={searchOptions.onResultSelectedChanged}\n resultCount={searchOptions.matchedResultCount}\n selectedIndex={searchOptions.activeMatchIndex}\n density={density}\n >\n {headerButtons\n ? headerButtons.map((btn, index) => (\n <Fragment key={index}>{btn({ viewport, models: availableModels, density: treeProps.density, onFeatureUsed: onModelsTreeFeatureUsed })}</Fragment>\n ))\n : [\n <ShowAllButton\n viewport={viewport}\n models={availableModels}\n key=\"show-all-btn\"\n density={treeProps.density}\n onFeatureUsed={onModelsTreeFeatureUsed}\n />,\n <HideAllButton\n viewport={viewport}\n models={availableModels}\n key=\"hide-all-btn\"\n density={treeProps.density}\n onFeatureUsed={onModelsTreeFeatureUsed}\n />,\n <InvertButton\n viewport={viewport}\n models={availableModels}\n key=\"invert-all-btn\"\n density={treeProps.density}\n onFeatureUsed={onModelsTreeFeatureUsed}\n />,\n <View2DButton\n viewport={viewport}\n models={availableModels}\n key=\"view-2d-btn\"\n density={treeProps.density}\n onFeatureUsed={onModelsTreeFeatureUsed}\n />,\n <View3DButton\n viewport={viewport}\n models={availableModels}\n key=\"view-3d-btn\"\n density={treeProps.density}\n onFeatureUsed={onModelsTreeFeatureUsed}\n />,\n ]}\n </TreeHeader>\n <div className={contentClassName}>\n <AutoSizer>\n {({ width, height }) => (\n <ModelsTree\n {...treeProps}\n iModel={iModel}\n activeView={viewport}\n width={width}\n height={height}\n filterInfo={filterInfo}\n onFilterApplied={onFilterApplied}\n />\n )}\n </AutoSizer>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { IModelConnection } from "@itwin/core-frontend";
|
|
2
|
-
import type { ModelInfo } from "./ModelsTreeComponent";
|
|
3
1
|
import type { Id64String } from "@itwin/core-bentley";
|
|
2
|
+
import type { IModelConnection } from "@itwin/core-frontend";
|
|
4
3
|
import type { Node, Ruleset } from "@itwin/presentation-common";
|
|
5
4
|
import type { DelayLoadedTreeNodeItem } from "@itwin/components-react";
|
|
6
5
|
import type { ModelsTreeHierarchyConfiguration } from "./ModelsTree";
|
|
6
|
+
import type { ModelInfo } from "./ModelsTreeButtons";
|
|
7
7
|
/** @internal */
|
|
8
8
|
export declare class CachingElementIdsContainer {
|
|
9
9
|
private _generator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/Utils.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAIhG,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAQrD,gBAAgB;AAChB,MAAM,OAAO,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,EAAE,CAAC,EAAE;YACnC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACvB,MAAM,MAAM,CAAC;SACd;IACH,CAAC;CACF;AAOD,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,OAAO,GAA0B;QACrC,yBAAyB,EAAE,KAAK,CAAC,yBAAyB,IAAI,EAAE,UAA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AQ,WAAW,EAAE,EAAE,CAAC;IAE3F,OAAO;QACL,QAAQ,EAAE,sBAAsB;QAChC,iBAAiB,EAAE;YACjB;gBACE,YAAY,EAAE;oBACZ,UAAU,EAAE,SAAS;oBACrB,SAAS,EAAE,mBAAmB;iBAC/B;gBACD,SAAS,EAAE,SAAS;gBACpB,WAAW,EAAE;oBACX,UAAU,EAAE,SAAS;oBACrB,SAAS,EAAE,kBAAkB;iBAC9B;aACF;SACF;QACD,cAAc;QACd,YAAY,EAAE,KAAK;QACnB,YAAY,EAAE,KAAK;KACpB,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,0BAA0B,CAAC,IAAsC,EAAE,IAAmB;IACpG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,sBAAsB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC;AAC5H,CAAC;AAED,gBAAgB;AAChB,MAAM,CAAC,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","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,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAUrD,gBAAgB;AAChB,MAAM,OAAO,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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,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","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,57 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
import { useCallback, useMemo } from "react";
|
|
7
|
+
import { IModelApp } from "@itwin/core-frontend";
|
|
8
|
+
import { Text } from "@itwin/itwinui-react";
|
|
9
|
+
import { TreeWidget } from "../../../../TreeWidget";
|
|
10
|
+
import { VisibilityTree } from "../common/components/VisibilityTree";
|
|
11
|
+
import { CategoriesTreeDefinition } from "./CategoriesTreeDefinition";
|
|
12
|
+
import { StatelessCategoriesVisibilityHandler } from "./CategoriesVisibilityHandler";
|
|
13
|
+
const StatelessCategoriesTreeId = "categories-tree-v2";
|
|
14
|
+
/** @internal */
|
|
15
|
+
export function StatelessCategoriesTree({ imodel, viewManager, categories, allViewports, getSchemaContext, height, width, activeView, filter, density, hierarchyLevelConfig, selectionMode, onPerformanceMeasured, }) {
|
|
16
|
+
const visibilityHandlerFactory = useCallback(() => {
|
|
17
|
+
const visibilityHandler = new StatelessCategoriesVisibilityHandler({
|
|
18
|
+
imodel,
|
|
19
|
+
viewport: activeView,
|
|
20
|
+
viewManager: viewManager ?? IModelApp.viewManager,
|
|
21
|
+
categories,
|
|
22
|
+
allViewports,
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
getVisibilityStatus: async (node) => visibilityHandler.getVisibilityStatus(node),
|
|
26
|
+
changeVisibility: async (node, on) => visibilityHandler.changeVisibility(node, on),
|
|
27
|
+
onVisibilityChange: visibilityHandler.onVisibilityChange,
|
|
28
|
+
dispose: () => visibilityHandler.dispose(),
|
|
29
|
+
};
|
|
30
|
+
}, [activeView, allViewports, categories, imodel, viewManager]);
|
|
31
|
+
const getDefinitionsProvider = useCallback((props) => {
|
|
32
|
+
return new CategoriesTreeDefinition({ ...props, viewType: activeView.view.is2d() ? "2d" : "3d" });
|
|
33
|
+
}, [activeView]);
|
|
34
|
+
const getSearchFilteredPaths = useMemo(() => {
|
|
35
|
+
if (!filter) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
return async ({ imodelAccess }) => CategoriesTreeDefinition.createInstanceKeyPaths({ imodelAccess, label: filter, viewType: activeView.view.is2d() ? "2d" : "3d" });
|
|
39
|
+
}, [filter, activeView]);
|
|
40
|
+
return (_jsx(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) => {
|
|
41
|
+
onPerformanceMeasured?.(`${StatelessCategoriesTreeId}-${action}`, duration);
|
|
42
|
+
} }));
|
|
43
|
+
}
|
|
44
|
+
function getNoDataMessage(filter) {
|
|
45
|
+
if (filter) {
|
|
46
|
+
return _jsx(Text, { children: TreeWidget.translate("stateless.noNodesMatchFilter", { filter }) });
|
|
47
|
+
}
|
|
48
|
+
return undefined;
|
|
49
|
+
}
|
|
50
|
+
function getSublabel(node) {
|
|
51
|
+
return _jsx("div", { style: { marginBottom: "10px" }, children: node.extendedData?.description });
|
|
52
|
+
}
|
|
53
|
+
function getIcon() {
|
|
54
|
+
// empty icon aligns nodes with and without an expander
|
|
55
|
+
return _jsx(_Fragment, {});
|
|
56
|
+
}
|
|
57
|
+
//# 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,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,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C;KACxF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,WAAW,CAAC,IAA+B;IAClD,OAAO,cAAK,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,YAAG,IAAI,CAAC,YAAY,EAAE,WAAW,GAAO,CAAC;AACtF,CAAC;AAED,SAAS,OAAO;IACd,uDAAuD;IACvD,OAAO,mBAAK,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"]}
|