@itwin/tree-widget-react 0.4.0 → 0.4.1

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.
@@ -1,4 +1,5 @@
1
- import type { AbstractWidgetProps, StagePanelSection, UiItemsProvider } from "@itwin/appui-abstract";
1
+ import type { AbstractWidgetProps, UiItemsProvider } from "@itwin/appui-abstract";
2
+ import { StagePanelSection } from "@itwin/appui-abstract";
2
3
  import { AbstractZoneLocation, StagePanelLocation } from "@itwin/appui-abstract";
3
4
  import type { TreeWidgetOptions } from "../types";
4
5
  export declare const TreeWidgetId = "tree-widget-react:trees";
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.TreeWidgetUiItemsProvider = exports.TreeWidgetId = void 0;
7
7
  const appui_abstract_1 = require("@itwin/appui-abstract");
8
+ const appui_abstract_2 = require("@itwin/appui-abstract");
8
9
  const appui_react_1 = require("@itwin/appui-react");
9
10
  const react_1 = __importDefault(require("react"));
10
11
  const TreeWidgetComponent_1 = require("./TreeWidgetComponent");
@@ -21,14 +22,17 @@ class TreeWidgetUiItemsProvider {
21
22
  provideWidgets(_stageId, stageUsage, location, section,
22
23
  // eslint-disable-next-line deprecation/deprecation
23
24
  zoneLocation) {
24
- var _a, _b, _c, _d, _e, _f, _g;
25
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
25
26
  const widgets = [];
27
+ const preferredLocation = (_b = (_a = this._treeWidgetOptions) === null || _a === void 0 ? void 0 : _a.defaultPanelLocation) !== null && _b !== void 0 ? _b : appui_abstract_2.StagePanelLocation.Right;
28
+ const preferredPanelSection = (_d = (_c = this._treeWidgetOptions) === null || _c === void 0 ? void 0 : _c.defaultPanelSection) !== null && _d !== void 0 ? _d : appui_abstract_1.StagePanelSection.Start;
26
29
  if (
27
30
  // eslint-disable-next-line deprecation/deprecation
28
- (!section && stageUsage === appui_abstract_1.StageUsage.General && zoneLocation === appui_abstract_1.AbstractZoneLocation.CenterRight) ||
29
- (stageUsage === appui_abstract_1.StageUsage.General && location === appui_abstract_1.StagePanelLocation.Right && appui_react_1.UiFramework.uiVersion !== "1")) {
31
+ (!section && stageUsage === appui_abstract_2.StageUsage.General && zoneLocation === appui_abstract_2.AbstractZoneLocation.CenterRight) ||
32
+ (stageUsage === appui_abstract_2.StageUsage.General && location === preferredLocation && section === preferredPanelSection
33
+ && appui_react_1.UiFramework.uiVersion !== "1")) {
30
34
  const trees = [];
31
- if (!((_b = (_a = this._treeWidgetOptions) === null || _a === void 0 ? void 0 : _a.hideTrees) === null || _b === void 0 ? void 0 : _b.modelsTree)) {
35
+ if (!((_f = (_e = this._treeWidgetOptions) === null || _e === void 0 ? void 0 : _e.hideTrees) === null || _f === void 0 ? void 0 : _f.modelsTree)) {
32
36
  trees.push({
33
37
  label: TreeWidget_1.TreeWidget.translate("modeltree"),
34
38
  id: "model-tree",
@@ -40,7 +44,7 @@ class TreeWidgetUiItemsProvider {
40
44
  },
41
45
  });
42
46
  }
43
- if (!((_d = (_c = this._treeWidgetOptions) === null || _c === void 0 ? void 0 : _c.hideTrees) === null || _d === void 0 ? void 0 : _d.categoriesTree)) {
47
+ if (!((_h = (_g = this._treeWidgetOptions) === null || _g === void 0 ? void 0 : _g.hideTrees) === null || _h === void 0 ? void 0 : _h.categoriesTree)) {
44
48
  trees.push({
45
49
  label: TreeWidget_1.TreeWidget.translate("categories"),
46
50
  id: "categories-tree",
@@ -50,7 +54,7 @@ class TreeWidgetUiItemsProvider {
50
54
  },
51
55
  });
52
56
  }
53
- if (!((_f = (_e = this._treeWidgetOptions) === null || _e === void 0 ? void 0 : _e.hideTrees) === null || _f === void 0 ? void 0 : _f.spatialTree)) {
57
+ if (!((_k = (_j = this._treeWidgetOptions) === null || _j === void 0 ? void 0 : _j.hideTrees) === null || _k === void 0 ? void 0 : _k.spatialTree)) {
54
58
  trees.push({
55
59
  label: TreeWidget_1.TreeWidget.translate("containment"),
56
60
  id: "spatial-containment-tree",
@@ -62,13 +66,14 @@ class TreeWidgetUiItemsProvider {
62
66
  },
63
67
  });
64
68
  }
65
- if ((_g = this._treeWidgetOptions) === null || _g === void 0 ? void 0 : _g.additionalTrees) {
69
+ if ((_l = this._treeWidgetOptions) === null || _l === void 0 ? void 0 : _l.additionalTrees) {
66
70
  trees.push(...this._treeWidgetOptions.additionalTrees);
67
71
  }
68
72
  widgets.push({
69
73
  id: exports.TreeWidgetId,
70
74
  label: TreeWidget_1.TreeWidget.translate("treeview"),
71
75
  getWidgetContent: () => react_1.default.createElement(TreeWidgetComponent_1.TreeWidgetComponent, { trees: trees }),
76
+ icon: "icon-hierarchy-tree",
72
77
  });
73
78
  }
74
79
  return widgets;
@@ -1 +1 @@
1
- {"version":3,"file":"TreeWidgetUiItemsProvider.js","sourceRoot":"","sources":["../../../src/components/TreeWidgetUiItemsProvider.tsx"],"names":[],"mappings":";;;;;;AAUA,0DAI+B;AAC/B,oDAAsE;AACtE,kDAA0B;AAC1B,+DAA4D;AAC5D,2DAAiE;AACjE,mDAAyD;AACzD,qDAA2D;AAE3D,8CAA2C;AAG9B,QAAA,YAAY,GAAG,yBAAyB,CAAC;AACtD,MAAa,yBAAyB;IAGpC,YAAoB,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;QAF1C,OAAE,GAAG,2BAA2B,CAAC;IAEa,CAAC;IAExD,cAAc,CACnB,QAAgB,EAChB,UAAkB,EAClB,QAA4B,EAC5B,OAA2B;IAC3B,mDAAmD;IACnD,YAAmC;;QAEnC,MAAM,OAAO,GAA0B,EAAE,CAAC;QAC1C;QACE,mDAAmD;QACnD,CAAC,CAAC,OAAO,IAAI,UAAU,KAAK,2BAAU,CAAC,OAAO,IAAI,YAAY,KAAK,qCAAoB,CAAC,WAAW,CAAC;YACpG,CAAC,UAAU,KAAK,2BAAU,CAAC,OAAO,IAAI,QAAQ,KAAK,mCAAkB,CAAC,KAAK,IAAI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ACZ,8BAAC,kCAAoB,IACnB,2BAA2B,EACzB,CAAA,MAAA,IAAI,CAAC,kBAAkB,0CAAE,2BAA2B;gCAClD,CAAC,CAAC,iCAAmB,CAAC,aAAa;gCACnC,CAAC,CAAC,iCAAmB,CAAC,EAAE,KAExB,MAAA,IAAI,CAAC,kBAAkB,0CAAE,gBAAgB,GAC7C,CACH,CAAA;qBAAA;iBACF,CAAC,CAAC;aACJ;YAED,IAAI,MAAA,IAAI,CAAC,kBAAkB,0CAAE,eAAe,EAAE;gBAC5C,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;aACxD;YAED,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,oBAAY;gBAChB,KAAK,EAAE,uBAAU,CAAC,SAAS,CAAC,UAAU,CAAC;gBACvC,gBAAgB,EAAE,GAAG,EAAE,CAAC,8BAAC,yCAAmB,IAAC,KAAK,EAAE,KAAK,GAAI;aAC9D,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA9ED,8DA8EC","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 StagePanelSection,\n UiItemsProvider,\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 if (\n // eslint-disable-next-line deprecation/deprecation\n (!section && stageUsage === StageUsage.General && zoneLocation === AbstractZoneLocation.CenterRight) ||\n (stageUsage === StageUsage.General && location === StagePanelLocation.Right && 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 });\n }\n\n return widgets;\n }\n}\n"]}
1
+ {"version":3,"file":"TreeWidgetUiItemsProvider.js","sourceRoot":"","sources":["../../../src/components/TreeWidgetUiItemsProvider.tsx"],"names":[],"mappings":";;;;;;AASA,0DAE+B;AAC/B,0DAI+B;AAC/B,oDAAsE;AACtE,kDAA0B;AAC1B,+DAA4D;AAC5D,2DAAiE;AACjE,mDAAyD;AACzD,qDAA2D;AAE3D,8CAA2C;AAG9B,QAAA,YAAY,GAAG,yBAAyB,CAAC;AACtD,MAAa,yBAAyB;IAGpC,YAAoB,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;QAF1C,OAAE,GAAG,2BAA2B,CAAC;IAEa,CAAC;IAExD,cAAc,CACnB,QAAgB,EAChB,UAAkB,EAClB,QAA4B,EAC5B,OAA2B;IAC3B,mDAAmD;IACnD,YAAmC;;QAEnC,MAAM,OAAO,GAA0B,EAAE,CAAC;QAC1C,MAAM,iBAAiB,GAAG,MAAA,MAAA,IAAI,CAAC,kBAAkB,0CAAE,oBAAoB,mCAAI,mCAAkB,CAAC,KAAK,CAAC;QACpG,MAAM,qBAAqB,GAAG,MAAA,MAAA,IAAI,CAAC,kBAAkB,0CAAE,mBAAmB,mCAAI,kCAAiB,CAAC,KAAK,CAAC;QACtG;QACE,mDAAmD;QACnD,CAAC,CAAC,OAAO,IAAI,UAAU,KAAK,2BAAU,CAAC,OAAO,IAAI,YAAY,KAAK,qCAAoB,CAAC,WAAW,CAAC;YACpG,CAAC,UAAU,KAAK,2BAAU,CAAC,OAAO,IAAI,QAAQ,KAAK,iBAAiB,IAAI,OAAO,KAAK,qBAAqB;mBACnG,yBAAW,CAAC,SAAS,KAAK,GAAG,CAAC,EACpC;YACA,MAAM,KAAK,G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,kBAAkB,0CAAE,2BAA2B;gCAClD,CAAC,CAAC,iCAAmB,CAAC,aAAa;gCACnC,CAAC,CAAC,iCAAmB,CAAC,EAAE,KAExB,MAAA,IAAI,CAAC,kBAAkB,0CAAE,gBAAgB,GAC7C,CACH,CAAA;qBAAA;iBACF,CAAC,CAAC;aACJ;YAED,IAAI,MAAA,IAAI,CAAC,kBAAkB,0CAAE,eAAe,EAAE;gBAC5C,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;aACxD;YAED,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,oBAAY;gBAChB,KAAK,EAAE,uBAAU,CAAC,SAAS,CAAC,UAAU,CAAC;gBACvC,gBAAgB,EAAE,GAAG,EAAE,CAAC,8BAAC,yCAAmB,IAAC,KAAK,EAAE,KAAK,GAAI;gBAC7D,IAAI,EAAE,qBAAqB;aAC5B,CAAC,CAAC;SACJ;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAlFD,8DAkFC","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,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import type { StagePanelLocation, StagePanelSection } from "@itwin/appui-abstract";
2
3
  import type { CategoryTreeProps, ModelsTreeProps, SpatialContainmentTreeProps } from "@itwin/appui-react";
3
4
  import type { SelectableContentDefinition } from "@itwin/components-react";
4
5
  import type { IModelConnection } from "@itwin/core-frontend";
@@ -9,6 +10,8 @@ export declare type ModelTreeProps = Omit<ModelsTreeProps, "iModel" | "activeVie
9
10
  export declare type CategoriesTreeProps = Omit<CategoryTreeProps, "iModel" | "activeView" | "width" | "height" | "filterInfo" | "onFilterApplied">;
10
11
  export declare type SpatialTreeProps = Omit<SpatialContainmentTreeProps, "iModel" | "width" | "height">;
11
12
  export interface TreeWidgetOptions {
13
+ defaultPanelLocation?: StagePanelLocation;
14
+ defaultPanelSection?: StagePanelSection;
12
15
  enableElementsClassGrouping?: boolean;
13
16
  additionalTrees?: SelectableContentDefinition[];
14
17
  modelsTreeProps?: ModelTreeProps;
@@ -1 +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 {\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 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
+ {"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,4 +1,5 @@
1
- import type { AbstractWidgetProps, StagePanelSection, UiItemsProvider } from "@itwin/appui-abstract";
1
+ import type { AbstractWidgetProps, UiItemsProvider } from "@itwin/appui-abstract";
2
+ import { StagePanelSection } from "@itwin/appui-abstract";
2
3
  import { AbstractZoneLocation, StagePanelLocation } from "@itwin/appui-abstract";
3
4
  import type { TreeWidgetOptions } from "../types";
4
5
  export declare const TreeWidgetId = "tree-widget-react:trees";
@@ -1,3 +1,4 @@
1
+ import { StagePanelSection, } from "@itwin/appui-abstract";
1
2
  import { AbstractZoneLocation, StagePanelLocation, StageUsage, } from "@itwin/appui-abstract";
2
3
  import { ClassGroupingOption, UiFramework } from "@itwin/appui-react";
3
4
  import React from "react";
@@ -15,14 +16,17 @@ export class TreeWidgetUiItemsProvider {
15
16
  provideWidgets(_stageId, stageUsage, location, section,
16
17
  // eslint-disable-next-line deprecation/deprecation
17
18
  zoneLocation) {
18
- var _a, _b, _c, _d, _e, _f, _g;
19
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
19
20
  const widgets = [];
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;
20
23
  if (
21
24
  // eslint-disable-next-line deprecation/deprecation
22
25
  (!section && stageUsage === StageUsage.General && zoneLocation === AbstractZoneLocation.CenterRight) ||
23
- (stageUsage === StageUsage.General && location === StagePanelLocation.Right && UiFramework.uiVersion !== "1")) {
26
+ (stageUsage === StageUsage.General && location === preferredLocation && section === preferredPanelSection
27
+ && UiFramework.uiVersion !== "1")) {
24
28
  const trees = [];
25
- if (!((_b = (_a = this._treeWidgetOptions) === null || _a === void 0 ? void 0 : _a.hideTrees) === null || _b === void 0 ? void 0 : _b.modelsTree)) {
29
+ if (!((_f = (_e = this._treeWidgetOptions) === null || _e === void 0 ? void 0 : _e.hideTrees) === null || _f === void 0 ? void 0 : _f.modelsTree)) {
26
30
  trees.push({
27
31
  label: TreeWidget.translate("modeltree"),
28
32
  id: "model-tree",
@@ -34,7 +38,7 @@ export class TreeWidgetUiItemsProvider {
34
38
  },
35
39
  });
36
40
  }
37
- if (!((_d = (_c = this._treeWidgetOptions) === null || _c === void 0 ? void 0 : _c.hideTrees) === null || _d === void 0 ? void 0 : _d.categoriesTree)) {
41
+ if (!((_h = (_g = this._treeWidgetOptions) === null || _g === void 0 ? void 0 : _g.hideTrees) === null || _h === void 0 ? void 0 : _h.categoriesTree)) {
38
42
  trees.push({
39
43
  label: TreeWidget.translate("categories"),
40
44
  id: "categories-tree",
@@ -44,7 +48,7 @@ export class TreeWidgetUiItemsProvider {
44
48
  },
45
49
  });
46
50
  }
47
- if (!((_f = (_e = this._treeWidgetOptions) === null || _e === void 0 ? void 0 : _e.hideTrees) === null || _f === void 0 ? void 0 : _f.spatialTree)) {
51
+ if (!((_k = (_j = this._treeWidgetOptions) === null || _j === void 0 ? void 0 : _j.hideTrees) === null || _k === void 0 ? void 0 : _k.spatialTree)) {
48
52
  trees.push({
49
53
  label: TreeWidget.translate("containment"),
50
54
  id: "spatial-containment-tree",
@@ -56,13 +60,14 @@ export class TreeWidgetUiItemsProvider {
56
60
  },
57
61
  });
58
62
  }
59
- if ((_g = this._treeWidgetOptions) === null || _g === void 0 ? void 0 : _g.additionalTrees) {
63
+ if ((_l = this._treeWidgetOptions) === null || _l === void 0 ? void 0 : _l.additionalTrees) {
60
64
  trees.push(...this._treeWidgetOptions.additionalTrees);
61
65
  }
62
66
  widgets.push({
63
67
  id: TreeWidgetId,
64
68
  label: TreeWidget.translate("treeview"),
65
69
  getWidgetContent: () => React.createElement(TreeWidgetComponent, { trees: trees }),
70
+ icon: "icon-hierarchy-tree",
66
71
  });
67
72
  }
68
73
  return widgets;
@@ -1 +1 @@
1
- {"version":3,"file":"TreeWidgetUiItemsProvider.js","sourceRoot":"","sources":["../../../src/components/TreeWidgetUiItemsProvider.tsx"],"names":[],"mappings":"AAUA,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,OAAO,yBAAyB;IAGpC,YAAoB,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CAAoB;QAF1C,OAAE,GAAG,2BAA2B,CAAC;IAEa,CAAC;I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AI,CAAC,kBAAkB,0CAAE,mBAAmB,GAAI,CAC9E,CAAA;qBAAA;iBACF,CAAC,CAAC;aACJ;YAED,IAAI,CAAC,CAAA,MAAA,MAAA,IAAI,CAAC,kBAAkB,0CAAE,SAAS,0CAAE,WAAW,CAAA,EAAE;gBACpD,KAAK,CAAC,IAAI,CAAC;oBACT,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,aAAa,CAAC;oBAC1C,EAAE,EAAE,0BAA0B;oBAC9B,MAAM,EAAE,GAAG,EAAE;;wBAAC,OAAA,CACZ,oBAAC,oBAAoB,IACnB,2BAA2B,EACzB,CAAA,MAAA,IAAI,CAAC,kBAAkB,0CAAE,2BAA2B;gCAClD,CAAC,CAAC,mBAAmB,CAAC,aAAa;gCACnC,CAAC,CAAC,mBAAmB,CAAC,EAAE,KAExB,MAAA,IAAI,CAAC,kBAAkB,0CAAE,gBAAgB,GAC7C,CACH,CAAA;qBAAA;iBACF,CAAC,CAAC;aACJ;YAED,IAAI,MAAA,IAAI,CAAC,kBAAkB,0CAAE,eAAe,EAAE;gBAC5C,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;aACxD;YAED,OAAO,CAAC,IAAI,CAAC;gBACX,EAAE,EAAE,YAAY;gBAChB,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC;gBACvC,gBAAgB,EAAE,GAAG,EAAE,CAAC,oBAAC,mBAAmB,IAAC,KAAK,EAAE,KAAK,GAAI;aAC9D,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 StagePanelSection,\n UiItemsProvider,\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 if (\n // eslint-disable-next-line deprecation/deprecation\n (!section && stageUsage === StageUsage.General && zoneLocation === AbstractZoneLocation.CenterRight) ||\n (stageUsage === StageUsage.General && location === StagePanelLocation.Right && 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 });\n }\n\n return widgets;\n }\n}\n"]}
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,OAAO,yBAAyB;IAGpC,YAAoB,kBAAsC;QAAtC,uBAAkB,GAAlB,kBAAkB,CA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C7D,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,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import type { StagePanelLocation, StagePanelSection } from "@itwin/appui-abstract";
2
3
  import type { CategoryTreeProps, ModelsTreeProps, SpatialContainmentTreeProps } from "@itwin/appui-react";
3
4
  import type { SelectableContentDefinition } from "@itwin/components-react";
4
5
  import type { IModelConnection } from "@itwin/core-frontend";
@@ -9,6 +10,8 @@ export declare type ModelTreeProps = Omit<ModelsTreeProps, "iModel" | "activeVie
9
10
  export declare type CategoriesTreeProps = Omit<CategoryTreeProps, "iModel" | "activeView" | "width" | "height" | "filterInfo" | "onFilterApplied">;
10
11
  export declare type SpatialTreeProps = Omit<SpatialContainmentTreeProps, "iModel" | "width" | "height">;
11
12
  export interface TreeWidgetOptions {
13
+ defaultPanelLocation?: StagePanelLocation;
14
+ defaultPanelSection?: StagePanelSection;
12
15
  enableElementsClassGrouping?: boolean;
13
16
  additionalTrees?: SelectableContentDefinition[];
14
17
  modelsTreeProps?: ModelTreeProps;
@@ -1 +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 {\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 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
+ {"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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/tree-widget-react",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Tree Widget React",
5
5
  "keywords": [
6
6
  "Bentley",
@@ -36,9 +36,12 @@
36
36
  "@itwin/core-frontend": "^3.0.0",
37
37
  "@itwin/core-geometry": "^3.0.0",
38
38
  "@itwin/core-i18n": "^3.0.0",
39
+ "@itwin/core-markup": "^3.0.0",
40
+ "@itwin/core-orbitgt": "^3.0.0",
39
41
  "@itwin/core-quantity": "^3.0.0",
40
42
  "@itwin/core-react": "^3.0.0",
41
43
  "@itwin/eslint-plugin": "^3.0.0",
44
+ "@itwin/imodel-components-react": "^3.0.0",
42
45
  "@itwin/presentation-common": "^3.0.0",
43
46
  "@itwin/presentation-components": "^3.0.0",
44
47
  "@itwin/presentation-frontend": "^3.0.0",
@@ -91,5 +94,6 @@
91
94
  "test": "",
92
95
  "clean": "rimraf lib .rush/temp/package-deps*.json",
93
96
  "rebuild": "npm run clean && npm run build"
94
- }
97
+ },
98
+ "readme": "# @itwin/tree-widget-react\n\nCopyright © Bentley Systems, Incorporated. All rights reserved.\n\nThe tree-widget-react package provides React components to access Models and Categories within an iModel via a UiProvider, `TreeWidgetUiItemsProvider`.\n\nThe package also provides the underlying component, `TreeWidgetComponent`, which you can wrap within your own custom UiProvider and pass in your own custom trees to display.\n\n## Usage\n\n### What to add in your iTwin AppUI based application\n\nWith a few short lines, you can add the tree widget to your app.\n\n#### Call TreeWidget.initialize() **_before_** making use of the provided Tree Widget Provider\n\n```ts\nimport { TreeWidget } from \"@itwin/tree-widget-react\";\n...\nawait TreeWidget.initialize(IModelApp.localization);\n```\n\n#### Register Tree Widget Provider\n\n```ts\nimport { UiItemsManager } from \"@itwin/appui-abstract\";\nimport { TreeWidgetUiItemsProvider } from \"@itwin/tree-widget-react\";\n...\nUiItemsManager.register(\n new TreeWidgetUiItemsProvider({ ...TreeWidgetOptions })\n);\n```\n\n### Additional trees avaialable\n\n#### IModelContentTree\n\nComponent that displays a hierarchy with content of a given `IModelConnection`.\n\n##### Resulting hierarchy\n\n- Root Subject\n - Child Subjects\n - Target Model\n - Spatial Categories of top-assemblies in the Model (if model is a GeometricModel3d)\n - Top-assemblies in the model and category\n - Child elements of the assembly\n - Drawing Categories of top-assemblies in the Model (if model is a GeometricModel2d)\n - Top-assemblies in the model and category\n - Child elements of the assembly\n - Top-assemblies in the Model (if model is neither GeometricModel3d nor GeometricModel2d)\n - Child elements of the assembly\n\nIn addition, for every modeled element we show content of the model as children for the element's node.\n\nMore details about Subjects and Models can be found here:\n\n- <https://www.imodeljs.org/bis/intro/information-hierarchy/>\n- <https://www.imodeljs.org/bis/intro/organizing-models-and-elements/>\n\nMore details about the hierarchy can be found in the [presentation ruleset JSON file](./src/components/rulesets/IModelContent.json).\n"
95
99
  }