@itwin/tree-widget-react 0.3.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/components/TreeWidgetUiItemsProvider.d.ts +9 -17
- package/lib/cjs/components/TreeWidgetUiItemsProvider.js +50 -47
- package/lib/cjs/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/cjs/components/search-bar/SearchBar.scss +1 -0
- package/lib/cjs/components/trees/CategoriesTree.d.ts +2 -7
- package/lib/cjs/components/trees/CategoriesTree.js +21 -23
- package/lib/cjs/components/trees/CategoriesTree.js.map +1 -1
- package/lib/cjs/components/trees/IModelContentTree.d.ts +2 -5
- package/lib/cjs/components/trees/IModelContentTree.js +5 -11
- package/lib/cjs/components/trees/IModelContentTree.js.map +1 -1
- package/lib/cjs/components/trees/ModelsTree.d.ts +2 -8
- package/lib/cjs/components/trees/ModelsTree.js +8 -16
- package/lib/cjs/components/trees/ModelsTree.js.map +1 -1
- package/lib/cjs/components/trees/SpatialTree.d.ts +2 -2
- package/lib/cjs/components/trees/SpatialTree.js +11 -28
- package/lib/cjs/components/trees/SpatialTree.js.map +1 -1
- package/lib/cjs/components/trees/index.d.ts +0 -2
- package/lib/cjs/components/trees/index.js +3 -5
- package/lib/cjs/components/trees/index.js.map +1 -1
- package/lib/cjs/components/utils/AutoSizer.d.ts +10 -0
- package/lib/cjs/components/utils/AutoSizer.js +36 -0
- package/lib/cjs/components/utils/AutoSizer.js.map +1 -0
- package/lib/cjs/tree-widget-react.d.ts +1 -1
- package/lib/cjs/tree-widget-react.js +4 -4
- package/lib/cjs/tree-widget-react.js.map +1 -1
- package/lib/cjs/types.d.ts +26 -0
- package/lib/cjs/types.js +3 -0
- package/lib/cjs/types.js.map +1 -0
- package/lib/esm/components/TreeWidgetUiItemsProvider.d.ts +9 -17
- package/lib/esm/components/TreeWidgetUiItemsProvider.js +50 -47
- package/lib/esm/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/esm/components/search-bar/SearchBar.scss +1 -0
- package/lib/esm/components/trees/CategoriesTree.d.ts +2 -7
- package/lib/esm/components/trees/CategoriesTree.js +23 -25
- package/lib/esm/components/trees/CategoriesTree.js.map +1 -1
- package/lib/esm/components/trees/IModelContentTree.d.ts +2 -5
- package/lib/esm/components/trees/IModelContentTree.js +6 -12
- package/lib/esm/components/trees/IModelContentTree.js.map +1 -1
- package/lib/esm/components/trees/ModelsTree.d.ts +2 -8
- package/lib/esm/components/trees/ModelsTree.js +9 -17
- package/lib/esm/components/trees/ModelsTree.js.map +1 -1
- package/lib/esm/components/trees/SpatialTree.d.ts +2 -2
- package/lib/esm/components/trees/SpatialTree.js +10 -11
- package/lib/esm/components/trees/SpatialTree.js.map +1 -1
- package/lib/esm/components/trees/index.d.ts +0 -2
- package/lib/esm/components/trees/index.js +3 -5
- package/lib/esm/components/trees/index.js.map +1 -1
- package/lib/esm/components/utils/AutoSizer.d.ts +10 -0
- package/lib/esm/components/utils/AutoSizer.js +13 -0
- package/lib/esm/components/utils/AutoSizer.js.map +1 -0
- package/lib/esm/tree-widget-react.d.ts +1 -1
- package/lib/esm/tree-widget-react.js +4 -4
- package/lib/esm/tree-widget-react.js.map +1 -1
- package/lib/esm/types.d.ts +26 -0
- package/lib/esm/types.js +2 -0
- package/lib/esm/types.js.map +1 -0
- package/package.json +6 -3
- package/lib/cjs/components/TreeWidgetControl.d.ts +0 -26
- package/lib/cjs/components/TreeWidgetControl.js +0 -66
- package/lib/cjs/components/TreeWidgetControl.js.map +0 -1
- package/lib/cjs/components/rulesets/ClassificationSystems.json +0 -122
- package/lib/cjs/components/trees/ClassificationsTree.d.ts +0 -7
- package/lib/cjs/components/trees/ClassificationsTree.js +0 -43
- package/lib/cjs/components/trees/ClassificationsTree.js.map +0 -1
- package/lib/cjs/components/trees/TreeWithRuleset.d.ts +0 -35
- package/lib/cjs/components/trees/TreeWithRuleset.js +0 -110
- package/lib/cjs/components/trees/TreeWithRuleset.js.map +0 -1
- package/lib/cjs/components/trees/TreeWithRulesetTree.scss +0 -17
- package/lib/esm/components/TreeWidgetControl.d.ts +0 -26
- package/lib/esm/components/TreeWidgetControl.js +0 -59
- package/lib/esm/components/TreeWidgetControl.js.map +0 -1
- package/lib/esm/components/rulesets/ClassificationSystems.json +0 -122
- package/lib/esm/components/trees/ClassificationsTree.d.ts +0 -7
- package/lib/esm/components/trees/ClassificationsTree.js +0 -17
- package/lib/esm/components/trees/ClassificationsTree.js.map +0 -1
- package/lib/esm/components/trees/TreeWithRuleset.d.ts +0 -35
- package/lib/esm/components/trees/TreeWithRuleset.js +0 -85
- package/lib/esm/components/trees/TreeWithRuleset.js.map +0 -1
- package/lib/esm/components/trees/TreeWithRulesetTree.scss +0 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpatialTree.js","sourceRoot":"","sources":["../../../../src/components/trees/SpatialTree.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SpatialTree.js","sourceRoot":"","sources":["../../../../src/components/trees/SpatialTree.tsx"],"names":[],"mappings":";;;;;;AAAA;;;+FAG+F;AAC/F,oDAAuF;AACvF,kDAA0B;AAE1B,kDAA+C;AAExC,MAAM,oBAAoB,GAAG,CAClC,KAAuB,EAAE,EAAE;IAC3B,MAAM,MAAM,GAAG,uCAAyB,EAAE,CAAC;IAE3C,OAAO,CACL,8DACG,MAAM;QACL,8BAAC,qBAAS,QACP,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,8BAAC,oCAAsB,OAAK,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAI,CACjG,CAEb,CACJ,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,oBAAoB,wBAa/B","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*--------------------------------------------------------------------------------------------*/\nimport { SpatialContainmentTree, useActiveIModelConnection } from \"@itwin/appui-react\";\nimport React from \"react\";\nimport type { SpatialTreeProps } from \"../../types\";\nimport { AutoSizer } from \"../utils/AutoSizer\";\n\nexport const SpatialTreeComponent = (\n props: SpatialTreeProps) => {\n const iModel = useActiveIModelConnection();\n\n return (\n <>\n {iModel &&\n <AutoSizer>\n {({ width, height }) => <SpatialContainmentTree {...props} width={width} height={height} iModel={iModel} />}\n </AutoSizer>\n }\n </>\n );\n};\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
|
-
*--------------------------------------------------------------------------------------------*/
|
|
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
6
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
7
|
if (k2 === undefined) k2 = k;
|
|
8
8
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -17,7 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./ModelsTree"), exports);
|
|
18
18
|
__exportStar(require("./CategoriesTree"), exports);
|
|
19
19
|
__exportStar(require("./SpatialTree"), exports);
|
|
20
|
-
__exportStar(require("./ClassificationsTree"), exports);
|
|
21
|
-
__exportStar(require("./TreeWithRuleset"), exports);
|
|
22
20
|
__exportStar(require("./IModelContentTree"), exports);
|
|
23
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/trees/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/trees/index.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;;;;;;;AAEhG,+CAA6B;AAC7B,mDAAiC;AACjC,gDAA8B;AAC9B,sDAAoC","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 * from \"./ModelsTree\";\nexport * from \"./CategoriesTree\";\nexport * from \"./SpatialTree\";\nexport * from \"./IModelContentTree\";\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface Size {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
}
|
|
6
|
+
export interface AutoSizerProps {
|
|
7
|
+
children: (size: Size) => React.ReactElement | null;
|
|
8
|
+
}
|
|
9
|
+
export declare const AutoSizer: (props: AutoSizerProps) => JSX.Element;
|
|
10
|
+
//# sourceMappingURL=AutoSizer.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.AutoSizer = void 0;
|
|
23
|
+
const react_1 = __importStar(require("react"));
|
|
24
|
+
const core_react_1 = require("@itwin/core-react");
|
|
25
|
+
const AutoSizer = (props) => {
|
|
26
|
+
const [height, setHeight] = react_1.useState(0);
|
|
27
|
+
const [width, setWidth] = react_1.useState(0);
|
|
28
|
+
const handleResize = react_1.useCallback((w, h) => {
|
|
29
|
+
setHeight(h);
|
|
30
|
+
setWidth(w);
|
|
31
|
+
}, []);
|
|
32
|
+
const ref = core_react_1.useResizeObserver(handleResize);
|
|
33
|
+
return (react_1.default.createElement("div", { ref: ref, style: { width: "100%", height: "100%" } }, width && height && (props.children({ width, height }))));
|
|
34
|
+
};
|
|
35
|
+
exports.AutoSizer = AutoSizer;
|
|
36
|
+
//# sourceMappingURL=AutoSizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutoSizer.js","sourceRoot":"","sources":["../../../../src/components/utils/AutoSizer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAqD;AACrD,kDAAsD;AAW/C,MAAM,SAAS,GAAG,CAAC,KAAqB,EAAE,EAAE;IACjD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,gBAAQ,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,gBAAQ,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,YAAY,GAAG,mBAAW,CAAC,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE;QACxD,SAAS,CAAC,CAAC,CAAC,CAAC;QACb,QAAQ,CAAC,CAAC,CAAC,CAAC;IACd,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,MAAM,GAAG,GAAG,8BAAiB,CAAiB,YAAY,CAAC,CAAC;IAE5D,OAAO,CACL,uCAAK,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IACpD,KAAK,IAAI,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CACnD,CACP,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,SAAS,aAcpB","sourcesContent":["import React, { useCallback, useState } from \"react\";\nimport { useResizeObserver } from \"@itwin/core-react\";\n\nexport interface Size {\n width: number;\n height: number;\n}\n\nexport interface AutoSizerProps {\n children: (size: Size) => React.ReactElement | null;\n}\n\nexport const AutoSizer = (props: AutoSizerProps) => {\n const [height, setHeight] = useState(0);\n const [width, setWidth] = useState(0);\n const handleResize = useCallback((w: number, h: number) => {\n setHeight(h);\n setWidth(w);\n }, []);\n const ref = useResizeObserver<HTMLDivElement>(handleResize);\n\n return (\n <div ref={ref} style={{ width: \"100%\", height: \"100%\" }}>\n {width && height && (props.children({ width, height }))}\n </div>\n );\n};\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
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
|
-
*--------------------------------------------------------------------------------------------*/
|
|
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
6
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
7
|
if (k2 === undefined) k2 = k;
|
|
8
8
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./types"), exports);
|
|
17
18
|
__exportStar(require("./TreeWidget"), exports);
|
|
18
|
-
__exportStar(require("./components/TreeWidgetControl"), exports);
|
|
19
19
|
__exportStar(require("./components/TreeWidgetComponent"), exports);
|
|
20
20
|
__exportStar(require("./components/header/TreeHeader"), exports);
|
|
21
21
|
__exportStar(require("./components/trees"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-widget-react.js","sourceRoot":"","sources":["../../src/tree-widget-react.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"tree-widget-react.js","sourceRoot":"","sources":["../../src/tree-widget-react.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;;;;;;;;;;AAEhG,0CAAwB;AACxB,+CAA6B;AAC7B,mEAAiD;AACjD,iEAA+C;AAC/C,qDAAmC;AACnC,yEAAuD","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 * from \"./types\";\nexport * from \"./TreeWidget\";\nexport * from \"./components/TreeWidgetComponent\";\nexport * from \"./components/header/TreeHeader\";\nexport * from \"./components/trees\";\nexport * from \"./components/TreeWidgetUiItemsProvider\";\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StagePanelLocation, StagePanelSection } from "@itwin/appui-abstract";
|
|
3
|
+
import type { CategoryTreeProps, ModelsTreeProps, SpatialContainmentTreeProps } from "@itwin/appui-react";
|
|
4
|
+
import type { SelectableContentDefinition } from "@itwin/components-react";
|
|
5
|
+
import type { IModelConnection } from "@itwin/core-frontend";
|
|
6
|
+
export interface IModelContentTreeProps extends Omit<React.AllHTMLAttributes<HTMLDivElement>, "children"> {
|
|
7
|
+
iModel: IModelConnection;
|
|
8
|
+
}
|
|
9
|
+
export declare type ModelTreeProps = Omit<ModelsTreeProps, "iModel" | "activeView" | "width" | "height" | "filterInfo" | "onFilterApplied">;
|
|
10
|
+
export declare type CategoriesTreeProps = Omit<CategoryTreeProps, "iModel" | "activeView" | "width" | "height" | "filterInfo" | "onFilterApplied">;
|
|
11
|
+
export declare type SpatialTreeProps = Omit<SpatialContainmentTreeProps, "iModel" | "width" | "height">;
|
|
12
|
+
export interface TreeWidgetOptions {
|
|
13
|
+
defaultPanelLocation?: StagePanelLocation;
|
|
14
|
+
defaultPanelSection?: StagePanelSection;
|
|
15
|
+
enableElementsClassGrouping?: boolean;
|
|
16
|
+
additionalTrees?: SelectableContentDefinition[];
|
|
17
|
+
modelsTreeProps?: ModelTreeProps;
|
|
18
|
+
categoriesTreeProps?: CategoriesTreeProps;
|
|
19
|
+
spatialTreeProps?: SpatialTreeProps;
|
|
20
|
+
hideTrees?: {
|
|
21
|
+
modelsTree?: boolean;
|
|
22
|
+
categoriesTree?: boolean;
|
|
23
|
+
spatialTree?: boolean;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
package/lib/cjs/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"","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*--------------------------------------------------------------------------------------------*/\nimport type { StagePanelLocation, StagePanelSection } from \"@itwin/appui-abstract\";\nimport type {\n CategoryTreeProps,\n ModelsTreeProps,\n SpatialContainmentTreeProps,\n} from \"@itwin/appui-react\";\nimport type { SelectableContentDefinition } from \"@itwin/components-react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\n\nexport interface IModelContentTreeProps\n extends Omit<React.AllHTMLAttributes<HTMLDivElement>, \"children\"> {\n iModel: IModelConnection;\n}\n\nexport type ModelTreeProps = Omit<\nModelsTreeProps,\n| \"iModel\"\n| \"activeView\"\n| \"width\"\n| \"height\"\n| \"filterInfo\"\n| \"onFilterApplied\"\n>;\n\nexport type CategoriesTreeProps = Omit<\nCategoryTreeProps,\n| \"iModel\"\n| \"activeView\"\n| \"width\"\n| \"height\"\n| \"filterInfo\"\n| \"onFilterApplied\"\n>;\n\nexport type SpatialTreeProps = Omit<\nSpatialContainmentTreeProps,\n\"iModel\" | \"width\" | \"height\"\n>;\n\nexport interface TreeWidgetOptions {\n defaultPanelLocation?: StagePanelLocation;\n defaultPanelSection?: StagePanelSection;\n enableElementsClassGrouping?: boolean;\n additionalTrees?: SelectableContentDefinition[];\n modelsTreeProps?: ModelTreeProps;\n categoriesTreeProps?: CategoriesTreeProps;\n spatialTreeProps?: SpatialTreeProps;\n hideTrees?: {\n modelsTree?: boolean;\n categoriesTree?: boolean;\n spatialTree?: boolean;\n };\n}\n"]}
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import type { AbstractWidgetProps,
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import type { AbstractWidgetProps, UiItemsProvider } from "@itwin/appui-abstract";
|
|
2
|
+
import { StagePanelSection } from "@itwin/appui-abstract";
|
|
3
|
+
import { AbstractZoneLocation, StagePanelLocation } from "@itwin/appui-abstract";
|
|
4
|
+
import type { TreeWidgetOptions } from "../types";
|
|
5
|
+
export declare const TreeWidgetId = "tree-widget-react:trees";
|
|
4
6
|
export declare class TreeWidgetUiItemsProvider implements UiItemsProvider {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
private _allViewports?;
|
|
10
|
-
private _additionalTrees?;
|
|
11
|
-
private _modelsTreeProps?;
|
|
12
|
-
private _categoriesTreeProps?;
|
|
13
|
-
private _spatialTreeProps?;
|
|
14
|
-
private _modelsTreeReplacement?;
|
|
15
|
-
private _categoriesTreeReplacement?;
|
|
16
|
-
private _spatialTreeReplacement?;
|
|
17
|
-
constructor(props?: Partial<TreeWidgetControlOptions>);
|
|
18
|
-
provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, _section: StagePanelSection | undefined): ReadonlyArray<AbstractWidgetProps>;
|
|
7
|
+
private _treeWidgetOptions?;
|
|
8
|
+
readonly id = "TreeWidgetUiItemsProvider";
|
|
9
|
+
constructor(_treeWidgetOptions?: TreeWidgetOptions | undefined);
|
|
10
|
+
provideWidgets(_stageId: string, stageUsage: string, location: StagePanelLocation, section?: StagePanelSection, zoneLocation?: AbstractZoneLocation): ReadonlyArray<AbstractWidgetProps>;
|
|
19
11
|
}
|
|
20
12
|
//# sourceMappingURL=TreeWidgetUiItemsProvider.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StagePanelSection, } from "@itwin/appui-abstract";
|
|
2
|
+
import { AbstractZoneLocation, StagePanelLocation, StageUsage, } from "@itwin/appui-abstract";
|
|
2
3
|
import { ClassGroupingOption, UiFramework } from "@itwin/appui-react";
|
|
3
4
|
import React from "react";
|
|
4
5
|
import { TreeWidgetComponent } from "./TreeWidgetComponent";
|
|
@@ -6,65 +7,67 @@ import { CategoriesTreeComponent } from "./trees/CategoriesTree";
|
|
|
6
7
|
import { ModelsTreeComponent } from "./trees/ModelsTree";
|
|
7
8
|
import { SpatialTreeComponent } from "./trees/SpatialTree";
|
|
8
9
|
import { TreeWidget } from "../TreeWidget";
|
|
10
|
+
export const TreeWidgetId = "tree-widget-react:trees";
|
|
9
11
|
export class TreeWidgetUiItemsProvider {
|
|
10
|
-
constructor(
|
|
11
|
-
|
|
12
|
-
this.id = "
|
|
13
|
-
this._imodel = props === null || props === void 0 ? void 0 : props.iModelConnection;
|
|
14
|
-
this._activeView = props === null || props === void 0 ? void 0 : props.activeView;
|
|
15
|
-
this._enableElementsClassGrouping = props === null || props === void 0 ? void 0 : props.enableElementsClassGrouping;
|
|
16
|
-
this._allViewports = props === null || props === void 0 ? void 0 : props.allViewports;
|
|
17
|
-
this._additionalTrees = props === null || props === void 0 ? void 0 : props.additionalTrees;
|
|
18
|
-
this._modelsTreeProps = (_a = props === null || props === void 0 ? void 0 : props.additionalProps) === null || _a === void 0 ? void 0 : _a.modelsTree;
|
|
19
|
-
this._categoriesTreeProps = (_b = props === null || props === void 0 ? void 0 : props.additionalProps) === null || _b === void 0 ? void 0 : _b.categoriesTree;
|
|
20
|
-
this._spatialTreeProps = (_c = props === null || props === void 0 ? void 0 : props.additionalProps) === null || _c === void 0 ? void 0 : _c.spatialTree;
|
|
21
|
-
this._modelsTreeReplacement = (_d = props === null || props === void 0 ? void 0 : props.treeReplacements) === null || _d === void 0 ? void 0 : _d.modelsTree;
|
|
22
|
-
this._categoriesTreeReplacement = (_e = props === null || props === void 0 ? void 0 : props.treeReplacements) === null || _e === void 0 ? void 0 : _e.categoriesTree;
|
|
23
|
-
this._spatialTreeReplacement = (_f = props === null || props === void 0 ? void 0 : props.treeReplacements) === null || _f === void 0 ? void 0 : _f.spatialTree;
|
|
12
|
+
constructor(_treeWidgetOptions) {
|
|
13
|
+
this._treeWidgetOptions = _treeWidgetOptions;
|
|
14
|
+
this.id = "TreeWidgetUiItemsProvider";
|
|
24
15
|
}
|
|
25
|
-
provideWidgets(_stageId, stageUsage, location,
|
|
26
|
-
|
|
16
|
+
provideWidgets(_stageId, stageUsage, location, section,
|
|
17
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
18
|
+
zoneLocation) {
|
|
19
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
27
20
|
const widgets = [];
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
{
|
|
21
|
+
const preferredLocation = (_b = (_a = this._treeWidgetOptions) === null || _a === void 0 ? void 0 : _a.defaultPanelLocation) !== null && _b !== void 0 ? _b : StagePanelLocation.Right;
|
|
22
|
+
const preferredPanelSection = (_d = (_c = this._treeWidgetOptions) === null || _c === void 0 ? void 0 : _c.defaultPanelSection) !== null && _d !== void 0 ? _d : StagePanelSection.Start;
|
|
23
|
+
if (
|
|
24
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
25
|
+
(!section && stageUsage === StageUsage.General && zoneLocation === AbstractZoneLocation.CenterRight) ||
|
|
26
|
+
(stageUsage === StageUsage.General && location === preferredLocation && section === preferredPanelSection
|
|
27
|
+
&& UiFramework.uiVersion !== "1")) {
|
|
28
|
+
const trees = [];
|
|
29
|
+
if (!((_f = (_e = this._treeWidgetOptions) === null || _e === void 0 ? void 0 : _e.hideTrees) === null || _f === void 0 ? void 0 : _f.modelsTree)) {
|
|
30
|
+
trees.push({
|
|
39
31
|
label: TreeWidget.translate("modeltree"),
|
|
40
32
|
id: "model-tree",
|
|
41
|
-
render:
|
|
42
|
-
|
|
43
|
-
: ()
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
render: () => {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
return (React.createElement(ModelsTreeComponent, { enableElementsClassGrouping: ((_a = this._treeWidgetOptions) === null || _a === void 0 ? void 0 : _a.enableElementsClassGrouping)
|
|
36
|
+
? ClassGroupingOption.YesWithCounts
|
|
37
|
+
: ClassGroupingOption.No, ...(_b = this._treeWidgetOptions) === null || _b === void 0 ? void 0 : _b.modelsTreeProps }));
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (!((_h = (_g = this._treeWidgetOptions) === null || _g === void 0 ? void 0 : _g.hideTrees) === null || _h === void 0 ? void 0 : _h.categoriesTree)) {
|
|
42
|
+
trees.push({
|
|
46
43
|
label: TreeWidget.translate("categories"),
|
|
47
44
|
id: "categories-tree",
|
|
48
|
-
render:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
render: () => {
|
|
46
|
+
var _a;
|
|
47
|
+
return (React.createElement(CategoriesTreeComponent, { ...(_a = this._treeWidgetOptions) === null || _a === void 0 ? void 0 : _a.categoriesTreeProps }));
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (!((_k = (_j = this._treeWidgetOptions) === null || _j === void 0 ? void 0 : _j.hideTrees) === null || _k === void 0 ? void 0 : _k.spatialTree)) {
|
|
52
|
+
trees.push({
|
|
53
53
|
label: TreeWidget.translate("containment"),
|
|
54
54
|
id: "spatial-containment-tree",
|
|
55
|
-
render:
|
|
56
|
-
|
|
57
|
-
: ()
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
render: () => {
|
|
56
|
+
var _a, _b;
|
|
57
|
+
return (React.createElement(SpatialTreeComponent, { enableElementsClassGrouping: ((_a = this._treeWidgetOptions) === null || _a === void 0 ? void 0 : _a.enableElementsClassGrouping)
|
|
58
|
+
? ClassGroupingOption.YesWithCounts
|
|
59
|
+
: ClassGroupingOption.No, ...(_b = this._treeWidgetOptions) === null || _b === void 0 ? void 0 : _b.spatialTreeProps }));
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
if ((_l = this._treeWidgetOptions) === null || _l === void 0 ? void 0 : _l.additionalTrees) {
|
|
64
|
+
trees.push(...this._treeWidgetOptions.additionalTrees);
|
|
62
65
|
}
|
|
63
66
|
widgets.push({
|
|
64
|
-
id:
|
|
67
|
+
id: TreeWidgetId,
|
|
65
68
|
label: TreeWidget.translate("treeview"),
|
|
66
|
-
// eslint-disable-next-line react/display-name
|
|
67
69
|
getWidgetContent: () => React.createElement(TreeWidgetComponent, { trees: trees }),
|
|
70
|
+
icon: "icon-hierarchy-tree",
|
|
68
71
|
});
|
|
69
72
|
}
|
|
70
73
|
return widgets;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeWidgetUiItemsProvider.js","sourceRoot":"","sources":["../../../src/components/TreeWidgetUiItemsProvider.tsx"],"names":[],"mappings":"AASA,OAAO,EACL,kBAAkB,EAClB,UAAU,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"TreeWidgetUiItemsProvider.js","sourceRoot":"","sources":["../../../src/components/TreeWidgetUiItemsProvider.tsx"],"names":[],"mappings":"AASA,OAAO,EACL,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,UAAU,GACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,MAAM,CAAC,MAAM,YAAY,GAAG,yBAAyB,CAAC;AACtD,MAAM,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AE,GAAG,EAAE,CAAC,oBAAC,mBAAmB,IAAC,KAAK,EAAE,KAAK,GAAI;gBAC7D,IAAI,EAAE,qBAAqB;aAC5B,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/* eslint-disable react/display-name */\nimport type {\n AbstractWidgetProps,\n UiItemsProvider,\n} from \"@itwin/appui-abstract\";\nimport {\n StagePanelSection,\n} from \"@itwin/appui-abstract\";\nimport {\n AbstractZoneLocation,\n StagePanelLocation,\n StageUsage,\n} from \"@itwin/appui-abstract\";\nimport { ClassGroupingOption, UiFramework } from \"@itwin/appui-react\";\nimport React from \"react\";\nimport { TreeWidgetComponent } from \"./TreeWidgetComponent\";\nimport { CategoriesTreeComponent } from \"./trees/CategoriesTree\";\nimport { ModelsTreeComponent } from \"./trees/ModelsTree\";\nimport { SpatialTreeComponent } from \"./trees/SpatialTree\";\nimport type { SelectableContentDefinition } from \"@itwin/components-react\";\nimport { TreeWidget } from \"../TreeWidget\";\nimport type { TreeWidgetOptions } from \"../types\";\n\nexport const TreeWidgetId = \"tree-widget-react:trees\";\nexport class TreeWidgetUiItemsProvider implements UiItemsProvider {\n public readonly id = \"TreeWidgetUiItemsProvider\";\n\n constructor(private _treeWidgetOptions?: TreeWidgetOptions) { }\n\n public provideWidgets(\n _stageId: string,\n stageUsage: string,\n location: StagePanelLocation,\n section?: StagePanelSection,\n // eslint-disable-next-line deprecation/deprecation\n zoneLocation?: AbstractZoneLocation,\n ): ReadonlyArray<AbstractWidgetProps> {\n const widgets: AbstractWidgetProps[] = [];\n const preferredLocation = this._treeWidgetOptions?.defaultPanelLocation ?? StagePanelLocation.Right;\n const preferredPanelSection = this._treeWidgetOptions?.defaultPanelSection ?? StagePanelSection.Start;\n if (\n // eslint-disable-next-line deprecation/deprecation\n (!section && stageUsage === StageUsage.General && zoneLocation === AbstractZoneLocation.CenterRight) ||\n (stageUsage === StageUsage.General && location === preferredLocation && section === preferredPanelSection\n && UiFramework.uiVersion !== \"1\")\n ) {\n const trees: SelectableContentDefinition[] = [];\n\n if (!this._treeWidgetOptions?.hideTrees?.modelsTree) {\n trees.push({\n label: TreeWidget.translate(\"modeltree\"),\n id: \"model-tree\",\n render: () => (\n <ModelsTreeComponent\n enableElementsClassGrouping={\n this._treeWidgetOptions?.enableElementsClassGrouping\n ? ClassGroupingOption.YesWithCounts\n : ClassGroupingOption.No\n }\n {...this._treeWidgetOptions?.modelsTreeProps}\n />\n ),\n });\n }\n\n if (!this._treeWidgetOptions?.hideTrees?.categoriesTree) {\n trees.push({\n label: TreeWidget.translate(\"categories\"),\n id: \"categories-tree\",\n render: () => (\n <CategoriesTreeComponent {...this._treeWidgetOptions?.categoriesTreeProps} />\n ),\n });\n }\n\n if (!this._treeWidgetOptions?.hideTrees?.spatialTree) {\n trees.push({\n label: TreeWidget.translate(\"containment\"),\n id: \"spatial-containment-tree\",\n render: () => (\n <SpatialTreeComponent\n enableElementsClassGrouping={\n this._treeWidgetOptions?.enableElementsClassGrouping\n ? ClassGroupingOption.YesWithCounts\n : ClassGroupingOption.No\n }\n {...this._treeWidgetOptions?.spatialTreeProps}\n />\n ),\n });\n }\n\n if (this._treeWidgetOptions?.additionalTrees) {\n trees.push(...this._treeWidgetOptions.additionalTrees);\n }\n\n widgets.push({\n id: TreeWidgetId,\n label: TreeWidget.translate(\"treeview\"),\n getWidgetContent: () => <TreeWidgetComponent trees={trees} />,\n icon: \"icon-hierarchy-tree\",\n });\n }\n\n return widgets;\n }\n}\n"]}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type { IModelConnection, Viewport } from "@itwin/core-frontend";
|
|
3
2
|
import "./CategoriesTree.scss";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
allViewports?: boolean;
|
|
7
|
-
activeView?: Viewport;
|
|
8
|
-
}
|
|
9
|
-
export declare function CategoriesTreeComponent(props: CategoriesTreeComponentProps): JSX.Element;
|
|
3
|
+
import type { CategoriesTreeProps } from "../../types";
|
|
4
|
+
export declare function CategoriesTreeComponent(props: CategoriesTreeProps): JSX.Element;
|
|
10
5
|
//# sourceMappingURL=CategoriesTree.d.ts.map
|
|
@@ -2,39 +2,36 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import React, { useCallback
|
|
5
|
+
import React, { useCallback } from "react";
|
|
6
6
|
import { IModelApp } from "@itwin/core-frontend";
|
|
7
|
-
import { CategoryTree, getCategories, toggleAllCategories } from "@itwin/appui-react";
|
|
7
|
+
import { CategoryTree, getCategories, toggleAllCategories, useActiveIModelConnection, useActiveViewport } from "@itwin/appui-react";
|
|
8
8
|
import { useTreeFilteringState } from "../TreeFilteringState";
|
|
9
9
|
import "./CategoriesTree.scss";
|
|
10
10
|
import { TreeHeaderComponent } from "../header/TreeHeader";
|
|
11
11
|
import { CategoryVisibilityHandler } from "@itwin/appui-react";
|
|
12
|
-
import {
|
|
12
|
+
import { AutoSizer } from "../utils/AutoSizer";
|
|
13
13
|
export function CategoriesTreeComponent(props) {
|
|
14
|
+
const iModel = useActiveIModelConnection();
|
|
15
|
+
const viewport = useActiveViewport();
|
|
14
16
|
const { searchOptions, filterString, activeMatchIndex, onFilterApplied, filteredProvider, } = useTreeFilteringState();
|
|
15
|
-
const [height, setHeight] = useState(0);
|
|
16
|
-
const [width, setWidth] = useState(0);
|
|
17
|
-
const handleResize = useCallback((w, h) => {
|
|
18
|
-
setHeight(h);
|
|
19
|
-
setWidth(w);
|
|
20
|
-
}, []);
|
|
21
|
-
const ref = useResizeObserver(handleResize);
|
|
22
17
|
const showAll = useCallback(async () => {
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
if (!iModel)
|
|
19
|
+
return;
|
|
20
|
+
return toggleAllCategories(IModelApp.viewManager, iModel, true, undefined, true, filteredProvider);
|
|
21
|
+
}, [iModel, filteredProvider]);
|
|
25
22
|
const hideAll = useCallback(async () => {
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
if (!iModel)
|
|
24
|
+
return;
|
|
25
|
+
return toggleAllCategories(IModelApp.viewManager, iModel, false, undefined, true, filteredProvider);
|
|
26
|
+
}, [iModel, filteredProvider]);
|
|
28
27
|
const invert = useCallback(async () => {
|
|
29
|
-
|
|
30
|
-
if (!activeView) {
|
|
28
|
+
if (!iModel || !viewport)
|
|
31
29
|
return;
|
|
32
|
-
|
|
33
|
-
const ids = await getCategories(props.iModel, activeView, filteredProvider);
|
|
30
|
+
const ids = await getCategories(iModel, viewport, filteredProvider);
|
|
34
31
|
const enabled = [];
|
|
35
32
|
const disabled = [];
|
|
36
33
|
for (const id of ids) {
|
|
37
|
-
if (
|
|
34
|
+
if (viewport.view.viewsCategory(id)) {
|
|
38
35
|
enabled.push(id);
|
|
39
36
|
}
|
|
40
37
|
else {
|
|
@@ -42,12 +39,13 @@ export function CategoriesTreeComponent(props) {
|
|
|
42
39
|
}
|
|
43
40
|
}
|
|
44
41
|
// Disable enabled
|
|
45
|
-
CategoryVisibilityHandler.enableCategory(IModelApp.viewManager,
|
|
42
|
+
CategoryVisibilityHandler.enableCategory(IModelApp.viewManager, iModel, enabled, false, true);
|
|
46
43
|
// Enable disabled
|
|
47
|
-
CategoryVisibilityHandler.enableCategory(IModelApp.viewManager,
|
|
48
|
-
}, [
|
|
49
|
-
return (React.createElement(React.Fragment, null,
|
|
50
|
-
React.createElement(
|
|
51
|
-
|
|
44
|
+
CategoryVisibilityHandler.enableCategory(IModelApp.viewManager, iModel, disabled, true, true);
|
|
45
|
+
}, [iModel, viewport, filteredProvider]);
|
|
46
|
+
return (React.createElement(React.Fragment, null, iModel && viewport &&
|
|
47
|
+
React.createElement(React.Fragment, null,
|
|
48
|
+
React.createElement(TreeHeaderComponent, { searchOptions: searchOptions, showAll: showAll, hideAll: hideAll, invert: invert }),
|
|
49
|
+
React.createElement(AutoSizer, null, ({ width, height }) => (React.createElement(CategoryTree, { ...props, iModel: iModel, width: width, height: height, filterInfo: { filter: filterString, activeMatchIndex }, onFilterApplied: onFilterApplied }))))));
|
|
52
50
|
}
|
|
53
51
|
//# sourceMappingURL=CategoriesTree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategoriesTree.js","sourceRoot":"","sources":["../../../../src/components/trees/CategoriesTree.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"CategoriesTree.js","sourceRoot":"","sources":["../../../../src/components/trees/CategoriesTree.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACpI,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,UAAU,uBAAuB,CAAC,KAA0B;IAChE,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAC3C,MAAM,QAAQ,GAAG,iBAAiB,EAAE,CAAC;IAErC,MAAM,EACJ,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,eAAe,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,yBAAyB,CAAC,cAAc,CACtC,SAAS,CAAC,WAAW,EACrB,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,IAAI,CACL,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAEzC,OAAO,CACL,0CACG,MAAM,IAAI,QAAQ;QACjB;YACE,oBAAC,mBAAmB,IAClB,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GACd;YACF,oBAAC,SAAS,QACP,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CACtB,oBAAC,YAAY,OACP,KAAK,EACT,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,EACtD,eAAe,EAAE,eAAe,GAChC,CACH,CACS,CACX,CAEJ,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*--------------------------------------------------------------------------------------------*/\nimport React, { useCallback } from \"react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { CategoryTree, getCategories, toggleAllCategories, useActiveIModelConnection, useActiveViewport } from \"@itwin/appui-react\";\nimport { useTreeFilteringState } from \"../TreeFilteringState\";\nimport \"./CategoriesTree.scss\";\nimport { TreeHeaderComponent } from \"../header/TreeHeader\";\nimport { CategoryVisibilityHandler } from \"@itwin/appui-react\";\nimport type { CategoriesTreeProps } from \"../../types\";\nimport { AutoSizer } from \"../utils/AutoSizer\";\n\nexport function CategoriesTreeComponent(props: CategoriesTreeProps) {\n const iModel = useActiveIModelConnection();\n const viewport = useActiveViewport();\n\n const {\n searchOptions,\n filterString,\n activeMatchIndex,\n onFilterApplied,\n filteredProvider,\n } = useTreeFilteringState();\n\n const showAll = useCallback(async () => {\n if (!iModel) return;\n\n return toggleAllCategories(\n IModelApp.viewManager,\n iModel,\n true,\n undefined,\n true,\n filteredProvider\n );\n }, [iModel, filteredProvider]);\n\n const hideAll = useCallback(async () => {\n if (!iModel) return;\n return toggleAllCategories(\n IModelApp.viewManager,\n iModel,\n false,\n undefined,\n true,\n filteredProvider\n );\n }, [iModel, filteredProvider]);\n\n const invert = useCallback(async () => {\n if (!iModel || !viewport) return;\n\n const ids = await getCategories(iModel, viewport, filteredProvider);\n const enabled: string[] = [];\n const disabled: string[] = [];\n for (const id of ids) {\n if (viewport.view.viewsCategory(id)) {\n enabled.push(id);\n } else {\n disabled.push(id);\n }\n }\n // Disable enabled\n CategoryVisibilityHandler.enableCategory(\n IModelApp.viewManager,\n iModel,\n enabled,\n false,\n true\n );\n // Enable disabled\n CategoryVisibilityHandler.enableCategory(\n IModelApp.viewManager,\n iModel,\n disabled,\n true,\n true\n );\n }, [iModel, viewport, filteredProvider]);\n\n return (\n <>\n {iModel && viewport &&\n <>\n <TreeHeaderComponent\n searchOptions={searchOptions}\n showAll={showAll}\n hideAll={hideAll}\n invert={invert}\n />\n <AutoSizer>\n {({ width, height }) => (\n <CategoryTree\n {...props}\n iModel={iModel}\n width={width}\n height={height}\n filterInfo={{ filter: filterString, activeMatchIndex }}\n onFilterApplied={onFilterApplied}\n />\n )}\n </AutoSizer>\n </>\n }\n </>\n );\n}\n"]}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
export interface IModelContentTreeProps extends Omit<React.AllHTMLAttributes<HTMLDivElement>, "children"> {
|
|
4
|
-
iModel: IModelConnection;
|
|
5
|
-
}
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { IModelContentTreeProps } from "../../types";
|
|
6
3
|
export declare const IModelContentTree: (props: IModelContentTreeProps) => JSX.Element;
|
|
7
4
|
//# sourceMappingURL=IModelContentTree.d.ts.map
|
|
@@ -2,21 +2,14 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import
|
|
6
|
-
import React, { useCallback, useMemo, useState } from "react";
|
|
5
|
+
import React, { useMemo } from "react";
|
|
7
6
|
import { usePresentationTreeNodeLoader } from "@itwin/presentation-components";
|
|
8
7
|
import { ControlledTree, SelectionMode, useTreeEventsHandler, useTreeModel } from "@itwin/components-react";
|
|
9
8
|
import IMODEL_CONTENT_RULESET from "../rulesets/IModelContent.json";
|
|
10
|
-
import {
|
|
9
|
+
import { AutoSizer } from "../utils/AutoSizer";
|
|
10
|
+
import classNames from "classnames";
|
|
11
11
|
export const IModelContentTree = (props) => {
|
|
12
12
|
const { iModel, className, ...divProps } = props;
|
|
13
|
-
const [height, setHeight] = useState(0);
|
|
14
|
-
const [width, setWidth] = useState(0);
|
|
15
|
-
const handleResize = useCallback((w, h) => {
|
|
16
|
-
setHeight(h);
|
|
17
|
-
setWidth(w);
|
|
18
|
-
}, []);
|
|
19
|
-
const ref = useResizeObserver(handleResize);
|
|
20
13
|
const { nodeLoader } = usePresentationTreeNodeLoader({
|
|
21
14
|
imodel: iModel,
|
|
22
15
|
ruleset: IMODEL_CONTENT_RULESET,
|
|
@@ -24,7 +17,8 @@ export const IModelContentTree = (props) => {
|
|
|
24
17
|
appendChildrenCountForGroupingNodes: true,
|
|
25
18
|
});
|
|
26
19
|
const eventHandler = useTreeEventsHandler(useMemo(() => ({ nodeLoader, modelSource: nodeLoader.modelSource, collapsedChildrenDisposalEnabled: true }), [nodeLoader]));
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
const treeModel = useTreeModel(nodeLoader.modelSource);
|
|
21
|
+
return (React.createElement(AutoSizer, null, ({ width, height }) => (React.createElement("div", { ...divProps, className: classNames("imodel-content-tree", className) },
|
|
22
|
+
React.createElement(ControlledTree, { width: width, height: height, nodeLoader: nodeLoader, selectionMode: SelectionMode.None, eventsHandler: eventHandler, model: treeModel, iconsEnabled: true })))));
|
|
29
23
|
};
|
|
30
24
|
//# sourceMappingURL=IModelContentTree.js.map
|