@itwin/tree-widget-react 3.0.0-dev.3 → 3.0.0-dev.4
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/README.md +95 -6
- package/lib/cjs/components/tree-header/TreeHeader.d.ts +10 -8
- package/lib/cjs/components/tree-header/TreeHeader.js +4 -6
- package/lib/cjs/components/tree-header/TreeHeader.js.map +1 -1
- package/lib/cjs/components/tree-header/TreeWithHeader.d.ts +13 -0
- package/lib/cjs/components/tree-header/TreeWithHeader.js +20 -0
- package/lib/cjs/components/tree-header/TreeWithHeader.js.map +1 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTree.d.ts +3 -7
- package/lib/cjs/components/trees/categories-tree/CategoriesTree.js +7 -63
- package/lib/cjs/components/trees/categories-tree/CategoriesTree.js.map +1 -1
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.d.ts +9 -2
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.js +24 -4
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.d.ts +0 -1
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.js +15 -18
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/categories-tree/CategoriesVisibilityHandler.d.ts +1 -9
- package/lib/cjs/components/trees/categories-tree/CategoriesVisibilityHandler.js +2 -6
- package/lib/cjs/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +1 -1
- package/lib/cjs/components/trees/categories-tree/UseCategoriesTree.d.ts +25 -0
- package/lib/cjs/components/trees/categories-tree/UseCategoriesTree.js +89 -0
- package/lib/cjs/components/trees/categories-tree/UseCategoriesTree.js.map +1 -0
- package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.d.ts +6 -6
- package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.js +32 -78
- package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/cjs/components/trees/common/UseTelemetryContext.d.ts +1 -1
- package/lib/cjs/components/trees/common/UseTelemetryContext.js.map +1 -1
- package/lib/cjs/components/trees/common/components/Tree.d.ts +0 -2
- package/lib/cjs/components/trees/common/components/Tree.js +5 -4
- package/lib/cjs/components/trees/common/components/Tree.js.map +1 -1
- package/lib/cjs/components/trees/common/components/VisibilityTree.d.ts +2 -3
- package/lib/cjs/components/trees/common/components/VisibilityTree.js.map +1 -1
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +1 -1
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +1 -2
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.d.ts +1 -1
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.js +1 -2
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/index.d.ts +4 -0
- package/lib/cjs/components/trees/index.js +9 -1
- package/lib/cjs/components/trees/index.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTree.d.ts +4 -4
- package/lib/cjs/components/trees/models-tree/ModelsTree.js +4 -203
- package/lib/cjs/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.d.ts +9 -3
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js +13 -3
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.d.ts +0 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js +27 -20
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/UseModelsTree.d.ts +29 -0
- package/lib/cjs/components/trees/models-tree/UseModelsTree.js +233 -0
- package/lib/cjs/components/trees/models-tree/UseModelsTree.js.map +1 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +1 -1
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
- package/lib/cjs/tree-widget-react.d.ts +1 -0
- package/lib/cjs/tree-widget-react.js +3 -1
- package/lib/cjs/tree-widget-react.js.map +1 -1
- package/lib/esm/components/tree-header/TreeHeader.d.ts +10 -8
- package/lib/esm/components/tree-header/TreeHeader.js +4 -6
- package/lib/esm/components/tree-header/TreeHeader.js.map +1 -1
- package/lib/esm/components/tree-header/TreeWithHeader.d.ts +13 -0
- package/lib/esm/components/tree-header/TreeWithHeader.js +13 -0
- package/lib/esm/components/tree-header/TreeWithHeader.js.map +1 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTree.d.ts +3 -7
- package/lib/esm/components/trees/categories-tree/CategoriesTree.js +7 -63
- package/lib/esm/components/trees/categories-tree/CategoriesTree.js.map +1 -1
- package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.d.ts +9 -2
- package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.js +22 -4
- package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
- package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.d.ts +0 -1
- package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.js +16 -16
- package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/categories-tree/CategoriesVisibilityHandler.d.ts +1 -9
- package/lib/esm/components/trees/categories-tree/CategoriesVisibilityHandler.js +2 -6
- package/lib/esm/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +1 -1
- package/lib/esm/components/trees/categories-tree/UseCategoriesTree.d.ts +25 -0
- package/lib/esm/components/trees/categories-tree/UseCategoriesTree.js +85 -0
- package/lib/esm/components/trees/categories-tree/UseCategoriesTree.js.map +1 -0
- package/lib/esm/components/trees/common/CategoriesVisibilityUtils.d.ts +6 -6
- package/lib/esm/components/trees/common/CategoriesVisibilityUtils.js +33 -79
- package/lib/esm/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/esm/components/trees/common/UseTelemetryContext.d.ts +1 -1
- package/lib/esm/components/trees/common/UseTelemetryContext.js.map +1 -1
- package/lib/esm/components/trees/common/components/Tree.d.ts +0 -2
- package/lib/esm/components/trees/common/components/Tree.js +5 -4
- package/lib/esm/components/trees/common/components/Tree.js.map +1 -1
- package/lib/esm/components/trees/common/components/VisibilityTree.d.ts +2 -3
- package/lib/esm/components/trees/common/components/VisibilityTree.js.map +1 -1
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +1 -1
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +1 -2
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.d.ts +1 -1
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.js +1 -2
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/index.d.ts +4 -0
- package/lib/esm/components/trees/index.js +4 -0
- package/lib/esm/components/trees/index.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTree.d.ts +4 -4
- package/lib/esm/components/trees/models-tree/ModelsTree.js +5 -204
- package/lib/esm/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.d.ts +9 -3
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js +12 -2
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.d.ts +0 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js +29 -19
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/models-tree/UseModelsTree.d.ts +29 -0
- package/lib/esm/components/trees/models-tree/UseModelsTree.js +229 -0
- package/lib/esm/components/trees/models-tree/UseModelsTree.js.map +1 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +2 -2
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
- package/lib/esm/tree-widget-react.d.ts +1 -0
- package/lib/esm/tree-widget-react.js +1 -0
- package/lib/esm/tree-widget-react.js.map +1 -1
- package/package.json +11 -15
- package/lib/cjs/components/trees/categories-tree/UseCategories.d.ts +0 -8
- package/lib/cjs/components/trees/categories-tree/UseCategories.js +0 -22
- package/lib/cjs/components/trees/categories-tree/UseCategories.js.map +0 -1
- package/lib/cjs/components/utils/AutoSizer.d.ts +0 -13
- package/lib/cjs/components/utils/AutoSizer.js +0 -21
- package/lib/cjs/components/utils/AutoSizer.js.map +0 -1
- package/lib/esm/components/trees/categories-tree/UseCategories.d.ts +0 -8
- package/lib/esm/components/trees/categories-tree/UseCategories.js +0 -18
- package/lib/esm/components/trees/categories-tree/UseCategories.js.map +0 -1
- package/lib/esm/components/utils/AutoSizer.d.ts +0 -13
- package/lib/esm/components/utils/AutoSizer.js +0 -17
- package/lib/esm/components/utils/AutoSizer.js.map +0 -1
- /package/lib/cjs/components/{trees/Tree.scss → tree-header/TreeWithHeader.scss} +0 -0
- /package/lib/esm/components/{trees/Tree.scss → tree-header/TreeWithHeader.scss} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/trees/index.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,kDAAkD,CAAC;AAC9F,OAAO,EAAE,4BAA4B,EAAE,MAAM,sDAAsD,CAAC;AAEpG,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAEpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,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\nexport { ModelsTreeComponent } from \"./models-tree/ModelsTreeComponent\";\nexport { CategoriesTreeComponent } from \"./categories-tree/CategoriesTreeComponent\";\nexport { IModelContentTreeComponent } from \"./imodel-content-tree/IModelContentTreeComponent\";\nexport { ExternalSourcesTreeComponent } from \"./external-sources-tree/ExternalSourcesTreeComponent\";\n\nexport { Tree } from \"./common/components/Tree\";\nexport { VisibilityTree } from \"./common/components/VisibilityTree\";\nexport { TreeRenderer } from \"./common/components/TreeRenderer\";\nexport { VisibilityTreeRenderer } from \"./common/components/VisibilityTreeRenderer\";\nexport { HierarchyVisibilityHandler, VisibilityStatus } from \"./common/UseHierarchyVisibility\";\nexport { TelemetryContextProvider } from \"./common/UseTelemetryContext\";\n\nexport { ModelsTreeVisibilityHandlerOverrides } from \"./models-tree/internal/ModelsTreeVisibilityHandler\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/trees/index.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,kDAAkD,CAAC;AAC9F,OAAO,EAAE,4BAA4B,EAAE,MAAM,sDAAsD,CAAC;AAEpG,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AAEvF,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAEpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,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\nexport { ModelsTreeComponent } from \"./models-tree/ModelsTreeComponent\";\nexport { CategoriesTreeComponent } from \"./categories-tree/CategoriesTreeComponent\";\nexport { IModelContentTreeComponent } from \"./imodel-content-tree/IModelContentTreeComponent\";\nexport { ExternalSourcesTreeComponent } from \"./external-sources-tree/ExternalSourcesTreeComponent\";\n\nexport { useModelsTree } from \"./models-tree/UseModelsTree\";\nexport { useCategoriesTree } from \"./categories-tree/UseCategoriesTree\";\n\nexport { useModelsTreeButtonProps } from \"./models-tree/ModelsTreeButtons\";\nexport { useCategoriesTreeButtonProps } from \"./categories-tree/CategoriesTreeButtons\";\n\nexport { Tree } from \"./common/components/Tree\";\nexport { VisibilityTree } from \"./common/components/VisibilityTree\";\nexport { TreeRenderer } from \"./common/components/TreeRenderer\";\nexport { VisibilityTreeRenderer } from \"./common/components/VisibilityTreeRenderer\";\nexport { HierarchyVisibilityHandler, VisibilityStatus } from \"./common/UseHierarchyVisibility\";\nexport { TelemetryContextProvider } from \"./common/UseTelemetryContext\";\n\nexport { ModelsTreeVisibilityHandlerOverrides } from \"./models-tree/internal/ModelsTreeVisibilityHandler\";\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VisibilityTree } from "../common/components/VisibilityTree";
|
|
2
|
-
import type { ModelsTreeVisibilityHandlerOverrides } from "./internal/ModelsTreeVisibilityHandler";
|
|
3
|
-
import type { ModelsTreeHierarchyConfiguration } from "./ModelsTreeDefinition";
|
|
4
2
|
import type { ComponentPropsWithoutRef } from "react";
|
|
5
3
|
import type { Viewport } from "@itwin/core-frontend";
|
|
4
|
+
import type { ModelsTreeVisibilityHandlerOverrides } from "./internal/ModelsTreeVisibilityHandler";
|
|
5
|
+
import type { ModelsTreeHierarchyConfiguration } from "./ModelsTreeDefinition";
|
|
6
6
|
/** @beta */
|
|
7
7
|
interface ModelsTreeOwnProps {
|
|
8
8
|
activeView: Viewport;
|
|
@@ -16,8 +16,8 @@ interface ModelsTreeOwnProps {
|
|
|
16
16
|
/** @beta */
|
|
17
17
|
type VisibilityTreeProps = ComponentPropsWithoutRef<typeof VisibilityTree>;
|
|
18
18
|
/** @beta */
|
|
19
|
-
type ModelsTreeProps = ModelsTreeOwnProps & Pick<VisibilityTreeProps, "imodel" | "getSchemaContext" | "selectionStorage" | "
|
|
19
|
+
type ModelsTreeProps = ModelsTreeOwnProps & Pick<VisibilityTreeProps, "imodel" | "getSchemaContext" | "selectionStorage" | "density" | "selectionMode">;
|
|
20
20
|
/** @beta */
|
|
21
|
-
export declare function ModelsTree({ imodel, getSchemaContext, selectionStorage,
|
|
21
|
+
export declare function ModelsTree({ imodel, getSchemaContext, selectionStorage, activeView, filter, density, hierarchyLevelConfig, hierarchyConfig, selectionMode, visibilityHandlerOverrides, }: ModelsTreeProps): JSX.Element;
|
|
22
22
|
export {};
|
|
23
23
|
//# sourceMappingURL=ModelsTree.d.ts.map
|
|
@@ -1,213 +1,14 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
/*---------------------------------------------------------------------------------------------
|
|
3
3
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
7
|
-
import { IModelApp } from "@itwin/core-frontend";
|
|
8
|
-
import { SvgFolder, SvgImodelHollow, SvgItem, SvgLayers, SvgModel } from "@itwin/itwinui-icons-react";
|
|
9
|
-
import { Anchor, Icon, Text } from "@itwin/itwinui-react";
|
|
10
|
-
import { createECSqlQueryExecutor } from "@itwin/presentation-core-interop";
|
|
11
|
-
import { HierarchyNode, HierarchyNodeKey } from "@itwin/presentation-hierarchies";
|
|
12
|
-
import { TreeWidget } from "../../../TreeWidget";
|
|
13
6
|
import { VisibilityTree } from "../common/components/VisibilityTree";
|
|
14
7
|
import { VisibilityTreeRenderer } from "../common/components/VisibilityTreeRenderer";
|
|
15
|
-
import {
|
|
16
|
-
import { useIModelChangeListener } from "../common/UseIModelChangeListener";
|
|
17
|
-
import { useTelemetryContext } from "../common/UseTelemetryContext";
|
|
18
|
-
import { ModelsTreeIdsCache } from "./internal/ModelsTreeIdsCache";
|
|
19
|
-
import { createModelsTreeVisibilityHandler } from "./internal/ModelsTreeVisibilityHandler";
|
|
20
|
-
import { ModelsTreeComponent } from "./ModelsTreeComponent";
|
|
21
|
-
import { defaultHierarchyConfiguration, ModelsTreeDefinition } from "./ModelsTreeDefinition";
|
|
8
|
+
import { useModelsTree } from "./UseModelsTree";
|
|
22
9
|
/** @beta */
|
|
23
|
-
export function ModelsTree({ imodel, getSchemaContext, selectionStorage,
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
...defaultHierarchyConfiguration,
|
|
27
|
-
...hierarchyConfig,
|
|
28
|
-
}),
|
|
29
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
30
|
-
Object.values(hierarchyConfig ?? {}));
|
|
31
|
-
const { onFeatureUsed } = useTelemetryContext();
|
|
32
|
-
const { getModelsTreeIdsCache, visibilityHandlerFactory } = useCachedVisibility(activeView, hierarchyConfiguration, visibilityHandlerOverrides);
|
|
33
|
-
const { loadInstanceKeys: loadFocusedInstancesKeys } = useFocusedInstancesContext();
|
|
34
|
-
const getHierarchyDefinition = useCallback(({ imodelAccess }) => new ModelsTreeDefinition({ imodelAccess, idsCache: getModelsTreeIdsCache(), hierarchyConfig: hierarchyConfiguration }), [getModelsTreeIdsCache, hierarchyConfiguration]);
|
|
35
|
-
const onNodeDoubleClick = useCallback(async ({ nodeData, extendedData }) => {
|
|
36
|
-
if (!HierarchyNode.isInstancesNode(nodeData) || (extendedData && (extendedData.isSubject || extendedData.isModel || extendedData.isCategory))) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const instanceIds = nodeData.key.instanceKeys.map((instanceKey) => instanceKey.id);
|
|
40
|
-
await IModelApp.viewManager.selectedView?.zoomToElements(instanceIds);
|
|
41
|
-
onFeatureUsed({ featureId: "zoom-to-node", reportInteraction: false });
|
|
42
|
-
}, [onFeatureUsed]);
|
|
43
|
-
const getFocusedFilteredPaths = useMemo(() => {
|
|
44
|
-
setFilteringError(undefined);
|
|
45
|
-
if (!loadFocusedInstancesKeys) {
|
|
46
|
-
return undefined;
|
|
47
|
-
}
|
|
48
|
-
return async ({ imodelAccess }) => {
|
|
49
|
-
try {
|
|
50
|
-
const targetKeys = await collectTargetKeys(loadFocusedInstancesKeys);
|
|
51
|
-
return await ModelsTreeDefinition.createInstanceKeyPaths({
|
|
52
|
-
imodelAccess,
|
|
53
|
-
idsCache: getModelsTreeIdsCache(),
|
|
54
|
-
keys: targetKeys,
|
|
55
|
-
hierarchyConfig: hierarchyConfiguration,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
catch (e) {
|
|
59
|
-
const newError = e instanceof Error && e.message.match(/Filter matches more than \d+ items/) ? "tooManyInstancesFocused" : "unknownInstanceFocusError";
|
|
60
|
-
setFilteringError(newError);
|
|
61
|
-
return [];
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
}, [loadFocusedInstancesKeys, getModelsTreeIdsCache, hierarchyConfiguration]);
|
|
65
|
-
const getSearchFilteredPaths = useMemo(() => {
|
|
66
|
-
setFilteringError(undefined);
|
|
67
|
-
if (!filter) {
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
70
|
-
return async ({ imodelAccess }) => {
|
|
71
|
-
onFeatureUsed({ featureId: "filtering", reportInteraction: true });
|
|
72
|
-
try {
|
|
73
|
-
return await ModelsTreeDefinition.createInstanceKeyPaths({
|
|
74
|
-
imodelAccess,
|
|
75
|
-
label: filter,
|
|
76
|
-
idsCache: getModelsTreeIdsCache(),
|
|
77
|
-
hierarchyConfig: hierarchyConfiguration,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
catch (e) {
|
|
81
|
-
const newError = e instanceof Error && e.message.match(/Filter matches more than \d+ items/) ? "tooManyFilterMatches" : "unknownFilterError";
|
|
82
|
-
setFilteringError(newError);
|
|
83
|
-
return [];
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
}, [filter, getModelsTreeIdsCache, onFeatureUsed, hierarchyConfiguration]);
|
|
87
|
-
const getFilteredPaths = getFocusedFilteredPaths ?? getSearchFilteredPaths;
|
|
88
|
-
return (_jsx(VisibilityTree, { height: height, width: width, imodel: imodel, treeName: ModelsTreeComponent.id, selectionStorage: selectionStorage, getSchemaContext: getSchemaContext, visibilityHandlerFactory: visibilityHandlerFactory, getHierarchyDefinition: getHierarchyDefinition, getFilteredPaths: getFilteredPaths, hierarchyLevelSizeLimit: hierarchyLevelConfig?.sizeLimit, density: density, noDataMessage: getNoDataMessage(filter, filteringError), selectionMode: selectionMode, highlight: filter === undefined ? undefined : { text: filter }, treeRenderer: (treeProps) => _jsx(VisibilityTreeRenderer, { ...treeProps, getIcon: getIcon, onNodeDoubleClick: onNodeDoubleClick }) }));
|
|
89
|
-
}
|
|
90
|
-
function getNoDataMessage(filter, error) {
|
|
91
|
-
if (isInstanceFocusError(error)) {
|
|
92
|
-
return _jsx(InstanceFocusError, { error: error });
|
|
93
|
-
}
|
|
94
|
-
if (isFilterError(error)) {
|
|
95
|
-
return _jsx(Text, { children: TreeWidget.translate(`modelsTree.filtering.${error}`) });
|
|
96
|
-
}
|
|
97
|
-
if (filter) {
|
|
98
|
-
return _jsx(Text, { children: TreeWidget.translate("modelsTree.filtering.noMatches", { filter }) });
|
|
99
|
-
}
|
|
100
|
-
return undefined;
|
|
101
|
-
}
|
|
102
|
-
function isFilterError(error) {
|
|
103
|
-
return error === "tooManyFilterMatches" || error === "unknownFilterError";
|
|
104
|
-
}
|
|
105
|
-
function isInstanceFocusError(error) {
|
|
106
|
-
return error === "tooManyInstancesFocused" || error === "unknownInstanceFocusError";
|
|
107
|
-
}
|
|
108
|
-
function InstanceFocusError({ error }) {
|
|
109
|
-
const { toggle } = useFocusedInstancesContext();
|
|
110
|
-
const localizedMessage = createLocalizedMessage(TreeWidget.translate(`modelsTree.filtering.${error}`), () => toggle());
|
|
111
|
-
return _jsx(Text, { children: localizedMessage });
|
|
112
|
-
}
|
|
113
|
-
function getIcon(node) {
|
|
114
|
-
if (node.extendedData?.imageId === undefined) {
|
|
115
|
-
return undefined;
|
|
116
|
-
}
|
|
117
|
-
switch (node.extendedData.imageId) {
|
|
118
|
-
case "icon-layers":
|
|
119
|
-
return _jsx(SvgLayers, {});
|
|
120
|
-
case "icon-item":
|
|
121
|
-
return _jsx(SvgItem, {});
|
|
122
|
-
case "icon-ec-class":
|
|
123
|
-
return _jsx(SvgClassGrouping, {});
|
|
124
|
-
case "icon-imodel-hollow-2":
|
|
125
|
-
return _jsx(SvgImodelHollow, {});
|
|
126
|
-
case "icon-folder":
|
|
127
|
-
return _jsx(SvgFolder, {});
|
|
128
|
-
case "icon-model":
|
|
129
|
-
return _jsx(SvgModel, {});
|
|
130
|
-
}
|
|
131
|
-
return undefined;
|
|
132
|
-
}
|
|
133
|
-
function createVisibilityHandlerFactory(activeView, idsCacheGetter, overrides) {
|
|
134
|
-
return ({ imodelAccess }) => createModelsTreeVisibilityHandler({ viewport: activeView, idsCache: idsCacheGetter(), imodelAccess, overrides });
|
|
135
|
-
}
|
|
136
|
-
function useCachedVisibility(activeView, hierarchyConfig, overrides) {
|
|
137
|
-
const cacheRef = useRef();
|
|
138
|
-
const currentIModelRef = useRef(activeView.iModel);
|
|
139
|
-
const getModelsTreeIdsCache = useCallback(() => {
|
|
140
|
-
if (!cacheRef.current) {
|
|
141
|
-
cacheRef.current = new ModelsTreeIdsCache(createECSqlQueryExecutor(currentIModelRef.current), hierarchyConfig);
|
|
142
|
-
}
|
|
143
|
-
return cacheRef.current;
|
|
144
|
-
}, [hierarchyConfig]);
|
|
145
|
-
const [visibilityHandlerFactory, setVisibilityHandlerFactory] = useState(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));
|
|
146
|
-
useIModelChangeListener({
|
|
147
|
-
imodel: activeView.iModel,
|
|
148
|
-
action: useCallback(() => {
|
|
149
|
-
cacheRef.current = undefined;
|
|
150
|
-
setVisibilityHandlerFactory(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));
|
|
151
|
-
}, [activeView, getModelsTreeIdsCache, overrides]),
|
|
152
|
-
});
|
|
153
|
-
useEffect(() => {
|
|
154
|
-
currentIModelRef.current = activeView.iModel;
|
|
155
|
-
cacheRef.current = undefined;
|
|
156
|
-
setVisibilityHandlerFactory(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));
|
|
157
|
-
}, [activeView, getModelsTreeIdsCache, overrides]);
|
|
158
|
-
return {
|
|
159
|
-
getModelsTreeIdsCache,
|
|
160
|
-
visibilityHandlerFactory,
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
function SvgClassGrouping() {
|
|
164
|
-
return (_jsx(Icon, { children: _jsx("svg", { id: "Calque_1", "data-name": "Calque 1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", children: _jsx("path", { d: "M8.00933,0,0,3.97672V11.986L8.00933,16,16,11.93V3.97651ZM1.66173,11.27642c-.26155.03734-.59754-.26154-.76553-.69085-.168-.41066-.09334-.784.168-.82152.26154-.03734.59754.26154.76553.67219C1.99772,10.86577,1.92306,11.23909,1.66173,11.27642Zm0-3.32319c-.26155.03733-.59754-.28-.76553-.69086-.168-.42932-.09334-.80285.168-.84.26133-.03733.59754.28.76532.69086C1.99772,7.54236,1.92306,7.89723,1.66173,7.95323Zm4.31276,5.52621a.18186.18186,0,0,1-.16821-.01866L3.41657,12.15394a.94275.94275,0,0,1-.29887-.80285c.03754-.33621.22421-.52265.41108-.41066L5.9185,12.24727a.88656.88656,0,0,1,.28.80285A.5057.5057,0,0,1,5.97449,13.47944Zm0-3.37919a.18184.18184,0,0,1-.16821-.01867L3.41657,8.77475a.943.943,0,0,1-.29887-.80286c.03754-.3362.22421-.52286.41108-.42953L5.9185,8.86786a.83112.83112,0,0,1,.28.78419A.51684.51684,0,0,1,5.97449,10.10025Z" }) }) }));
|
|
165
|
-
}
|
|
166
|
-
async function collectTargetKeys(loadFocusedInstancesKeys) {
|
|
167
|
-
const targetKeys = [];
|
|
168
|
-
const groupingNodeInfos = [];
|
|
169
|
-
for await (const key of loadFocusedInstancesKeys()) {
|
|
170
|
-
if ("id" in key) {
|
|
171
|
-
targetKeys.push(key);
|
|
172
|
-
continue;
|
|
173
|
-
}
|
|
174
|
-
if (!HierarchyNodeKey.isClassGrouping(key.key)) {
|
|
175
|
-
targetKeys.push(...key.groupedInstanceKeys);
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
if (!key.nonGroupingAncestor || !HierarchyNodeKey.isInstances(key.nonGroupingAncestor.key)) {
|
|
179
|
-
continue;
|
|
180
|
-
}
|
|
181
|
-
const parentKey = key.nonGroupingAncestor.key;
|
|
182
|
-
const type = key.nonGroupingAncestor.extendedData?.isCategory ? "category" : "element";
|
|
183
|
-
const modelIds = (key.nonGroupingAncestor.extendedData?.modelIds ?? []).flatMap((ids) => ids);
|
|
184
|
-
const groupInfo = groupingNodeInfos.find((group) => HierarchyNodeKey.equals(group.parentKey, parentKey));
|
|
185
|
-
if (groupInfo) {
|
|
186
|
-
groupInfo.classes.push(key.key.className);
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
groupingNodeInfos.push({ classes: [key.key.className], parentType: type, parentKey, modelIds });
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
targetKeys.push(...groupingNodeInfos.map(({ parentKey, parentType, classes, modelIds }) => ({
|
|
193
|
-
parent: parentType === "element"
|
|
194
|
-
? { type: "element", ids: parentKey.instanceKeys.map((key) => key.id) }
|
|
195
|
-
: { type: "category", ids: parentKey.instanceKeys.map((key) => key.id), modelIds },
|
|
196
|
-
classes,
|
|
197
|
-
})));
|
|
198
|
-
return targetKeys;
|
|
199
|
-
}
|
|
200
|
-
function createLocalizedMessage(message, onClick) {
|
|
201
|
-
const exp = new RegExp("<link>(.*)</link>");
|
|
202
|
-
const match = message.match(exp);
|
|
203
|
-
if (!match) {
|
|
204
|
-
return message;
|
|
205
|
-
}
|
|
206
|
-
const [fullText, innerText] = match;
|
|
207
|
-
const [textBefore, textAfter] = message.split(fullText);
|
|
208
|
-
return (_jsxs(_Fragment, { children: [textBefore ? textBefore : null, _jsx(Anchor, { underline: true, onClick: (e) => {
|
|
209
|
-
e.stopPropagation();
|
|
210
|
-
onClick?.();
|
|
211
|
-
}, children: innerText }), textAfter ? textAfter : null] }));
|
|
10
|
+
export function ModelsTree({ imodel, getSchemaContext, selectionStorage, activeView, filter, density, hierarchyLevelConfig, hierarchyConfig, selectionMode, visibilityHandlerOverrides, }) {
|
|
11
|
+
const { modelsTreeProps, rendererProps } = useModelsTree({ activeView, filter, hierarchyConfig, visibilityHandlerOverrides });
|
|
12
|
+
return (_jsx(VisibilityTree, { ...modelsTreeProps, imodel: imodel, selectionStorage: selectionStorage, getSchemaContext: getSchemaContext, hierarchyLevelSizeLimit: hierarchyLevelConfig?.sizeLimit, density: density, selectionMode: selectionMode, treeRenderer: (treeProps) => _jsx(VisibilityTreeRenderer, { ...treeProps, ...rendererProps }) }));
|
|
212
13
|
}
|
|
213
14
|
//# sourceMappingURL=ModelsTree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelsTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/ModelsTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,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S,CAAC,GAAG,KAAK,CAAC;IACpC,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAExD,OAAO,CACL,8BACG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAC/B,KAAC,MAAM,IACL,SAAS,QACT,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;oBACb,CAAC,CAAC,eAAe,EAAE,CAAC;oBACpB,OAAO,EAAE,EAAE,CAAC;gBACd,CAAC,YAEA,SAAS,GACH,EACR,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAC5B,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { SvgFolder, SvgImodelHollow, SvgItem, SvgLayers, SvgModel } from \"@itwin/itwinui-icons-react\";\nimport { Anchor, Icon, Text } from \"@itwin/itwinui-react\";\nimport { createECSqlQueryExecutor } from \"@itwin/presentation-core-interop\";\nimport { HierarchyNode, HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { VisibilityTree } from \"../common/components/VisibilityTree\";\nimport { VisibilityTreeRenderer } from \"../common/components/VisibilityTreeRenderer\";\nimport { useFocusedInstancesContext } from \"../common/FocusedInstancesContext\";\nimport { useIModelChangeListener } from \"../common/UseIModelChangeListener\";\nimport { useTelemetryContext } from \"../common/UseTelemetryContext\";\nimport { ModelsTreeIdsCache } from \"./internal/ModelsTreeIdsCache\";\nimport { createModelsTreeVisibilityHandler } from \"./internal/ModelsTreeVisibilityHandler\";\nimport { ModelsTreeComponent } from \"./ModelsTreeComponent\";\nimport { defaultHierarchyConfiguration, ModelsTreeDefinition } from \"./ModelsTreeDefinition\";\n\nimport type { ModelsTreeVisibilityHandlerOverrides } from \"./internal/ModelsTreeVisibilityHandler\";\nimport type { Id64String } from \"@itwin/core-bentley\";\nimport type { GroupingHierarchyNode, InstancesNodeKey } from \"@itwin/presentation-hierarchies\";\nimport type { ElementsGroupInfo, ModelsTreeHierarchyConfiguration } from \"./ModelsTreeDefinition\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\nimport type { ComponentPropsWithoutRef, ReactElement } from \"react\";\nimport type { Viewport } from \"@itwin/core-frontend\";\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\n\ntype ModelsTreeFilteringError = \"tooManyFilterMatches\" | \"tooManyInstancesFocused\" | \"unknownFilterError\" | \"unknownInstanceFocusError\";\n\n/** @beta */\ninterface ModelsTreeOwnProps {\n activeView: Viewport;\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n hierarchyConfig?: Partial<ModelsTreeHierarchyConfiguration>;\n visibilityHandlerOverrides?: ModelsTreeVisibilityHandlerOverrides;\n filter?: string;\n}\n\n/** @beta */\ntype VisibilityTreeProps = ComponentPropsWithoutRef<typeof VisibilityTree>;\n\n/** @beta */\ntype ModelsTreeProps = ModelsTreeOwnProps &\n Pick<VisibilityTreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"height\" | \"width\" | \"density\" | \"selectionMode\">;\n\n/** @beta */\nexport function ModelsTree({\n imodel,\n getSchemaContext,\n selectionStorage,\n height,\n width,\n activeView,\n filter,\n density,\n hierarchyLevelConfig,\n hierarchyConfig,\n selectionMode,\n visibilityHandlerOverrides,\n}: ModelsTreeProps) {\n const [filteringError, setFilteringError] = useState<ModelsTreeFilteringError | undefined>(undefined);\n const hierarchyConfiguration = useMemo<ModelsTreeHierarchyConfiguration>(\n () => ({\n ...defaultHierarchyConfiguration,\n ...hierarchyConfig,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n Object.values(hierarchyConfig ?? {}),\n );\n const { onFeatureUsed } = useTelemetryContext();\n\n const { getModelsTreeIdsCache, visibilityHandlerFactory } = useCachedVisibility(activeView, hierarchyConfiguration, visibilityHandlerOverrides);\n const { loadInstanceKeys: loadFocusedInstancesKeys } = useFocusedInstancesContext();\n\n const getHierarchyDefinition = useCallback<VisibilityTreeProps[\"getHierarchyDefinition\"]>(\n ({ imodelAccess }) => new ModelsTreeDefinition({ imodelAccess, idsCache: getModelsTreeIdsCache(), hierarchyConfig: hierarchyConfiguration }),\n [getModelsTreeIdsCache, hierarchyConfiguration],\n );\n\n const onNodeDoubleClick = useCallback(\n async ({ nodeData, extendedData }: PresentationHierarchyNode) => {\n if (!HierarchyNode.isInstancesNode(nodeData) || (extendedData && (extendedData.isSubject || extendedData.isModel || extendedData.isCategory))) {\n return;\n }\n const instanceIds = nodeData.key.instanceKeys.map((instanceKey) => instanceKey.id);\n await IModelApp.viewManager.selectedView?.zoomToElements(instanceIds);\n onFeatureUsed({ featureId: \"zoom-to-node\", reportInteraction: false });\n },\n [onFeatureUsed],\n );\n\n const getFocusedFilteredPaths = useMemo<VisibilityTreeProps[\"getFilteredPaths\"] | undefined>(() => {\n setFilteringError(undefined);\n if (!loadFocusedInstancesKeys) {\n return undefined;\n }\n return async ({ imodelAccess }) => {\n try {\n const targetKeys = await collectTargetKeys(loadFocusedInstancesKeys);\n return await ModelsTreeDefinition.createInstanceKeyPaths({\n imodelAccess,\n idsCache: getModelsTreeIdsCache(),\n keys: targetKeys,\n hierarchyConfig: hierarchyConfiguration,\n });\n } catch (e) {\n const newError = e instanceof Error && e.message.match(/Filter matches more than \\d+ items/) ? \"tooManyInstancesFocused\" : \"unknownInstanceFocusError\";\n setFilteringError(newError);\n return [];\n }\n };\n }, [loadFocusedInstancesKeys, getModelsTreeIdsCache, hierarchyConfiguration]);\n\n const getSearchFilteredPaths = useMemo<VisibilityTreeProps[\"getFilteredPaths\"] | undefined>(() => {\n setFilteringError(undefined);\n if (!filter) {\n return undefined;\n }\n return async ({ imodelAccess }) => {\n onFeatureUsed({ featureId: \"filtering\", reportInteraction: true });\n try {\n return await ModelsTreeDefinition.createInstanceKeyPaths({\n imodelAccess,\n label: filter,\n idsCache: getModelsTreeIdsCache(),\n hierarchyConfig: hierarchyConfiguration,\n });\n } catch (e) {\n const newError = e instanceof Error && e.message.match(/Filter matches more than \\d+ items/) ? \"tooManyFilterMatches\" : \"unknownFilterError\";\n setFilteringError(newError);\n return [];\n }\n };\n }, [filter, getModelsTreeIdsCache, onFeatureUsed, hierarchyConfiguration]);\n\n const getFilteredPaths = getFocusedFilteredPaths ?? getSearchFilteredPaths;\n\n return (\n <VisibilityTree\n height={height}\n width={width}\n imodel={imodel}\n treeName={ModelsTreeComponent.id}\n selectionStorage={selectionStorage}\n getSchemaContext={getSchemaContext}\n visibilityHandlerFactory={visibilityHandlerFactory}\n getHierarchyDefinition={getHierarchyDefinition}\n getFilteredPaths={getFilteredPaths}\n hierarchyLevelSizeLimit={hierarchyLevelConfig?.sizeLimit}\n density={density}\n noDataMessage={getNoDataMessage(filter, filteringError)}\n selectionMode={selectionMode}\n highlight={filter === undefined ? undefined : { text: filter }}\n treeRenderer={(treeProps) => <VisibilityTreeRenderer {...treeProps} getIcon={getIcon} onNodeDoubleClick={onNodeDoubleClick} />}\n />\n );\n}\n\nfunction getNoDataMessage(filter?: string, error?: ModelsTreeFilteringError) {\n if (isInstanceFocusError(error)) {\n return <InstanceFocusError error={error!} />;\n }\n if (isFilterError(error)) {\n return <Text>{TreeWidget.translate(`modelsTree.filtering.${error}`)}</Text>;\n }\n if (filter) {\n return <Text>{TreeWidget.translate(\"modelsTree.filtering.noMatches\", { filter })}</Text>;\n }\n return undefined;\n}\n\nfunction isFilterError(error: ModelsTreeFilteringError | undefined) {\n return error === \"tooManyFilterMatches\" || error === \"unknownFilterError\";\n}\n\nfunction isInstanceFocusError(error: ModelsTreeFilteringError | undefined) {\n return error === \"tooManyInstancesFocused\" || error === \"unknownInstanceFocusError\";\n}\n\nfunction InstanceFocusError({ error }: { error: ModelsTreeFilteringError }) {\n const { toggle } = useFocusedInstancesContext();\n const localizedMessage = createLocalizedMessage(TreeWidget.translate(`modelsTree.filtering.${error}`), () => toggle());\n return <Text>{localizedMessage}</Text>;\n}\n\nfunction getIcon(node: PresentationHierarchyNode): ReactElement | undefined {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n\n switch (node.extendedData.imageId) {\n case \"icon-layers\":\n return <SvgLayers />;\n case \"icon-item\":\n return <SvgItem />;\n case \"icon-ec-class\":\n return <SvgClassGrouping />;\n case \"icon-imodel-hollow-2\":\n return <SvgImodelHollow />;\n case \"icon-folder\":\n return <SvgFolder />;\n case \"icon-model\":\n return <SvgModel />;\n }\n\n return undefined;\n}\n\nfunction createVisibilityHandlerFactory(\n activeView: Viewport,\n idsCacheGetter: () => ModelsTreeIdsCache,\n overrides?: ModelsTreeVisibilityHandlerOverrides,\n): VisibilityTreeProps[\"visibilityHandlerFactory\"] {\n return ({ imodelAccess }) => createModelsTreeVisibilityHandler({ viewport: activeView, idsCache: idsCacheGetter(), imodelAccess, overrides });\n}\n\nfunction useCachedVisibility(activeView: Viewport, hierarchyConfig: ModelsTreeHierarchyConfiguration, overrides?: ModelsTreeVisibilityHandlerOverrides) {\n const cacheRef = useRef<ModelsTreeIdsCache>();\n const currentIModelRef = useRef(activeView.iModel);\n\n const getModelsTreeIdsCache = useCallback(() => {\n if (!cacheRef.current) {\n cacheRef.current = new ModelsTreeIdsCache(createECSqlQueryExecutor(currentIModelRef.current), hierarchyConfig);\n }\n return cacheRef.current;\n }, [hierarchyConfig]);\n\n const [visibilityHandlerFactory, setVisibilityHandlerFactory] = useState(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));\n\n useIModelChangeListener({\n imodel: activeView.iModel,\n action: useCallback(() => {\n cacheRef.current = undefined;\n setVisibilityHandlerFactory(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));\n }, [activeView, getModelsTreeIdsCache, overrides]),\n });\n\n useEffect(() => {\n currentIModelRef.current = activeView.iModel;\n cacheRef.current = undefined;\n setVisibilityHandlerFactory(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));\n }, [activeView, getModelsTreeIdsCache, overrides]);\n\n return {\n getModelsTreeIdsCache,\n visibilityHandlerFactory,\n };\n}\n\nfunction SvgClassGrouping() {\n return (\n <Icon>\n <svg id=\"Calque_1\" data-name=\"Calque 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M8.00933,0,0,3.97672V11.986L8.00933,16,16,11.93V3.97651ZM1.66173,11.27642c-.26155.03734-.59754-.26154-.76553-.69085-.168-.41066-.09334-.784.168-.82152.26154-.03734.59754.26154.76553.67219C1.99772,10.86577,1.92306,11.23909,1.66173,11.27642Zm0-3.32319c-.26155.03733-.59754-.28-.76553-.69086-.168-.42932-.09334-.80285.168-.84.26133-.03733.59754.28.76532.69086C1.99772,7.54236,1.92306,7.89723,1.66173,7.95323Zm4.31276,5.52621a.18186.18186,0,0,1-.16821-.01866L3.41657,12.15394a.94275.94275,0,0,1-.29887-.80285c.03754-.33621.22421-.52265.41108-.41066L5.9185,12.24727a.88656.88656,0,0,1,.28.80285A.5057.5057,0,0,1,5.97449,13.47944Zm0-3.37919a.18184.18184,0,0,1-.16821-.01867L3.41657,8.77475a.943.943,0,0,1-.29887-.80286c.03754-.3362.22421-.52286.41108-.42953L5.9185,8.86786a.83112.83112,0,0,1,.28.78419A.51684.51684,0,0,1,5.97449,10.10025Z\" />\n </svg>\n </Icon>\n );\n}\n\nasync function collectTargetKeys(loadFocusedInstancesKeys: () => AsyncIterableIterator<InstanceKey | GroupingHierarchyNode>) {\n const targetKeys: Array<InstanceKey | ElementsGroupInfo> = [];\n const groupingNodeInfos: Array<{ parentKey: InstancesNodeKey; parentType: \"element\" | \"category\"; classes: string[]; modelIds: Id64String[] }> = [];\n for await (const key of loadFocusedInstancesKeys()) {\n if (\"id\" in key) {\n targetKeys.push(key);\n continue;\n }\n\n if (!HierarchyNodeKey.isClassGrouping(key.key)) {\n targetKeys.push(...key.groupedInstanceKeys);\n continue;\n }\n\n if (!key.nonGroupingAncestor || !HierarchyNodeKey.isInstances(key.nonGroupingAncestor.key)) {\n continue;\n }\n\n const parentKey = key.nonGroupingAncestor.key;\n const type = key.nonGroupingAncestor.extendedData?.isCategory ? \"category\" : \"element\";\n const modelIds = ((key.nonGroupingAncestor.extendedData?.modelIds as Id64String[][]) ?? []).flatMap((ids) => ids);\n const groupInfo = groupingNodeInfos.find((group) => HierarchyNodeKey.equals(group.parentKey, parentKey));\n if (groupInfo) {\n groupInfo.classes.push(key.key.className);\n } else {\n groupingNodeInfos.push({ classes: [key.key.className], parentType: type, parentKey, modelIds });\n }\n }\n targetKeys.push(\n ...groupingNodeInfos.map(({ parentKey, parentType, classes, modelIds }) => ({\n parent:\n parentType === \"element\"\n ? { type: \"element\" as const, ids: parentKey.instanceKeys.map((key) => key.id) }\n : { type: \"category\" as const, ids: parentKey.instanceKeys.map((key) => key.id), modelIds },\n classes,\n })),\n );\n return targetKeys;\n}\n\nfunction createLocalizedMessage(message: string, onClick?: () => void) {\n const exp = new RegExp(\"<link>(.*)</link>\");\n const match = message.match(exp);\n if (!match) {\n return message;\n }\n\n const [fullText, innerText] = match;\n const [textBefore, textAfter] = message.split(fullText);\n\n return (\n <>\n {textBefore ? textBefore : null}\n <Anchor\n underline\n onClick={(e) => {\n e.stopPropagation();\n onClick?.();\n }}\n >\n {innerText}\n </Anchor>\n {textAfter ? textAfter : null}\n </>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ModelsTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/ModelsTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6CAA6C,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAwBhD,YAAY;AACZ,MAAM,UAAU,UAAU,CAAC,EACzB,MAAM,EACN,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,MAAM,EACN,OAAO,EACP,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,0BAA0B,GACV;IAChB,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,0BAA0B,EAAE,CAAC,CAAC;IAE9H,OAAO,CACL,KAAC,cAAc,OACT,eAAe,EACnB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,uBAAuB,EAAE,oBAAoB,EAAE,SAAS,EACxD,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,KAAC,sBAAsB,OAAK,SAAS,KAAM,aAAa,GAAI,GACzF,CACH,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 { VisibilityTree } from \"../common/components/VisibilityTree\";\nimport { VisibilityTreeRenderer } from \"../common/components/VisibilityTreeRenderer\";\nimport { useModelsTree } from \"./UseModelsTree\";\n\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { Viewport } from \"@itwin/core-frontend\";\nimport type { ModelsTreeVisibilityHandlerOverrides } from \"./internal/ModelsTreeVisibilityHandler\";\nimport type { ModelsTreeHierarchyConfiguration } from \"./ModelsTreeDefinition\";\n\n/** @beta */\ninterface ModelsTreeOwnProps {\n activeView: Viewport;\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n hierarchyConfig?: Partial<ModelsTreeHierarchyConfiguration>;\n visibilityHandlerOverrides?: ModelsTreeVisibilityHandlerOverrides;\n filter?: string;\n}\n\n/** @beta */\ntype VisibilityTreeProps = ComponentPropsWithoutRef<typeof VisibilityTree>;\n\n/** @beta */\ntype ModelsTreeProps = ModelsTreeOwnProps & Pick<VisibilityTreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"density\" | \"selectionMode\">;\n\n/** @beta */\nexport function ModelsTree({\n imodel,\n getSchemaContext,\n selectionStorage,\n activeView,\n filter,\n density,\n hierarchyLevelConfig,\n hierarchyConfig,\n selectionMode,\n visibilityHandlerOverrides,\n}: ModelsTreeProps) {\n const { modelsTreeProps, rendererProps } = useModelsTree({ activeView, filter, hierarchyConfig, visibilityHandlerOverrides });\n\n return (\n <VisibilityTree\n {...modelsTreeProps}\n imodel={imodel}\n selectionStorage={selectionStorage}\n getSchemaContext={getSchemaContext}\n hierarchyLevelSizeLimit={hierarchyLevelConfig?.sizeLimit}\n density={density}\n selectionMode={selectionMode}\n treeRenderer={(treeProps) => <VisibilityTreeRenderer {...treeProps} {...rendererProps} />}\n />\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { TreeHeaderButtonProps } from "../../tree-header/TreeHeader";
|
|
3
|
-
import type { IModelConnection } from "@itwin/core-frontend";
|
|
3
|
+
import type { IModelConnection, Viewport } from "@itwin/core-frontend";
|
|
4
4
|
/**
|
|
5
5
|
* Information about a single Model.
|
|
6
6
|
* @public
|
|
@@ -18,8 +18,14 @@ export interface ModelsTreeHeaderButtonProps extends TreeHeaderButtonProps {
|
|
|
18
18
|
/** A list of models available in the iModel. */
|
|
19
19
|
models: ModelInfo[];
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Custom hook that creates props required to render `ModelsTreeComponent` header button.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export declare function useModelsTreeButtonProps({ imodel, viewport, }: {
|
|
26
|
+
imodel: IModelConnection;
|
|
27
|
+
viewport: Viewport;
|
|
28
|
+
}): Pick<ModelsTreeHeaderButtonProps, "models" | "viewport">;
|
|
23
29
|
/** @public */
|
|
24
30
|
export declare function ShowAllButton(props: ModelsTreeHeaderButtonProps): JSX.Element;
|
|
25
31
|
/** @public */
|
|
@@ -9,8 +9,18 @@ import { Button, IconButton } from "@itwin/itwinui-react";
|
|
|
9
9
|
import { TreeWidget } from "../../../TreeWidget";
|
|
10
10
|
import { useFocusedInstancesContext } from "../common/FocusedInstancesContext";
|
|
11
11
|
import { areAllModelsVisible, hideAllModels, invertAllModels, showAllModels, toggleModels } from "./internal/ModelsTreeVisibilityHandler";
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Custom hook that creates props required to render `ModelsTreeComponent` header button.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export function useModelsTreeButtonProps({ imodel, viewport, }) {
|
|
17
|
+
const models = useAvailableModels(imodel);
|
|
18
|
+
return {
|
|
19
|
+
models,
|
|
20
|
+
viewport,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function useAvailableModels(imodel) {
|
|
14
24
|
const [availableModels, setAvailableModels] = useState([]);
|
|
15
25
|
useEffect(() => {
|
|
16
26
|
queryModelsForHeaderActions(imodel)
|
|
@@ -1 +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,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACrH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC1D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9C,MAAM,EAAE,CAAC;QACX,CAAC,EACD,QAAQ,EAAE,OAAO,YAEjB,KAAC,cAAc,KAAG,GACP,CACd,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 { SvgCursorClick, SvgVisibilityHalf, SvgVisibilityHide, SvgVisibilityShow } from \"@itwin/itwinui-icons-react\";\nimport { Button, IconButton } from \"@itwin/itwinui-react\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { useFocusedInstancesContext } from \"../common/FocusedInstancesContext\";\nimport { areAllModelsVisible, hideAllModels, invertAllModels, showAllModels, toggleModels } from \"./internal/ModelsTreeVisibilityHandler\";\n\nimport type { GeometricModel3dProps, ModelQueryParams } from \"@itwin/core-common\";\nimport type { TreeHeaderButtonProps } from \"../../tree-header/TreeHeader\";\nimport type { IModelConnection, Viewport } from \"@itwin/core-frontend\";\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(() => {\n setAvailableModels([]);\n });\n }, [imodel]);\n\n return availableModels;\n}\n\nasync 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\n/** @public */\nexport function ShowAllButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"modelsTree.buttons.showAll.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-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/** @public */\nexport function HideAllButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"modelsTree.buttons.hideAll.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-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/** @public */\nexport function InvertButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"modelsTree.buttons.invert.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-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/** @public */\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(\"modelsTree.buttons.toggle2d.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-view2d\");\n void toggleModels(models2d, is2dToggleActive, props.viewport);\n }}\n disabled={models2d.length === 0}\n endIcon={is2dToggleActive ? <SvgVisibilityShow /> : <SvgVisibilityHide />}\n >\n {TreeWidget.translate(\"modelsTree.buttons.toggle2d.label\")}\n </Button>\n );\n}\n\n/** @public */\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(\"modelsTree.buttons.toggle3d.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-view3d\");\n void toggleModels(models3d, is3dToggleActive, props.viewport);\n }}\n disabled={models3d.length === 0}\n endIcon={is3dToggleActive ? <SvgVisibilityShow /> : <SvgVisibilityHide />}\n >\n {TreeWidget.translate(\"modelsTree.buttons.toggle3d.label\")}\n </Button>\n );\n}\n\n/** @public */\nexport function ToggleInstancesFocusButton({ density, onFeatureUsed }: { density?: \"default\" | \"enlarged\"; onFeatureUsed?: (feature: string) => void }) {\n const { enabled, toggle } = useFocusedInstancesContext();\n const title = enabled\n ? TreeWidget.translate(\"modelsTree.buttons.toggleFocusMode.disable.tooltip\")\n : TreeWidget.translate(\"modelsTree.buttons.toggleFocusMode.enable.tooltip\");\n return (\n <IconButton\n styleType=\"borderless\"\n size={density === \"enlarged\" ? \"large\" : \"small\"}\n title={title}\n onClick={() => {\n onFeatureUsed?.(\"models-tree-instancesfocus\");\n toggle();\n }}\n isActive={enabled}\n >\n <SvgCursorClick />\n </IconButton>\n );\n}\n"]}
|
|
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,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACrH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAwB1I;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,EACvC,MAAM,EACN,QAAQ,GAIT;IACC,MAAM,MAAM,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO;QACL,MAAM;QACN,QAAQ;KACT,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,MAAwB;IAClD,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAc,EAAE,CAAC,CAAC;IAExE,SAAS,CAAC,GAAG,EAAE;Q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AAC;YAC5C,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,mCAAmC,CAAC,GACnD,CACV,CAAC;AACJ,CAAC;AAED,cAAc;AACd,MAAM,UAAU,0BAA0B,CAAC,EAAE,OAAO,EAAE,aAAa,EAAmF;IACpJ,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,0BAA0B,EAAE,CAAC;IACzD,MAAM,KAAK,GAAG,OAAO;QACnB,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,oDAAoD,CAAC;QAC5E,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,mDAAmD,CAAC,CAAC;IAC9E,OAAO,CACL,KAAC,UAAU,IACT,SAAS,EAAC,YAAY,EACtB,IAAI,EAAE,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAChD,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,GAAG,EAAE;YACZ,aAAa,EAAE,CAAC,4BAA4B,CAAC,CAAC;YAC9C,MAAM,EAAE,CAAC;QACX,CAAC,EACD,QAAQ,EAAE,OAAO,YAEjB,KAAC,cAAc,KAAG,GACP,CACd,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 { SvgCursorClick, SvgVisibilityHalf, SvgVisibilityHide, SvgVisibilityShow } from \"@itwin/itwinui-icons-react\";\nimport { Button, IconButton } from \"@itwin/itwinui-react\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { useFocusedInstancesContext } from \"../common/FocusedInstancesContext\";\nimport { areAllModelsVisible, hideAllModels, invertAllModels, showAllModels, toggleModels } from \"./internal/ModelsTreeVisibilityHandler\";\n\nimport type { GeometricModel3dProps, ModelQueryParams } from \"@itwin/core-common\";\nimport type { TreeHeaderButtonProps } from \"../../tree-header/TreeHeader\";\nimport type { IModelConnection, Viewport } from \"@itwin/core-frontend\";\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 * Custom hook that creates props required to render `ModelsTreeComponent` header button.\n * @public\n */\nexport function useModelsTreeButtonProps({\n imodel,\n viewport,\n}: {\n imodel: IModelConnection;\n viewport: Viewport;\n}): Pick<ModelsTreeHeaderButtonProps, \"models\" | \"viewport\"> {\n const models = useAvailableModels(imodel);\n return {\n models,\n viewport,\n };\n}\n\nfunction useAvailableModels(imodel: IModelConnection): ModelInfo[] {\n const [availableModels, setAvailableModels] = useState<ModelInfo[]>([]);\n\n useEffect(() => {\n queryModelsForHeaderActions(imodel)\n .then((modelInfos: ModelInfo[]) => {\n setAvailableModels(modelInfos);\n })\n .catch(() => {\n setAvailableModels([]);\n });\n }, [imodel]);\n\n return availableModels;\n}\n\nasync 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\n/** @public */\nexport function ShowAllButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"modelsTree.buttons.showAll.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-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/** @public */\nexport function HideAllButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"modelsTree.buttons.hideAll.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-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/** @public */\nexport function InvertButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n size={props.density === \"enlarged\" ? \"large\" : \"small\"}\n styleType=\"borderless\"\n title={TreeWidget.translate(\"modelsTree.buttons.invert.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-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/** @public */\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(\"modelsTree.buttons.toggle2d.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-view2d\");\n void toggleModels(models2d, is2dToggleActive, props.viewport);\n }}\n disabled={models2d.length === 0}\n endIcon={is2dToggleActive ? <SvgVisibilityShow /> : <SvgVisibilityHide />}\n >\n {TreeWidget.translate(\"modelsTree.buttons.toggle2d.label\")}\n </Button>\n );\n}\n\n/** @public */\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(\"modelsTree.buttons.toggle3d.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-view3d\");\n void toggleModels(models3d, is3dToggleActive, props.viewport);\n }}\n disabled={models3d.length === 0}\n endIcon={is3dToggleActive ? <SvgVisibilityShow /> : <SvgVisibilityHide />}\n >\n {TreeWidget.translate(\"modelsTree.buttons.toggle3d.label\")}\n </Button>\n );\n}\n\n/** @public */\nexport function ToggleInstancesFocusButton({ density, onFeatureUsed }: { density?: \"default\" | \"enlarged\"; onFeatureUsed?: (feature: string) => void }) {\n const { enabled, toggle } = useFocusedInstancesContext();\n const title = enabled\n ? TreeWidget.translate(\"modelsTree.buttons.toggleFocusMode.disable.tooltip\")\n : TreeWidget.translate(\"modelsTree.buttons.toggleFocusMode.enable.tooltip\");\n return (\n <IconButton\n styleType=\"borderless\"\n size={density === \"enlarged\" ? \"large\" : \"small\"}\n title={title}\n onClick={() => {\n onFeatureUsed?.(\"models-tree-instancesfocus\");\n toggle();\n }}\n isActive={enabled}\n >\n <SvgCursorClick />\n </IconButton>\n );\n}\n"]}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createElement as _createElement } from "react";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
3
|
/*---------------------------------------------------------------------------------------------
|
|
3
4
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
5
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
6
|
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
import "
|
|
7
|
-
import classNames from "classnames";
|
|
8
|
-
import { Fragment } from "react";
|
|
7
|
+
import { Fragment, useEffect } from "react";
|
|
9
8
|
import { useActiveIModelConnection, useActiveViewport } from "@itwin/appui-react";
|
|
10
9
|
import { TreeWidget } from "../../../TreeWidget";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { TreeWithHeader } from "../../tree-header/TreeWithHeader";
|
|
11
|
+
import { useFocusedInstancesContext } from "../common/FocusedInstancesContext";
|
|
13
12
|
import { FocusedInstancesContextProvider } from "../common/FocusedInstancesContextProvider";
|
|
14
13
|
import { useFiltering } from "../common/UseFiltering";
|
|
15
14
|
import { TelemetryContextProvider } from "../common/UseTelemetryContext";
|
|
16
15
|
import { ModelsTree } from "./ModelsTree";
|
|
17
|
-
import { HideAllButton, InvertButton, ShowAllButton, ToggleInstancesFocusButton,
|
|
16
|
+
import { HideAllButton, InvertButton, ShowAllButton, ToggleInstancesFocusButton, useModelsTreeButtonProps, View2DButton, View3DButton, } from "./ModelsTreeButtons";
|
|
18
17
|
/**
|
|
19
18
|
* A component that renders `ModelsTree` and a header with filtering capabilities
|
|
20
19
|
* and header buttons.
|
|
@@ -27,7 +26,7 @@ export const ModelsTreeComponent = (props) => {
|
|
|
27
26
|
if (!iModel || !viewport) {
|
|
28
27
|
return null;
|
|
29
28
|
}
|
|
30
|
-
return _jsx(ModelsTreeComponentImpl, { ...props, iModel: iModel, viewport: viewport });
|
|
29
|
+
return (_jsx(FocusedInstancesContextProvider, { selectionStorage: props.selectionStorage, imodelKey: iModel.key, children: _jsx(ModelsTreeComponentImpl, { ...props, iModel: iModel, viewport: viewport }) }));
|
|
31
30
|
};
|
|
32
31
|
/**
|
|
33
32
|
* Renders a "Show all" button that enables display of all models.
|
|
@@ -70,18 +69,29 @@ ModelsTreeComponent.id = "models-tree-v2";
|
|
|
70
69
|
*/
|
|
71
70
|
ModelsTreeComponent.getLabel = () => TreeWidget.translate("modelsTree.label");
|
|
72
71
|
function ModelsTreeComponentImpl({ iModel, viewport, headerButtons, onFeatureUsed, onPerformanceMeasured, ...treeProps }) {
|
|
73
|
-
const
|
|
72
|
+
const buttonProps = useModelsTreeButtonProps({ imodel: iModel, viewport });
|
|
74
73
|
const { filter, applyFilter, clearFilter } = useFiltering();
|
|
74
|
+
const { enabled: instanceFocusEnabled } = useFocusedInstancesContext();
|
|
75
75
|
const density = treeProps.density;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
76
|
+
const buttons = headerButtons
|
|
77
|
+
? headerButtons.map((btn, index) => _jsx(Fragment, { children: btn({ ...buttonProps, onFeatureUsed }) }, index))
|
|
78
|
+
: [
|
|
79
|
+
_createElement(ShowAllButton, { ...buttonProps, key: "show-all-btn", density: density, onFeatureUsed: onFeatureUsed }),
|
|
80
|
+
_createElement(HideAllButton, { ...buttonProps, key: "hide-all-btn", density: density, onFeatureUsed: onFeatureUsed }),
|
|
81
|
+
_createElement(InvertButton, { ...buttonProps, key: "invert-all-btn", density: density, onFeatureUsed: onFeatureUsed }),
|
|
82
|
+
_createElement(View2DButton, { ...buttonProps, key: "view-2d-btn", density: density, onFeatureUsed: onFeatureUsed }),
|
|
83
|
+
_createElement(View3DButton, { ...buttonProps, key: "view-3d-btn", density: density, onFeatureUsed: onFeatureUsed }),
|
|
84
|
+
_jsx(ToggleInstancesFocusButton, { density: density, onFeatureUsed: onFeatureUsed }, "toggle-instances-focus-btn"),
|
|
85
|
+
];
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (instanceFocusEnabled) {
|
|
88
|
+
clearFilter();
|
|
89
|
+
}
|
|
90
|
+
}, [instanceFocusEnabled, clearFilter]);
|
|
91
|
+
return (_jsx(TelemetryContextProvider, { componentIdentifier: ModelsTreeComponent.id, onFeatureUsed: onFeatureUsed, onPerformanceMeasured: onPerformanceMeasured, children: _jsx(TreeWithHeader, { filteringProps: {
|
|
92
|
+
onFilterStart: applyFilter,
|
|
93
|
+
onFilterClear: clearFilter,
|
|
94
|
+
isDisabled: instanceFocusEnabled,
|
|
95
|
+
}, buttons: buttons, density: density, children: _jsx(ModelsTree, { ...treeProps, imodel: iModel, activeView: viewport, filter: filter }) }) }));
|
|
86
96
|
}
|
|
87
97
|
//# sourceMappingURL=ModelsTreeComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelsTreeComponent.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/ModelsTreeComponent.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ModelsTreeComponent.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/ModelsTreeComponent.tsx"],"names":[],"mappings":";;AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,0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AC,YAAY,OAAK,WAAW,EAAE,GAAG,EAAC,aAAa,EAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,GAAI;YACnG,KAAC,0BAA0B,IAAkC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,IAA3E,4BAA4B,CAAmD;SAChH,CAAC;IAEN,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,oBAAoB,EAAE;YACxB,WAAW,EAAE,CAAC;SACf;IACH,CAAC,EAAE,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC,CAAC;IAExC,OAAO,CACL,KAAC,wBAAwB,IAAC,mBAAmB,EAAE,mBAAmB,CAAC,EAAE,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,qBAAqB,YAC/I,KAAC,cAAc,IACb,cAAc,EAAE;gBACd,aAAa,EAAE,WAAW;gBAC1B,aAAa,EAAE,WAAW;gBAC1B,UAAU,EAAE,oBAAoB;aACjC,EACD,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,YAEhB,KAAC,UAAU,OAAK,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAI,GACpE,GACQ,CAC5B,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Fragment, useEffect } from \"react\";\nimport { useActiveIModelConnection, useActiveViewport } from \"@itwin/appui-react\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { TreeWithHeader } from \"../../tree-header/TreeWithHeader\";\nimport { useFocusedInstancesContext } from \"../common/FocusedInstancesContext\";\nimport { FocusedInstancesContextProvider } from \"../common/FocusedInstancesContextProvider\";\nimport { useFiltering } from \"../common/UseFiltering\";\nimport { TelemetryContextProvider } from \"../common/UseTelemetryContext\";\nimport { ModelsTree } from \"./ModelsTree\";\nimport {\n HideAllButton, InvertButton, ShowAllButton, ToggleInstancesFocusButton, useModelsTreeButtonProps, View2DButton, View3DButton,\n} from \"./ModelsTreeButtons\";\n\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\nimport type { IModelConnection, ScreenViewport } from \"@itwin/core-frontend\";\nimport type { ModelsTreeHeaderButtonProps } from \"./ModelsTreeButtons\";\n\n/** @public */\ninterface ModelsTreeComponentProps\n extends Pick<\n ComponentPropsWithoutRef<typeof ModelsTree>,\n \"getSchemaContext\" | \"selectionStorage\" | \"density\" | \"hierarchyLevelConfig\" | \"selectionMode\" | \"hierarchyConfig\" | \"visibilityHandlerOverrides\"\n > {\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 * ModelsTreeComponent.ToggleInstancesFocusButton,\n * ]\n * ```\n */\n headerButtons?: Array<(props: ModelsTreeHeaderButtonProps) => React.ReactNode>;\n onPerformanceMeasured?: (featureId: string, duration: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\n/**\n * A component that renders `ModelsTree` and a header with filtering capabilities\n * and header buttons.\n *\n * @public\n */\nexport const ModelsTreeComponent = (props: ModelsTreeComponentProps) => {\n const iModel = useActiveIModelConnection();\n const viewport = useActiveViewport();\n\n if (!iModel || !viewport) {\n return null;\n }\n\n return (\n <FocusedInstancesContextProvider selectionStorage={props.selectionStorage} imodelKey={iModel.key}>\n <ModelsTreeComponentImpl {...props} iModel={iModel} viewport={viewport} />\n </FocusedInstancesContextProvider>\n );\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 * Renders a \"Enable/Disable instances focus\" button that enables/disables instances focusing mode.\n * @public\n */\nModelsTreeComponent.ToggleInstancesFocusButton = ToggleInstancesFocusButton;\n\n/**\n * Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @public\n */\nModelsTreeComponent.id = \"models-tree-v2\";\n\n/**\n * Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @public\n */\nModelsTreeComponent.getLabel = () => TreeWidget.translate(\"modelsTree.label\");\n\nfunction ModelsTreeComponentImpl({\n iModel,\n viewport,\n headerButtons,\n onFeatureUsed,\n onPerformanceMeasured,\n ...treeProps\n}: ModelsTreeComponentProps & { iModel: IModelConnection; viewport: ScreenViewport }) {\n const buttonProps = useModelsTreeButtonProps({ imodel: iModel, viewport });\n const { filter, applyFilter, clearFilter } = useFiltering();\n const { enabled: instanceFocusEnabled } = useFocusedInstancesContext();\n const density = treeProps.density;\n\n const buttons: ReactNode = headerButtons\n ? headerButtons.map((btn, index) => <Fragment key={index}>{btn({ ...buttonProps, onFeatureUsed })}</Fragment>)\n : [\n <ShowAllButton {...buttonProps} key=\"show-all-btn\" density={density} onFeatureUsed={onFeatureUsed} />,\n <HideAllButton {...buttonProps} key=\"hide-all-btn\" density={density} onFeatureUsed={onFeatureUsed} />,\n <InvertButton {...buttonProps} key=\"invert-all-btn\" density={density} onFeatureUsed={onFeatureUsed} />,\n <View2DButton {...buttonProps} key=\"view-2d-btn\" density={density} onFeatureUsed={onFeatureUsed} />,\n <View3DButton {...buttonProps} key=\"view-3d-btn\" density={density} onFeatureUsed={onFeatureUsed} />,\n <ToggleInstancesFocusButton key=\"toggle-instances-focus-btn\" density={density} onFeatureUsed={onFeatureUsed} />,\n ];\n\n useEffect(() => {\n if (instanceFocusEnabled) {\n clearFilter();\n }\n }, [instanceFocusEnabled, clearFilter]);\n\n return (\n <TelemetryContextProvider componentIdentifier={ModelsTreeComponent.id} onFeatureUsed={onFeatureUsed} onPerformanceMeasured={onPerformanceMeasured}>\n <TreeWithHeader\n filteringProps={{\n onFilterStart: applyFilter,\n onFilterClear: clearFilter,\n isDisabled: instanceFocusEnabled,\n }}\n buttons={buttons}\n density={density}\n >\n <ModelsTree {...treeProps} imodel={iModel} activeView={viewport} filter={filter} />\n </TreeWithHeader>\n </TelemetryContextProvider>\n );\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import type { Viewport } from "@itwin/core-frontend";
|
|
3
|
+
import type { ModelsTreeHierarchyConfiguration } from "./ModelsTreeDefinition";
|
|
4
|
+
import type { ModelsTreeVisibilityHandlerOverrides } from "./internal/ModelsTreeVisibilityHandler";
|
|
5
|
+
import type { VisibilityTree } from "../common/components/VisibilityTree";
|
|
6
|
+
import type { VisibilityTreeRenderer } from "../common/components/VisibilityTreeRenderer";
|
|
7
|
+
/** @beta */
|
|
8
|
+
type VisibilityTreeRendererProps = ComponentPropsWithoutRef<typeof VisibilityTreeRenderer>;
|
|
9
|
+
/** @beta */
|
|
10
|
+
type VisibilityTreeProps = ComponentPropsWithoutRef<typeof VisibilityTree>;
|
|
11
|
+
/** @beta */
|
|
12
|
+
interface UseModelsTreeProps {
|
|
13
|
+
filter?: string;
|
|
14
|
+
activeView: Viewport;
|
|
15
|
+
hierarchyConfig?: Partial<ModelsTreeHierarchyConfiguration>;
|
|
16
|
+
visibilityHandlerOverrides?: ModelsTreeVisibilityHandlerOverrides;
|
|
17
|
+
}
|
|
18
|
+
/** @beta */
|
|
19
|
+
interface UseModelsTreeResult {
|
|
20
|
+
modelsTreeProps: Pick<VisibilityTreeProps, "treeName" | "getHierarchyDefinition" | "getFilteredPaths" | "visibilityHandlerFactory" | "highlight" | "noDataMessage">;
|
|
21
|
+
rendererProps: Pick<Required<VisibilityTreeRendererProps>, "getIcon" | "onNodeDoubleClick">;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Custom hook to create and manage state for the models tree.
|
|
25
|
+
* @beta
|
|
26
|
+
*/
|
|
27
|
+
export declare function useModelsTree({ activeView, filter, hierarchyConfig, visibilityHandlerOverrides }: UseModelsTreeProps): UseModelsTreeResult;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=UseModelsTree.d.ts.map
|