@itwin/tree-widget-react 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +30 -1
  2. package/lib/cjs/components/IconButton.scss +2 -2
  3. package/lib/cjs/components/TreeWidgetComponent.d.ts +1 -0
  4. package/lib/cjs/components/TreeWidgetComponent.scss +1 -1
  5. package/lib/cjs/components/TreeWidgetUiItemsProvider.d.ts +7 -16
  6. package/lib/cjs/components/TreeWidgetUiItemsProvider.js +45 -47
  7. package/lib/cjs/components/TreeWidgetUiItemsProvider.js.map +1 -1
  8. package/lib/cjs/components/header/TreeHeader.d.ts +1 -0
  9. package/lib/cjs/components/header/TreeHeader.scss +1 -1
  10. package/lib/cjs/components/rulesets/IModelContent.json +435 -0
  11. package/lib/cjs/components/search-bar/Popup.scss +1 -1
  12. package/lib/cjs/components/search-bar/SearchBar.scss +1 -1
  13. package/lib/cjs/components/search-bar/SearchBox.scss +1 -1
  14. package/lib/cjs/components/trees/CategoriesTree.d.ts +3 -7
  15. package/lib/cjs/components/trees/CategoriesTree.js +21 -23
  16. package/lib/cjs/components/trees/CategoriesTree.js.map +1 -1
  17. package/lib/cjs/components/trees/CategoriesTree.scss +1 -1
  18. package/lib/cjs/components/trees/IModelContentTree.d.ts +4 -0
  19. package/lib/cjs/components/trees/{ClassificationsTree.js → IModelContentTree.js} +19 -12
  20. package/lib/cjs/components/trees/IModelContentTree.js.map +1 -0
  21. package/lib/cjs/components/trees/ModelsTree.d.ts +3 -8
  22. package/lib/cjs/components/trees/ModelsTree.js +8 -16
  23. package/lib/cjs/components/trees/ModelsTree.js.map +1 -1
  24. package/lib/cjs/components/trees/ModelsTree.scss +1 -1
  25. package/lib/cjs/components/trees/SpatialTree.d.ts +3 -2
  26. package/lib/cjs/components/trees/SpatialTree.js +11 -28
  27. package/lib/cjs/components/trees/SpatialTree.js.map +1 -1
  28. package/lib/cjs/components/trees/index.d.ts +1 -2
  29. package/lib/cjs/components/trees/index.js +5 -6
  30. package/lib/cjs/components/trees/index.js.map +1 -1
  31. package/lib/cjs/components/utils/AutoSizer.d.ts +10 -0
  32. package/lib/cjs/components/utils/AutoSizer.js +36 -0
  33. package/lib/cjs/components/utils/AutoSizer.js.map +1 -0
  34. package/lib/cjs/tree-widget-react.d.ts +1 -1
  35. package/lib/cjs/tree-widget-react.js +4 -4
  36. package/lib/cjs/tree-widget-react.js.map +1 -1
  37. package/lib/cjs/types.d.ts +23 -0
  38. package/lib/cjs/types.js +3 -0
  39. package/lib/cjs/types.js.map +1 -0
  40. package/lib/esm/components/IconButton.scss +2 -2
  41. package/lib/esm/components/TreeWidgetComponent.d.ts +1 -0
  42. package/lib/esm/components/TreeWidgetComponent.scss +1 -1
  43. package/lib/esm/components/TreeWidgetUiItemsProvider.d.ts +7 -16
  44. package/lib/esm/components/TreeWidgetUiItemsProvider.js +45 -47
  45. package/lib/esm/components/TreeWidgetUiItemsProvider.js.map +1 -1
  46. package/lib/esm/components/header/TreeHeader.d.ts +1 -0
  47. package/lib/esm/components/header/TreeHeader.scss +1 -1
  48. package/lib/esm/components/rulesets/IModelContent.json +435 -0
  49. package/lib/esm/components/search-bar/Popup.scss +1 -1
  50. package/lib/esm/components/search-bar/SearchBar.scss +1 -1
  51. package/lib/esm/components/search-bar/SearchBox.scss +1 -1
  52. package/lib/esm/components/trees/CategoriesTree.d.ts +3 -7
  53. package/lib/esm/components/trees/CategoriesTree.js +23 -25
  54. package/lib/esm/components/trees/CategoriesTree.js.map +1 -1
  55. package/lib/esm/components/trees/CategoriesTree.scss +1 -1
  56. package/lib/esm/components/trees/IModelContentTree.d.ts +4 -0
  57. package/lib/esm/components/trees/IModelContentTree.js +24 -0
  58. package/lib/esm/components/trees/IModelContentTree.js.map +1 -0
  59. package/lib/esm/components/trees/ModelsTree.d.ts +3 -8
  60. package/lib/esm/components/trees/ModelsTree.js +9 -17
  61. package/lib/esm/components/trees/ModelsTree.js.map +1 -1
  62. package/lib/esm/components/trees/ModelsTree.scss +1 -1
  63. package/lib/esm/components/trees/SpatialTree.d.ts +3 -2
  64. package/lib/esm/components/trees/SpatialTree.js +10 -11
  65. package/lib/esm/components/trees/SpatialTree.js.map +1 -1
  66. package/lib/esm/components/trees/index.d.ts +1 -2
  67. package/lib/esm/components/trees/index.js +4 -5
  68. package/lib/esm/components/trees/index.js.map +1 -1
  69. package/lib/esm/components/utils/AutoSizer.d.ts +10 -0
  70. package/lib/esm/components/utils/AutoSizer.js +13 -0
  71. package/lib/esm/components/utils/AutoSizer.js.map +1 -0
  72. package/lib/esm/tree-widget-react.d.ts +1 -1
  73. package/lib/esm/tree-widget-react.js +4 -4
  74. package/lib/esm/tree-widget-react.js.map +1 -1
  75. package/lib/esm/types.d.ts +23 -0
  76. package/lib/esm/types.js +2 -0
  77. package/lib/esm/types.js.map +1 -0
  78. package/package.json +1 -2
  79. package/lib/cjs/components/TreeWidgetControl.d.ts +0 -26
  80. package/lib/cjs/components/TreeWidgetControl.js +0 -66
  81. package/lib/cjs/components/TreeWidgetControl.js.map +0 -1
  82. package/lib/cjs/components/rulesets/ClassificationSystems.json +0 -122
  83. package/lib/cjs/components/trees/ClassificationsTree.d.ts +0 -6
  84. package/lib/cjs/components/trees/ClassificationsTree.js.map +0 -1
  85. package/lib/cjs/components/trees/TreeWithRuleset.d.ts +0 -35
  86. package/lib/cjs/components/trees/TreeWithRuleset.js +0 -110
  87. package/lib/cjs/components/trees/TreeWithRuleset.js.map +0 -1
  88. package/lib/cjs/components/trees/TreeWithRulesetTree.scss +0 -17
  89. package/lib/esm/components/TreeWidgetControl.d.ts +0 -26
  90. package/lib/esm/components/TreeWidgetControl.js +0 -59
  91. package/lib/esm/components/TreeWidgetControl.js.map +0 -1
  92. package/lib/esm/components/rulesets/ClassificationSystems.json +0 -122
  93. package/lib/esm/components/trees/ClassificationsTree.d.ts +0 -6
  94. package/lib/esm/components/trees/ClassificationsTree.js +0 -17
  95. package/lib/esm/components/trees/ClassificationsTree.js.map +0 -1
  96. package/lib/esm/components/trees/TreeWithRuleset.d.ts +0 -35
  97. package/lib/esm/components/trees/TreeWithRuleset.js +0 -85
  98. package/lib/esm/components/trees/TreeWithRuleset.js.map +0 -1
  99. package/lib/esm/components/trees/TreeWithRulesetTree.scss +0 -17
@@ -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,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACtF,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;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAQtD,MAAM,UAAU,uBAAuB,CAAC,KAAmC;IACzE,MAAM,EACJ,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,GACjB,GAAG,qBAAqB,EAAE,CAAC;IAE5B,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,YAAY,GAAG,WAAW,CAAC,CAAC,CAAS,EAAE,CAAS,EAAE,EAAE;QACxD,SAAS,CAAC,CAAC,CAAC,CAAC;QACb,QAAQ,CAAC,CAAC,CAAC,CAAC;IACd,CAAC,EAAE,EAAE,C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AK,CAAC,MAAM,EACZ,OAAO,EACP,KAAK,EACL,IAAI,CACL,CAAC;QACF,kBAAkB;QAClB,yBAAyB,CAAC,cAAc,CACtC,SAAS,CAAC,WAAW,EACrB,KAAK,CAAC,MAAM,EACZ,QAAQ,EACR,IAAI,EACJ,IAAI,CACL,CAAC;IACJ,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;IAErC,OAAO,CACL;QACE,oBAAC,mBAAmB,IAClB,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GACd;QACF,6BAAK,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IACpD,KAAK,IAAI,MAAM,IAAI,CAClB,oBAAC,YAAY,OACP,KAAK,EACT,UAAU,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,EACtD,eAAe,EAAE,eAAe,EAChC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,GACd,CACH,CACG,CACL,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, useState } from \"react\";\nimport type { IModelConnection, Viewport } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { CategoryTree, getCategories, toggleAllCategories } from \"@itwin/appui-react\";\nimport { useTreeFilteringState } from \"../TreeFilteringState\";\nimport \"./CategoriesTree.scss\";\nimport { TreeHeaderComponent } from \"../header/TreeHeader\";\nimport { CategoryVisibilityHandler } from \"@itwin/appui-react\";\nimport { useResizeObserver } from \"@itwin/core-react\";\n\nexport interface CategoriesTreeComponentProps {\n iModel: IModelConnection;\n allViewports?: boolean;\n activeView?: Viewport;\n}\n\nexport function CategoriesTreeComponent(props: CategoriesTreeComponentProps) {\n const {\n searchOptions,\n filterString,\n activeMatchIndex,\n onFilterApplied,\n filteredProvider,\n } = useTreeFilteringState();\n\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 const showAll = useCallback(async () => {\n return toggleAllCategories(\n IModelApp.viewManager,\n props.iModel,\n true,\n undefined,\n true,\n filteredProvider\n );\n }, [props.iModel, filteredProvider]);\n\n const hideAll = useCallback(async () => {\n return toggleAllCategories(\n IModelApp.viewManager,\n props.iModel,\n false,\n undefined,\n true,\n filteredProvider\n );\n }, [props.iModel, filteredProvider]);\n\n const invert = useCallback(async () => {\n const activeView = IModelApp.viewManager.getFirstOpenView();\n if (!activeView) {\n return;\n }\n\n const ids = await getCategories(props.iModel, activeView, filteredProvider);\n const enabled: string[] = [];\n const disabled: string[] = [];\n for (const id of ids) {\n if (activeView.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 props.iModel,\n enabled,\n false,\n true\n );\n // Enable disabled\n CategoryVisibilityHandler.enableCategory(\n IModelApp.viewManager,\n props.iModel,\n disabled,\n true,\n true\n );\n }, [props.iModel, filteredProvider]);\n\n return (\n <>\n <TreeHeaderComponent\n searchOptions={searchOptions}\n showAll={showAll}\n hideAll={hideAll}\n invert={invert}\n />\n <div ref={ref} style={{ width: \"100%\", height: \"100%\" }}>\n {width && height && (\n <CategoryTree\n {...props}\n filterInfo={{ filter: filterString, activeMatchIndex }}\n onFilterApplied={onFilterApplied}\n width={width}\n height={height}\n />\n )}\n </div>\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"CategoriesTree.js","sourceRoot":"","sources":["../../../../src/components/trees/CategoriesTree.t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,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"]}
@@ -2,7 +2,7 @@
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 "~@itwin/core-react/lib/esm/core-react/index";
5
+ @import "~@itwin/core-react/lib/cjs/core-react/index";
6
6
 
7
7
  .tree-widget-category-tree-search-bar {
8
8
  margin-bottom: $uicore-s;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import type { IModelContentTreeProps } from "../../types";
3
+ export declare const IModelContentTree: (props: IModelContentTreeProps) => JSX.Element;
4
+ //# sourceMappingURL=IModelContentTree.d.ts.map
@@ -0,0 +1,24 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import React, { useMemo } from "react";
6
+ import { usePresentationTreeNodeLoader } from "@itwin/presentation-components";
7
+ import { ControlledTree, SelectionMode, useTreeEventsHandler, useTreeModel } from "@itwin/components-react";
8
+ import IMODEL_CONTENT_RULESET from "../rulesets/IModelContent.json";
9
+ import { AutoSizer } from "../utils/AutoSizer";
10
+ import classNames from "classnames";
11
+ export const IModelContentTree = (props) => {
12
+ const { iModel, className, ...divProps } = props;
13
+ const { nodeLoader } = usePresentationTreeNodeLoader({
14
+ imodel: iModel,
15
+ ruleset: IMODEL_CONTENT_RULESET,
16
+ pagingSize: 20,
17
+ appendChildrenCountForGroupingNodes: true,
18
+ });
19
+ const eventHandler = useTreeEventsHandler(useMemo(() => ({ nodeLoader, modelSource: nodeLoader.modelSource, collapsedChildrenDisposalEnabled: true }), [nodeLoader]));
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 })))));
23
+ };
24
+ //# sourceMappingURL=IModelContentTree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IModelContentTree.js","sourceRoot":"","sources":["../../../../src/components/trees/IModelContentTree.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5G,OAAO,sBAAsB,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,UAAU,MAAM,YAAY,CAAC;AAGpC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAA6B,EAAE,EAAE;IACjE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEjD,MAAM,EAAE,UAAU,EAAE,GAAG,6BAA6B,CAAC;QACnD,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,sBAAiC;QAC1C,UAAU,EAAE,EAAE;QACd,mCAAmC,EAAE,IAAI;KAC1C,CAAC,CAAC;IACH,MAAM,YAAY,GAAG,oBAAoB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC,WAAW,EAAE,gCAAgC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAEtK,MAAM,SAAS,GAAG,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAEvD,OAAO,CACL,oBAAC,SAAS,QACP,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CACtB,gCAAS,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,qBAAqB,EAAE,SAAS,CAAC;QACxE,oBAAC,cAAc,IACb,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,CAAC,IAAI,EACjC,aAAa,EAAE,YAAY,EAC3B,KAAK,EAAE,SAAS,EAChB,YAAY,EAAE,IAAI,GAClB,CACE,CACP,CACS,CACb,CAAC;AACJ,CAAC,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, { useMemo } from \"react\";\nimport type { Ruleset } from \"@itwin/presentation-common\";\nimport { usePresentationTreeNodeLoader } from \"@itwin/presentation-components\";\nimport { ControlledTree, SelectionMode, useTreeEventsHandler, useTreeModel } from \"@itwin/components-react\";\nimport IMODEL_CONTENT_RULESET from \"../rulesets/IModelContent.json\";\nimport { AutoSizer } from \"../utils/AutoSizer\";\nimport classNames from \"classnames\";\nimport type { IModelContentTreeProps } from \"../../types\";\n\nexport const IModelContentTree = (props: IModelContentTreeProps) => {\n const { iModel, className, ...divProps } = props;\n\n const { nodeLoader } = usePresentationTreeNodeLoader({\n imodel: iModel,\n ruleset: IMODEL_CONTENT_RULESET as Ruleset,\n pagingSize: 20,\n appendChildrenCountForGroupingNodes: true,\n });\n const eventHandler = useTreeEventsHandler(useMemo(() => ({ nodeLoader, modelSource: nodeLoader.modelSource, collapsedChildrenDisposalEnabled: true }), [nodeLoader]));\n\n const treeModel = useTreeModel(nodeLoader.modelSource);\n\n return (\n <AutoSizer>\n {({ width, height }) => (\n <div {...divProps} className={classNames(\"imodel-content-tree\", className)}>\n <ControlledTree\n width={width}\n height={height}\n nodeLoader={nodeLoader}\n selectionMode={SelectionMode.None}\n eventsHandler={eventHandler}\n model={treeModel}\n iconsEnabled={true}\n />\n </div>\n )}\n </AutoSizer>\n );\n};\n"]}
@@ -1,10 +1,5 @@
1
- import type { IModelConnection, Viewport } from "@itwin/core-frontend";
1
+ /// <reference types="react" />
2
2
  import "./ModelsTree.scss";
3
- export interface ModelTreeProps {
4
- iModel: IModelConnection;
5
- allViewports?: boolean;
6
- activeView?: Viewport;
7
- enableElementsClassGrouping?: boolean;
8
- }
9
- export declare const ModelsTreeComponent: (props: ModelTreeProps) => JSX.Element | null;
3
+ import type { ModelTreeProps } from "../../types";
4
+ export declare const ModelsTreeComponent: (props: ModelTreeProps) => JSX.Element;
10
5
  //# sourceMappingURL=ModelsTree.d.ts.map
@@ -3,13 +3,12 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import React, { useCallback, useEffect, useState } from "react";
6
- import { ClassGroupingOption, ModelsTree, useActiveViewport } from "@itwin/appui-react";
6
+ import { ModelsTree, useActiveIModelConnection, useActiveViewport } from "@itwin/appui-react";
7
7
  import { useTreeFilteringState } from "../TreeFilteringState";
8
8
  import "./ModelsTree.scss";
9
9
  import { TreeHeaderComponent } from "../header/TreeHeader";
10
- import { useResizeObserver } from "@itwin/core-react";
10
+ import { AutoSizer } from "../utils/AutoSizer";
11
11
  export const ModelsTreeComponent = (props) => {
12
- const { iModel } = props;
13
12
  const [is2dToggleActive, setIs2dToggleActive] = useState(false);
14
13
  const [is3dToggleActive, setIs3dToggleActive] = useState(false);
15
14
  const [icon2dToggle, setIcon2dToggle] = useState("icon-visibility");
@@ -17,23 +16,18 @@ export const ModelsTreeComponent = (props) => {
17
16
  const [available2dModels, setAvailable2dModels] = useState([]);
18
17
  const [available3dModels, setAvailable3dModels] = useState([]);
19
18
  const [availableModels, setAvailableModels] = useState([]);
19
+ const iModel = useActiveIModelConnection();
20
20
  const viewport = useActiveViewport();
21
21
  const { searchOptions, filterString, activeMatchIndex, onFilterApplied } = useTreeFilteringState();
22
- const [height, setHeight] = useState(0);
23
- const [width, setWidth] = useState(0);
24
- const handleResize = useCallback((w, h) => {
25
- setHeight(h);
26
- setWidth(w);
27
- }, []);
28
- const ref = useResizeObserver(handleResize);
29
22
  const queryModels = useCallback(async (vp) => {
23
+ var _a;
30
24
  if (vp === undefined)
31
25
  return [];
32
26
  const queryParams = {
33
27
  from: "BisCore.GeometricModel3d",
34
28
  wantPrivate: false,
35
29
  };
36
- const modelProps = await iModel.models.queryProps(queryParams);
30
+ const modelProps = (_a = await (iModel === null || iModel === void 0 ? void 0 : iModel.models.queryProps(queryParams))) !== null && _a !== void 0 ? _a : [];
37
31
  return modelProps
38
32
  .map(({ id, isPlanProjection }) => ({ id, isPlanProjection }))
39
33
  .filter(({ id }) => id);
@@ -102,11 +96,9 @@ export const ModelsTreeComponent = (props) => {
102
96
  }
103
97
  viewport === null || viewport === void 0 ? void 0 : viewport.invalidateScene();
104
98
  }, [is3dToggleActive, viewport, available3dModels]);
105
- return (!(iModel && viewport) ? null : (React.createElement(React.Fragment, null,
106
- React.createElement(TreeHeaderComponent, { searchOptions: searchOptions, showAll: showAll, hideAll: hideAll, invert: invert, toggle2D: viewToggle2D, toggle2DIcon: icon2dToggle, toggle3D: viewToggle3D, toggle3DIcon: icon3dToggle }),
107
- React.createElement("div", { className: "tree-widget-models-tree-container" },
108
- React.createElement("div", { ref: ref, style: { width: "100%", height: "100%" } }, width && height && (React.createElement(ModelsTree, { ...props, filterInfo: { filter: filterString, activeMatchIndex }, onFilterApplied: onFilterApplied, activeView: viewport, enableElementsClassGrouping: props.enableElementsClassGrouping
109
- ? ClassGroupingOption.YesWithCounts
110
- : ClassGroupingOption.No, width: width, height: height })))))));
99
+ return (React.createElement(React.Fragment, null, iModel && viewport &&
100
+ React.createElement(React.Fragment, null,
101
+ React.createElement(TreeHeaderComponent, { searchOptions: searchOptions, showAll: showAll, hideAll: hideAll, invert: invert, toggle2D: viewToggle2D, toggle2DIcon: icon2dToggle, toggle3D: viewToggle3D, toggle3DIcon: icon3dToggle }),
102
+ React.createElement(AutoSizer, null, ({ width, height }) => (React.createElement(ModelsTree, { ...props, iModel: iModel, activeView: viewport, width: width, height: height, filterInfo: { filter: filterString, activeMatchIndex }, onFilterApplied: onFilterApplied }))))));
111
103
  };
112
104
  //# sourceMappingURL=ModelsTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModelsTree.js","sourceRoot":"","sources":["../../../../src/components/trees/ModelsTree.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,mBAAmB,CAAC;AAK3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AActD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAqB,EAAE,EAAE;IAC3D,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEzB,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;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E,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAEpD,OAAO,CAAC,CAAC,CAAC,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACrC;QACE,oBAAC,mBAAmB,IAClB,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,YAAY,EACtB,YAAY,EAAE,YAAY,GAC1B;QACF,6BAAK,SAAS,EAAC,mCAAmC;YAChD,6BAAK,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IACpD,KAAK,IAAI,MAAM,IAAI,CAClB,oBAAC,UAAU,OACL,KAAK,EACT,UAAU,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,EACtD,eAAe,EAAE,eAAe,EAChC,UAAU,EAAE,QAAQ,EACpB,2BAA2B,EACzB,KAAK,CAAC,2BAA2B;oBAC/B,CAAC,CAAC,mBAAmB,CAAC,aAAa;oBACnC,CAAC,CAAC,mBAAmB,CAAC,EAAE,EAE5B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,GACd,CACH,CACG,CACF,CACL,CACJ,CAAC,CAAC;AACL,CAAC,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 React, { useCallback, useEffect, useState } from \"react\";\nimport type { IModelConnection, Viewport } from \"@itwin/core-frontend\";\nimport { ClassGroupingOption, ModelsTree, useActiveViewport } from \"@itwin/appui-react\";\nimport { useTreeFilteringState } from \"../TreeFilteringState\";\nimport \"./ModelsTree.scss\";\nimport type {\n GeometricModel3dProps,\n ModelQueryParams,\n} from \"@itwin/core-common\";\nimport { TreeHeaderComponent } from \"../header/TreeHeader\";\nimport { useResizeObserver } from \"@itwin/core-react\";\n\nexport interface ModelTreeProps {\n iModel: IModelConnection;\n allViewports?: boolean;\n activeView?: Viewport;\n enableElementsClassGrouping?: boolean;\n}\n\ninterface TreeViewModelInfo {\n id: string;\n isPlanProjection?: boolean;\n}\n\nexport const ModelsTreeComponent = (props: ModelTreeProps) => {\n const { iModel } = props;\n\n const [is2dToggleActive, setIs2dToggleActive] = useState<boolean>(false);\n const [is3dToggleActive, setIs3dToggleActive] = useState<boolean>(false);\n const [icon2dToggle, setIcon2dToggle] = useState<string>(\"icon-visibility\");\n const [icon3dToggle, setIcon3dToggle] = useState<string>(\"icon-visibility\");\n\n const [available2dModels, setAvailable2dModels] = useState<string[]>([]);\n const [available3dModels, setAvailable3dModels] = useState<string[]>([]);\n const [availableModels, setAvailableModels] = useState<string[]>([]);\n\n const viewport = useActiveViewport();\n\n const { searchOptions, filterString, activeMatchIndex, onFilterApplied } =\n useTreeFilteringState();\n\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 const queryModels = useCallback(async (\n vp: Viewport | undefined\n ): Promise<TreeViewModelInfo[]> => {\n if (vp === undefined) return [];\n\n const queryParams: ModelQueryParams = {\n from: \"BisCore.GeometricModel3d\",\n wantPrivate: false,\n };\n const modelProps = await iModel.models.queryProps(queryParams);\n return modelProps\n .map(({ id, isPlanProjection }: GeometricModel3dProps) => ({ id, isPlanProjection }))\n .filter(({ id }) => id) as TreeViewModelInfo[];\n }, [iModel]);\n\n useEffect(() => {\n queryModels(viewport)\n .then((modelInfos: TreeViewModelInfo[]) => {\n setAvailableModels(modelInfos.map(({ id }) => id));\n\n const { models2d, models3d } = modelInfos.reduce((acc, { id, isPlanProjection }) => {\n isPlanProjection ? acc.models2d.push(id) : acc.models3d.push(id);\n return acc;\n }, { models2d: [] as string[], models3d: [] as string[] });\n\n setAvailable2dModels(models2d);\n setAvailable3dModels(models3d);\n })\n .catch((_e) => {\n setAvailableModels([]);\n });\n }, [queryModels, viewport]);\n\n const invert = useCallback(async () => {\n if (availableModels.length === 0) return;\n const notViewedModels: string[] = [];\n const models: string[] = [];\n availableModels.forEach((id: string) => {\n if (viewport?.viewsModel(id)) models.push(id);\n else notViewedModels.push(id);\n });\n await viewport?.addViewedModels(notViewedModels);\n viewport?.changeModelDisplay(models, false);\n viewport?.invalidateScene();\n }, [viewport, availableModels]);\n\n const hideAll = useCallback(() => {\n viewport?.changeModelDisplay(availableModels, false);\n viewport?.invalidateScene();\n }, [viewport, availableModels]);\n\n const showAll = useCallback(async () => {\n await viewport?.addViewedModels(availableModels);\n viewport?.invalidateScene();\n }, [viewport, availableModels]);\n\n const viewToggle2D = useCallback(async () => {\n if (is2dToggleActive) {\n viewport?.changeModelDisplay(available2dModels, false);\n setIs2dToggleActive(false);\n setIcon2dToggle(\"icon-visibility-hide-2\");\n } else {\n await viewport?.addViewedModels(available2dModels);\n setIs2dToggleActive(true);\n setIcon2dToggle(\"icon-visibility\");\n }\n viewport?.invalidateScene();\n }, [is2dToggleActive, viewport, available2dModels]);\n\n const viewToggle3D = useCallback(async () => {\n if (is3dToggleActive) {\n viewport?.changeModelDisplay(available3dModels, false);\n setIs3dToggleActive(false);\n setIcon3dToggle(\"icon-visibility-hide-2\");\n } else {\n await viewport?.addViewedModels(available3dModels);\n setIs3dToggleActive(true);\n setIcon3dToggle(\"icon-visibility\");\n }\n viewport?.invalidateScene();\n }, [is3dToggleActive, viewport, available3dModels]);\n\n return (!(iModel && viewport) ? null : (\n <>\n <TreeHeaderComponent\n searchOptions={searchOptions}\n showAll={showAll}\n hideAll={hideAll}\n invert={invert}\n toggle2D={viewToggle2D}\n toggle2DIcon={icon2dToggle}\n toggle3D={viewToggle3D}\n toggle3DIcon={icon3dToggle}\n />\n <div className=\"tree-widget-models-tree-container\">\n <div ref={ref} style={{ width: \"100%\", height: \"100%\" }}>\n {width && height && (\n <ModelsTree\n {...props}\n filterInfo={{ filter: filterString, activeMatchIndex }}\n onFilterApplied={onFilterApplied}\n activeView={viewport}\n enableElementsClassGrouping={\n props.enableElementsClassGrouping\n ? ClassGroupingOption.YesWithCounts\n : ClassGroupingOption.No\n }\n width={width}\n height={height}\n />\n )}\n </div>\n </div>\n </>\n ));\n};\n"]}
1
+ {"version":3,"file":"ModelsTree.js","sourceRoot":"","sources":["../../../../src/components/trees/ModelsTree.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,EAAE,UAAU,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,mBAAmB,CAAC;AAK3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAO/C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAqB,EAAE,EAAE;IAC3D,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACzE,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACzE,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAS,iBAAiB,CAAC,CAAC;IAC5E,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAS,iBAAiB,CAAC,CAAC;IAE5E,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAW,E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,CACS,CACX,CAEJ,CACJ,CAAC;AACJ,CAAC,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 React, { useCallback, useEffect, useState } from \"react\";\nimport type { Viewport } from \"@itwin/core-frontend\";\nimport { ModelsTree, useActiveIModelConnection, useActiveViewport } from \"@itwin/appui-react\";\nimport { useTreeFilteringState } from \"../TreeFilteringState\";\nimport \"./ModelsTree.scss\";\nimport type {\n GeometricModel3dProps,\n ModelQueryParams,\n} from \"@itwin/core-common\";\nimport { TreeHeaderComponent } from \"../header/TreeHeader\";\nimport type { ModelTreeProps } from \"../../types\";\nimport { AutoSizer } from \"../utils/AutoSizer\";\n\ninterface TreeViewModelInfo {\n id: string;\n isPlanProjection?: boolean;\n}\n\nexport const ModelsTreeComponent = (props: ModelTreeProps) => {\n const [is2dToggleActive, setIs2dToggleActive] = useState<boolean>(false);\n const [is3dToggleActive, setIs3dToggleActive] = useState<boolean>(false);\n const [icon2dToggle, setIcon2dToggle] = useState<string>(\"icon-visibility\");\n const [icon3dToggle, setIcon3dToggle] = useState<string>(\"icon-visibility\");\n\n const [available2dModels, setAvailable2dModels] = useState<string[]>([]);\n const [available3dModels, setAvailable3dModels] = useState<string[]>([]);\n const [availableModels, setAvailableModels] = useState<string[]>([]);\n\n const iModel = useActiveIModelConnection();\n const viewport = useActiveViewport();\n\n const { searchOptions, filterString, activeMatchIndex, onFilterApplied } =\n useTreeFilteringState();\n\n const queryModels = useCallback(async (\n vp: Viewport | undefined\n ): Promise<TreeViewModelInfo[]> => {\n if (vp === undefined) return [];\n\n const queryParams: ModelQueryParams = {\n from: \"BisCore.GeometricModel3d\",\n wantPrivate: false,\n };\n const modelProps = await iModel?.models.queryProps(queryParams) ?? [];\n return modelProps\n .map(({ id, isPlanProjection }: GeometricModel3dProps) => ({ id, isPlanProjection }))\n .filter(({ id }) => id) as TreeViewModelInfo[];\n }, [iModel]);\n\n useEffect(() => {\n queryModels(viewport)\n .then((modelInfos: TreeViewModelInfo[]) => {\n setAvailableModels(modelInfos.map(({ id }) => id));\n\n const { models2d, models3d } = modelInfos.reduce((acc, { id, isPlanProjection }) => {\n isPlanProjection ? acc.models2d.push(id) : acc.models3d.push(id);\n return acc;\n }, { models2d: [] as string[], models3d: [] as string[] });\n\n setAvailable2dModels(models2d);\n setAvailable3dModels(models3d);\n })\n .catch((_e) => {\n setAvailableModels([]);\n });\n }, [queryModels, viewport]);\n\n const invert = useCallback(async () => {\n if (availableModels.length === 0) return;\n const notViewedModels: string[] = [];\n const models: string[] = [];\n availableModels.forEach((id: string) => {\n if (viewport?.viewsModel(id)) models.push(id);\n else notViewedModels.push(id);\n });\n await viewport?.addViewedModels(notViewedModels);\n viewport?.changeModelDisplay(models, false);\n viewport?.invalidateScene();\n }, [viewport, availableModels]);\n\n const hideAll = useCallback(() => {\n viewport?.changeModelDisplay(availableModels, false);\n viewport?.invalidateScene();\n }, [viewport, availableModels]);\n\n const showAll = useCallback(async () => {\n await viewport?.addViewedModels(availableModels);\n viewport?.invalidateScene();\n }, [viewport, availableModels]);\n\n const viewToggle2D = useCallback(async () => {\n if (is2dToggleActive) {\n viewport?.changeModelDisplay(available2dModels, false);\n setIs2dToggleActive(false);\n setIcon2dToggle(\"icon-visibility-hide-2\");\n } else {\n await viewport?.addViewedModels(available2dModels);\n setIs2dToggleActive(true);\n setIcon2dToggle(\"icon-visibility\");\n }\n viewport?.invalidateScene();\n }, [is2dToggleActive, viewport, available2dModels]);\n\n const viewToggle3D = useCallback(async () => {\n if (is3dToggleActive) {\n viewport?.changeModelDisplay(available3dModels, false);\n setIs3dToggleActive(false);\n setIcon3dToggle(\"icon-visibility-hide-2\");\n } else {\n await viewport?.addViewedModels(available3dModels);\n setIs3dToggleActive(true);\n setIcon3dToggle(\"icon-visibility\");\n }\n viewport?.invalidateScene();\n }, [is3dToggleActive, viewport, available3dModels]);\n\n return (\n <>\n {iModel && viewport &&\n <>\n <TreeHeaderComponent\n searchOptions={searchOptions}\n showAll={showAll}\n hideAll={hideAll}\n invert={invert}\n toggle2D={viewToggle2D}\n toggle2DIcon={icon2dToggle}\n toggle3D={viewToggle3D}\n toggle3DIcon={icon3dToggle}\n />\n <AutoSizer>\n {({ width, height }) => (\n <ModelsTree\n {...props}\n iModel={iModel}\n activeView={viewport}\n width={width}\n height={height}\n filterInfo={{ filter: filterString, activeMatchIndex }}\n onFilterApplied={onFilterApplied}\n />\n )}\n </AutoSizer>\n </>\n }\n </>\n );\n};\n"]}
@@ -3,7 +3,7 @@
3
3
  * See LICENSE.md in the project root for license terms and full copyright notice.
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
 
6
- @import "~@itwin/core-react/lib/esm/core-react/index";
6
+ @import "~@itwin/core-react/lib/cjs/core-react/index";
7
7
 
8
8
  .tree-widget-models-tree-container {
9
9
  flex: 1;
@@ -1,3 +1,4 @@
1
- import type { SpatialContainmentTreeProps } from "@itwin/appui-react";
2
- export declare const SpatialTreeComponent: (props: Omit<SpatialContainmentTreeProps, "width" | "height">) => JSX.Element;
1
+ /// <reference types="react" />
2
+ import type { SpatialTreeProps } from "../../types";
3
+ export declare const SpatialTreeComponent: (props: SpatialTreeProps) => JSX.Element;
3
4
  //# sourceMappingURL=SpatialTree.d.ts.map
@@ -1,14 +1,13 @@
1
- import { SpatialContainmentTree } from "@itwin/appui-react";
2
- import { useResizeObserver } from "@itwin/core-react";
3
- import React, { useCallback, useState } from "react";
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { SpatialContainmentTree, useActiveIModelConnection } from "@itwin/appui-react";
6
+ import React from "react";
7
+ import { AutoSizer } from "../utils/AutoSizer";
4
8
  export const SpatialTreeComponent = (props) => {
5
- const [height, setHeight] = useState(0);
6
- const [width, setWidth] = useState(0);
7
- const handleResize = useCallback((w, h) => {
8
- setHeight(h);
9
- setWidth(w);
10
- }, []);
11
- const ref = useResizeObserver(handleResize);
12
- return (React.createElement("div", { ref: ref, style: { width: "100%", height: "100%" } }, width && height && (React.createElement(SpatialContainmentTree, { ...props, width: width, height: height }))));
9
+ const iModel = useActiveIModelConnection();
10
+ return (React.createElement(React.Fragment, null, iModel &&
11
+ React.createElement(AutoSizer, null, ({ width, height }) => React.createElement(SpatialContainmentTree, { ...props, width: width, height: height, iModel: iModel }))));
13
12
  };
14
13
  //# sourceMappingURL=SpatialTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SpatialTree.js","sourceRoot":"","sources":["../../../../src/components/trees/SpatialTree.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,KAA4D,EAC5D,EAAE;IACF,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,YAAY,GAAG,WAAW,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,iBAAiB,CAAiB,YAAY,CAAC,CAAC;IAE5D,OAAO,CACL,6BAAK,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IACpD,KAAK,IAAI,MAAM,IAAI,CAClB,oBAAC,sBAAsB,OAAK,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,CACpE,CACG,CACP,CAAC;AACJ,CAAC,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 type { SpatialContainmentTreeProps } from \"@itwin/appui-react\";\nimport { SpatialContainmentTree } from \"@itwin/appui-react\";\nimport { useResizeObserver } from \"@itwin/core-react\";\nimport React, { useCallback, useState } from \"react\";\n\nexport const SpatialTreeComponent = (\n props: Omit<SpatialContainmentTreeProps, \"width\" | \"height\">\n) => {\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 && (\n <SpatialContainmentTree {...props} width={width} height={height} />\n )}\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"SpatialTree.js","sourceRoot":"","sources":["../../../../src/components/trees/SpatialTree.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,KAAuB,EAAE,EAAE;IAC3B,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAE3C,OAAO,CACL,0CACG,MAAM;QACL,oBAAC,SAAS,QACP,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,oBAAC,sBAAsB,OAAK,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAI,CACjG,CAEb,CACJ,CAAC;AACJ,CAAC,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 { 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,6 +1,5 @@
1
1
  export * from "./ModelsTree";
2
2
  export * from "./CategoriesTree";
3
3
  export * from "./SpatialTree";
4
- export * from "./ClassificationsTree";
5
- export * from "./TreeWithRuleset";
4
+ export * from "./IModelContentTree";
6
5
  //# sourceMappingURL=index.d.ts.map
@@ -1,10 +1,9 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
5
  export * from "./ModelsTree";
6
6
  export * from "./CategoriesTree";
7
7
  export * from "./SpatialTree";
8
- export * from "./ClassificationsTree";
9
- export * from "./TreeWithRuleset";
8
+ export * from "./IModelContentTree";
10
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/trees/index.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,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*--------------------------------------------------------------------------------------------*/\nexport * from \"./ModelsTree\";\nexport * from \"./CategoriesTree\";\nexport * from \"./SpatialTree\";\nexport * from \"./ClassificationsTree\";\nexport * from \"./TreeWithRuleset\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/trees/index.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,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 * 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,13 @@
1
+ import React, { useCallback, useState } from "react";
2
+ import { useResizeObserver } from "@itwin/core-react";
3
+ export const AutoSizer = (props) => {
4
+ const [height, setHeight] = useState(0);
5
+ const [width, setWidth] = useState(0);
6
+ const handleResize = useCallback((w, h) => {
7
+ setHeight(h);
8
+ setWidth(w);
9
+ }, []);
10
+ const ref = useResizeObserver(handleResize);
11
+ return (React.createElement("div", { ref: ref, style: { width: "100%", height: "100%" } }, width && height && (props.children({ width, height }))));
12
+ };
13
+ //# sourceMappingURL=AutoSizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoSizer.js","sourceRoot":"","sources":["../../../../src/components/utils/AutoSizer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAWtD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAqB,EAAE,EAAE;IACjD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,YAAY,GAAG,WAAW,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,iBAAiB,CAAiB,YAAY,CAAC,CAAC;IAE5D,OAAO,CACL,6BAAK,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","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,5 +1,5 @@
1
+ export * from "./types";
1
2
  export * from "./TreeWidget";
2
- export * from "./components/TreeWidgetControl";
3
3
  export * from "./components/TreeWidgetComponent";
4
4
  export * from "./components/header/TreeHeader";
5
5
  export * from "./components/trees";
@@ -1,9 +1,9 @@
1
1
  /*---------------------------------------------------------------------------------------------
2
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
- * See LICENSE.md in the project root for license terms and full copyright notice.
4
- *--------------------------------------------------------------------------------------------*/
2
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
3
+ * See LICENSE.md in the project root for license terms and full copyright notice.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ export * from "./types";
5
6
  export * from "./TreeWidget";
6
- export * from "./components/TreeWidgetControl";
7
7
  export * from "./components/TreeWidgetComponent";
8
8
  export * from "./components/header/TreeHeader";
9
9
  export * from "./components/trees";
@@ -1 +1 @@
1
- {"version":3,"file":"tree-widget-react.js","sourceRoot":"","sources":["../../src/tree-widget-react.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,cAAc,cAAc,CAAC;AAC7B,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wCAAwC,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 * from \"./TreeWidget\";\nexport * from \"./components/TreeWidgetControl\";\nexport * from \"./components/TreeWidgetComponent\";\nexport * from \"./components/header/TreeHeader\";\nexport * from \"./components/trees\";\nexport * from \"./components/TreeWidgetUiItemsProvider\";\n"]}
1
+ {"version":3,"file":"tree-widget-react.js","sourceRoot":"","sources":["../../src/tree-widget-react.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wCAAwC,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 * 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,23 @@
1
+ /// <reference types="react" />
2
+ import type { CategoryTreeProps, ModelsTreeProps, SpatialContainmentTreeProps } from "@itwin/appui-react";
3
+ import type { SelectableContentDefinition } from "@itwin/components-react";
4
+ import type { IModelConnection } from "@itwin/core-frontend";
5
+ export interface IModelContentTreeProps extends Omit<React.AllHTMLAttributes<HTMLDivElement>, "children"> {
6
+ iModel: IModelConnection;
7
+ }
8
+ export declare type ModelTreeProps = Omit<ModelsTreeProps, "iModel" | "activeView" | "width" | "height" | "filterInfo" | "onFilterApplied">;
9
+ export declare type CategoriesTreeProps = Omit<CategoryTreeProps, "iModel" | "activeView" | "width" | "height" | "filterInfo" | "onFilterApplied">;
10
+ export declare type SpatialTreeProps = Omit<SpatialContainmentTreeProps, "iModel" | "width" | "height">;
11
+ export interface TreeWidgetOptions {
12
+ enableElementsClassGrouping?: boolean;
13
+ additionalTrees?: SelectableContentDefinition[];
14
+ modelsTreeProps?: ModelTreeProps;
15
+ categoriesTreeProps?: CategoriesTreeProps;
16
+ spatialTreeProps?: SpatialTreeProps;
17
+ hideTrees?: {
18
+ modelsTree?: boolean;
19
+ categoriesTree?: boolean;
20
+ spatialTree?: boolean;
21
+ };
22
+ }
23
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -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 {\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/tree-widget-react",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Tree Widget React",
5
5
  "keywords": [
6
6
  "Bentley",
@@ -62,7 +62,6 @@
62
62
  "@itwin/core-frontend": "^3.0.0",
63
63
  "@itwin/core-react": "^3.0.0",
64
64
  "@itwin/presentation-components": "^3.0.0",
65
- "@itwin/presentation-frontend": "^3.0.0",
66
65
  "react": "^17.0.2",
67
66
  "react-dom": "^17.0.2"
68
67
  },
@@ -1,26 +0,0 @@
1
- import type { ConfigurableCreateInfo } from "@itwin/appui-react";
2
- import { WidgetControl } from "@itwin/appui-react";
3
- import React from "react";
4
- import type { IModelConnection, Viewport } from "@itwin/core-frontend";
5
- import type { SelectableContentDefinition } from "@itwin/components-react";
6
- export interface TreeWidgetControlOptions {
7
- iModelConnection: IModelConnection;
8
- activeView?: Viewport;
9
- enableElementsClassGrouping?: boolean;
10
- allViewports?: boolean;
11
- additionalTrees?: SelectableContentDefinition[];
12
- additionalProps?: {
13
- modelsTree?: {};
14
- categoriesTree?: {};
15
- spatialTree?: {};
16
- };
17
- treeReplacements?: {
18
- modelsTree?: () => React.ReactNode;
19
- categoriesTree?: () => React.ReactNode;
20
- spatialTree?: () => React.ReactNode;
21
- };
22
- }
23
- export declare class TreeWidgetControl extends WidgetControl {
24
- constructor(info: ConfigurableCreateInfo, options: TreeWidgetControlOptions);
25
- }
26
- //# sourceMappingURL=TreeWidgetControl.d.ts.map
@@ -1,66 +0,0 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- var __importDefault = (this && this.__importDefault) || function (mod) {
7
- return (mod && mod.__esModule) ? mod : { "default": mod };
8
- };
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.TreeWidgetControl = void 0;
11
- const appui_react_1 = require("@itwin/appui-react");
12
- const react_1 = __importDefault(require("react"));
13
- const CategoriesTree_1 = require("./trees/CategoriesTree");
14
- const ModelsTree_1 = require("./trees/ModelsTree");
15
- const SpatialTree_1 = require("./trees/SpatialTree");
16
- const TreeWidgetComponent_1 = require("./TreeWidgetComponent");
17
- const TreeWidget_1 = require("../TreeWidget");
18
- class TreeWidgetControl extends appui_react_1.WidgetControl {
19
- constructor(info, options) {
20
- var _a, _b, _c, _d, _e, _f;
21
- super(info, options);
22
- const { iModelConnection: imodel, activeView } = options;
23
- const modelsTreeProps = (_a = options.additionalProps) === null || _a === void 0 ? void 0 : _a.modelsTree;
24
- const categoriesTreeProps = (_b = options.additionalProps) === null || _b === void 0 ? void 0 : _b.categoriesTree;
25
- const spatialTreeProps = (_c = options.additionalProps) === null || _c === void 0 ? void 0 : _c.spatialTree;
26
- const enableElementsClassGrouping = options.enableElementsClassGrouping;
27
- const allViewPorts = options.allViewports;
28
- const additionalTrees = options.additionalTrees;
29
- const modelsTreeReplacement = (_d = options.treeReplacements) === null || _d === void 0 ? void 0 : _d.modelsTree;
30
- const categoriesTreeReplacement = (_e = options.treeReplacements) === null || _e === void 0 ? void 0 : _e.categoriesTree;
31
- const spatialTreeReplacement = (_f = options.treeReplacements) === null || _f === void 0 ? void 0 : _f.spatialTree;
32
- const modelsTreeComponent = (react_1.default.createElement(ModelsTree_1.ModelsTreeComponent, { iModel: imodel, allViewports: allViewPorts, activeView: activeView, enableElementsClassGrouping: enableElementsClassGrouping, ...modelsTreeProps }));
33
- const categoriesTreeComponent = (react_1.default.createElement(CategoriesTree_1.CategoriesTreeComponent, { iModel: imodel, allViewports: allViewPorts, activeView: activeView, ...categoriesTreeProps }));
34
- const spatialContainmentComponent = (react_1.default.createElement(SpatialTree_1.SpatialTreeComponent, { iModel: imodel, enableElementsClassGrouping: enableElementsClassGrouping
35
- ? appui_react_1.ClassGroupingOption.Yes
36
- : appui_react_1.ClassGroupingOption.No, ...spatialTreeProps }));
37
- const trees = [
38
- {
39
- label: TreeWidget_1.TreeWidget.translate("modeltree"),
40
- id: "model-tree",
41
- render: modelsTreeReplacement
42
- ? modelsTreeReplacement
43
- : () => modelsTreeComponent,
44
- },
45
- {
46
- label: TreeWidget_1.TreeWidget.translate("categories"),
47
- id: "categories-tree",
48
- render: categoriesTreeReplacement
49
- ? categoriesTreeReplacement
50
- : () => categoriesTreeComponent,
51
- },
52
- {
53
- label: TreeWidget_1.TreeWidget.translate("containment"),
54
- id: "spatial-containment-tree",
55
- render: spatialTreeReplacement
56
- ? spatialTreeReplacement
57
- : () => spatialContainmentComponent,
58
- },
59
- ];
60
- if (additionalTrees)
61
- trees.push(...additionalTrees);
62
- this.reactNode = react_1.default.createElement(TreeWidgetComponent_1.TreeWidgetComponent, { trees: trees });
63
- }
64
- }
65
- exports.TreeWidgetControl = TreeWidgetControl;
66
- //# sourceMappingURL=TreeWidgetControl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TreeWidgetControl.js","sourceRoot":"","sources":["../../../src/components/TreeWidgetControl.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;AAG/F,oDAG4B;AAC5B,kDAA0B;AAC1B,2DAAiE;AACjE,mDAAyD;AACzD,qDAA2D;AAE3D,+DAA4D;AAE5D,8CAA2C;AAoB3C,MAAa,iBAAkB,SAAQ,2BAAa;IAClD,YAAY,IAA4B,EAAE,OAAiC;;QACzE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAErB,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QACzD,MAAM,eAAe,GAAG,MAAA,OAAO,CAAC,eAAe,0CAAE,UAAU,CAAC;QAC5D,MAAM,mBAAmB,GAAG,MAAA,OAAO,CAAC,eAAe,0CAAE,cAAc,CAAC;QACpE,MAAM,gBAAgB,GAAG,MAAA,OAAO,CAAC,eAAe,0CAAE,WAAW,CAAC;QAC9D,MAAM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AAyB;oBAC/B,CAAC,CAAC,yBAAyB;oBAC3B,CAAC,CAAC,GAAG,EAAE,CAAC,uBAAuB;aAClC;YACD;gBACE,KAAK,EAAE,uBAAU,CAAC,SAAS,CAAC,aAAa,CAAC;gBAC1C,EAAE,EAAE,0BAA0B;gBAC9B,MAAM,EAAE,sBAAsB;oBAC5B,CAAC,CAAC,sBAAsB;oBACxB,CAAC,CAAC,GAAG,EAAE,CAAC,2BAA2B;aACtC;SACF,CAAC;QAEF,IAAI,eAAe;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC;QAEpD,IAAI,CAAC,SAAS,GAAG,8BAAC,yCAAmB,IAAC,KAAK,EAAE,KAAK,GAAI,CAAC;IACzD,CAAC;CACF;AA1ED,8CA0EC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n\nimport type { ConfigurableCreateInfo } from \"@itwin/appui-react\";\nimport {\n ClassGroupingOption,\n WidgetControl,\n} from \"@itwin/appui-react\";\nimport React from \"react\";\nimport { CategoriesTreeComponent } from \"./trees/CategoriesTree\";\nimport { ModelsTreeComponent } from \"./trees/ModelsTree\";\nimport { SpatialTreeComponent } from \"./trees/SpatialTree\";\nimport type { IModelConnection, Viewport } from \"@itwin/core-frontend\";\nimport { TreeWidgetComponent } from \"./TreeWidgetComponent\";\nimport type { SelectableContentDefinition } from \"@itwin/components-react\";\nimport { TreeWidget } from \"../TreeWidget\";\n\nexport interface TreeWidgetControlOptions {\n iModelConnection: IModelConnection;\n activeView?: Viewport;\n enableElementsClassGrouping?: boolean;\n allViewports?: boolean;\n additionalTrees?: SelectableContentDefinition[];\n additionalProps?: {\n modelsTree?: {};\n categoriesTree?: {};\n spatialTree?: {};\n };\n treeReplacements?: {\n modelsTree?: () => React.ReactNode;\n categoriesTree?: () => React.ReactNode;\n spatialTree?: () => React.ReactNode;\n };\n}\n\nexport class TreeWidgetControl extends WidgetControl {\n constructor(info: ConfigurableCreateInfo, options: TreeWidgetControlOptions) {\n super(info, options);\n\n const { iModelConnection: imodel, activeView } = options;\n const modelsTreeProps = options.additionalProps?.modelsTree;\n const categoriesTreeProps = options.additionalProps?.categoriesTree;\n const spatialTreeProps = options.additionalProps?.spatialTree;\n const enableElementsClassGrouping = options.enableElementsClassGrouping;\n const allViewPorts = options.allViewports;\n const additionalTrees = options.additionalTrees;\n const modelsTreeReplacement = options.treeReplacements?.modelsTree;\n const categoriesTreeReplacement = options.treeReplacements?.categoriesTree;\n const spatialTreeReplacement = options.treeReplacements?.spatialTree;\n\n const modelsTreeComponent = (\n <ModelsTreeComponent\n iModel={imodel}\n allViewports={allViewPorts}\n activeView={activeView}\n enableElementsClassGrouping={enableElementsClassGrouping}\n {...modelsTreeProps}\n />\n );\n\n const categoriesTreeComponent = (\n <CategoriesTreeComponent\n iModel={imodel}\n allViewports={allViewPorts}\n activeView={activeView}\n {...categoriesTreeProps}\n />\n );\n\n const spatialContainmentComponent = (\n <SpatialTreeComponent\n iModel={imodel}\n enableElementsClassGrouping={\n enableElementsClassGrouping\n ? ClassGroupingOption.Yes\n : ClassGroupingOption.No\n }\n {...spatialTreeProps}\n />\n );\n\n const trees: SelectableContentDefinition[] = [\n {\n label: TreeWidget.translate(\"modeltree\"),\n id: \"model-tree\",\n render: modelsTreeReplacement\n ? modelsTreeReplacement\n : () => modelsTreeComponent,\n },\n {\n label: TreeWidget.translate(\"categories\"),\n id: \"categories-tree\",\n render: categoriesTreeReplacement\n ? categoriesTreeReplacement\n : () => categoriesTreeComponent,\n },\n {\n label: TreeWidget.translate(\"containment\"),\n id: \"spatial-containment-tree\",\n render: spatialTreeReplacement\n ? spatialTreeReplacement\n : () => spatialContainmentComponent,\n },\n ];\n\n if (additionalTrees) trees.push(...additionalTrees);\n\n this.reactNode = <TreeWidgetComponent trees={trees} />;\n }\n}\n"]}