@itwin/tree-widget-react 4.0.0-alpha.5 → 4.0.0-alpha.6

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 (58) hide show
  1. package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js +1 -1
  2. package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +1 -1
  3. package/lib/esm/tree-widget-react/components/tree-header/ErrorState.js +1 -1
  4. package/lib/esm/tree-widget-react/components/tree-header/ErrorState.js.map +1 -1
  5. package/lib/esm/tree-widget-react/components/tree-header/SearchBox.js +2 -2
  6. package/lib/esm/tree-widget-react/components/tree-header/SearchBox.js.map +1 -1
  7. package/lib/esm/tree-widget-react/components/tree-header/SelectableTree.css +0 -1
  8. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +2 -2
  9. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js +3 -2
  10. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js.map +1 -1
  11. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +3 -3
  12. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
  13. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.d.ts +1 -1
  14. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
  15. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +13 -0
  16. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +59 -41
  17. package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
  18. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.d.ts +9 -2
  19. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +38 -20
  20. package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
  21. package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.css +1 -0
  22. package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js +3 -3
  23. package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js.map +1 -1
  24. package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.css +16 -0
  25. package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.d.ts +4 -0
  26. package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.js +16 -0
  27. package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.js.map +1 -0
  28. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.css +10 -0
  29. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.d.ts +1 -0
  30. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js +4 -3
  31. package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js.map +1 -1
  32. package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js +3 -3
  33. package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js.map +1 -1
  34. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +7 -2
  35. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js +24 -18
  36. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
  37. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +1 -1
  38. package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
  39. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +7 -2
  40. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js +33 -27
  41. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
  42. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +1 -1
  43. package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
  44. package/lib/esm/tree-widget-react/components/trees/index.d.ts +4 -2
  45. package/lib/esm/tree-widget-react/components/trees/index.js +4 -2
  46. package/lib/esm/tree-widget-react/components/trees/index.js.map +1 -1
  47. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +2 -2
  48. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js +2 -2
  49. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js.map +1 -1
  50. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +6 -6
  51. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
  52. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.d.ts +1 -1
  53. package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
  54. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.d.ts +5 -1
  55. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +26 -20
  56. package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
  57. package/lib/public/locales/en/TreeWidget.json +4 -0
  58. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"TreeNodeVisibilityButton.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,gCAAgC,CAAC;AACxC,OAAO,iBAAiB,MAAM,0CAA0C,CAAC;AACzE,OAAO,oBAAoB,MAAM,6CAA6C,CAAC;AAC/E,OAAO,iBAAiB,MAAM,0CAA0C,CAAC;AAsBzE,gBAAgB;AAChB,MAAM,UAAU,sBAAsB,CAAC,EACrC,wBAAwB,EACxB,uBAAuB,GACO;IAC9B,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,KAAK,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAE7C,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,QAAQ,KAAK,CAAC,KAAK,EAAE;gBACnB,KAAK,SAAS;oBACZ,OAAO,iBAAiB,CAAC;gBAC3B,KAAK,QAAQ;oBACX,OAAO,iBAAiB,CAAC;gBAC3B,KAAK,SAAS;oBACZ,OAAO,oBAAoB,CAAC;aAC/B;QACH,CAAC,CAAC;QACF,OAAO;YACL,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,2BAA2B;YACnD,MAAM,EAAE,GAAG,EAAE;gBACX,uBAAuB,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YAC7C,CAAC;YACD,IAAI,EAAE,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;YAClD,IAAI,EAAE,OAAO,EAAE;SAChB,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport \"./TreeNodeVisibilityButton.css\";\nimport visibilityHideSvg from \"@itwin/itwinui-icons/visibility-hide.svg\";\nimport visibilityPartialSvg from \"@itwin/itwinui-icons/visibility-partial.svg\";\nimport visibilityShowSvg from \"@itwin/itwinui-icons/visibility-show.svg\";\n\nimport type { PresentationHierarchyNode, TreeItemAction } from \"@itwin/presentation-hierarchies-react\";\n\n/**\n * Data structure that describes tree node checkbox state.\n * @beta\n */\ninterface TreeItemVisibilityButtonState {\n state: \"visible\" | \"partial\" | \"hidden\";\n isDisabled?: boolean;\n tooltip?: string;\n}\n\n/** @beta */\nexport interface TreeItemVisibilityButtonProps {\n /** Callback that should be invoked when checkbox is clicked. */\n onVisibilityButtonClick: (node: PresentationHierarchyNode, state: TreeItemVisibilityButtonState[\"state\"]) => void;\n /** Callback that should be used to determine current checkbox state. */\n getVisibilityButtonState: (node: PresentationHierarchyNode) => TreeItemVisibilityButtonState;\n}\n\n/** @internal */\nexport function createVisibilityAction({\n getVisibilityButtonState,\n onVisibilityButtonClick,\n}: TreeItemVisibilityButtonProps): (node: PresentationHierarchyNode) => TreeItemAction {\n return (node) => {\n const state = getVisibilityButtonState(node);\n\n const getIcon = () => {\n switch (state.state) {\n case \"visible\":\n return visibilityShowSvg;\n case \"hidden\":\n return visibilityHideSvg;\n case \"partial\":\n return visibilityPartialSvg;\n }\n };\n return {\n label: state.tooltip ?? \"Determining visibility...\",\n action: () => {\n onVisibilityButtonClick(node, state.state);\n },\n show: state.state !== \"visible\" ? true : undefined,\n icon: getIcon(),\n };\n };\n}\n"]}
1
+ {"version":3,"file":"TreeNodeVisibilityButton.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,gCAAgC,CAAC;AAsBxC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,0CAA0C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACpG,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,6CAA6C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AAC1G,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,0CAA0C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AAEpG,gBAAgB;AAChB,MAAM,UAAU,sBAAsB,CAAC,EACrC,wBAAwB,EACxB,uBAAuB,GACO;IAC9B,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,KAAK,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAE7C,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,QAAQ,KAAK,CAAC,KAAK,EAAE;gBACnB,KAAK,SAAS;oBACZ,OAAO,iBAAiB,CAAC;gBAC3B,KAAK,QAAQ;oBACX,OAAO,iBAAiB,CAAC;gBAC3B,KAAK,SAAS;oBACZ,OAAO,oBAAoB,CAAC;aAC/B;QACH,CAAC,CAAC;QACF,OAAO;YACL,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,2BAA2B;YACnD,MAAM,EAAE,GAAG,EAAE;gBACX,uBAAuB,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YAC7C,CAAC;YACD,IAAI,EAAE,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;YAClD,IAAI,EAAE,OAAO,EAAE;SAChB,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport \"./TreeNodeVisibilityButton.css\";\n\nimport type { PresentationHierarchyNode, TreeItemAction } from \"@itwin/presentation-hierarchies-react\";\n\n/**\n * Data structure that describes tree node checkbox state.\n * @beta\n */\ninterface TreeItemVisibilityButtonState {\n state: \"visible\" | \"partial\" | \"hidden\";\n isDisabled?: boolean;\n tooltip?: string;\n}\n\n/** @beta */\nexport interface TreeItemVisibilityButtonProps {\n /** Callback that should be invoked when checkbox is clicked. */\n onVisibilityButtonClick: (node: PresentationHierarchyNode, state: TreeItemVisibilityButtonState[\"state\"]) => void;\n /** Callback that should be used to determine current checkbox state. */\n getVisibilityButtonState: (node: PresentationHierarchyNode) => TreeItemVisibilityButtonState;\n}\n\nconst visibilityHideSvg = new URL(\"@itwin/itwinui-icons/visibility-hide.svg\", import.meta.url).href;\nconst visibilityPartialSvg = new URL(\"@itwin/itwinui-icons/visibility-partial.svg\", import.meta.url).href;\nconst visibilityShowSvg = new URL(\"@itwin/itwinui-icons/visibility-show.svg\", import.meta.url).href;\n\n/** @internal */\nexport function createVisibilityAction({\n getVisibilityButtonState,\n onVisibilityButtonClick,\n}: TreeItemVisibilityButtonProps): (node: PresentationHierarchyNode) => TreeItemAction {\n return (node) => {\n const state = getVisibilityButtonState(node);\n\n const getIcon = () => {\n switch (state.state) {\n case \"visible\":\n return visibilityShowSvg;\n case \"hidden\":\n return visibilityHideSvg;\n case \"partial\":\n return visibilityPartialSvg;\n }\n };\n return {\n label: state.tooltip ?? \"Determining visibility...\",\n action: () => {\n onVisibilityButtonClick(node, state.state);\n },\n show: state.state !== \"visible\" ? true : undefined,\n icon: getIcon(),\n };\n };\n}\n"]}
@@ -1,11 +1,16 @@
1
+ import type { PresentationHierarchyNode } from "@itwin/presentation-hierarchies-react";
1
2
  import type { BaseTreeRendererProps } from "../common/components/BaseTreeRenderer.js";
2
3
  import type { TreeProps } from "../common/components/Tree.js";
3
4
  /** @beta */
4
- export type ExternalSourcesTreeProps = Pick<TreeProps, "imodel" | "getSchemaContext" | "selectionStorage" | "selectionMode" | "emptyTreeContent"> & Pick<BaseTreeRendererProps, "actions"> & {
5
+ export type ExternalSourcesTreeProps = Pick<TreeProps, "imodel" | "getSchemaContext" | "selectionStorage" | "selectionMode" | "emptyTreeContent"> & Pick<BaseTreeRendererProps, "actions" | "getDecorations"> & {
5
6
  hierarchyLevelConfig?: {
6
7
  sizeLimit?: number;
7
8
  };
8
9
  };
9
10
  /** @beta */
10
- export declare function ExternalSourcesTree(props: ExternalSourcesTreeProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function ExternalSourcesTree({ actions, getDecorations, selectionMode, ...rest }: ExternalSourcesTreeProps): import("react/jsx-runtime").JSX.Element;
12
+ /** @beta */
13
+ export declare function ExternalSourcesTreeIcon({ node }: {
14
+ node: PresentationHierarchyNode;
15
+ }): import("react/jsx-runtime").JSX.Element | undefined;
11
16
  //# sourceMappingURL=ExternalSourcesTree.d.ts.map
@@ -3,36 +3,42 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
- import classSvg from "@itwin/itwinui-icons/bis-class.svg";
7
- import elementSvg from "@itwin/itwinui-icons/bis-element.svg";
8
- import documentSvg from "@itwin/itwinui-icons/document.svg";
9
- import ecSchemaSvg from "@itwin/itwinui-icons/selection-children.svg";
6
+ import { Icon } from "@itwin/itwinui-react/bricks";
10
7
  import { EmptyTreeContent } from "../common/components/EmptyTree.js";
11
8
  import { Tree } from "../common/components/Tree.js";
12
9
  import { TreeRenderer } from "../common/components/TreeRenderer.js";
13
10
  import { ExternalSourcesTreeComponent } from "./ExternalSourcesTreeComponent.js";
14
11
  import { ExternalSourcesTreeDefinition } from "./ExternalSourcesTreeDefinition.js";
15
12
  /** @beta */
16
- export function ExternalSourcesTree(props) {
17
- return (_jsx(Tree, { emptyTreeContent: _jsx(EmptyTreeContent, { icon: documentSvg }), ...props, treeName: ExternalSourcesTreeComponent.id, getHierarchyDefinition: getDefinitionsProvider, selectionMode: props.selectionMode ?? "none", treeRenderer: (treeProps) => _jsx(TreeRenderer, { ...treeProps, getIcon: getIcon }) }));
13
+ export function ExternalSourcesTree({ actions, getDecorations, selectionMode, ...rest }) {
14
+ return (_jsx(Tree, { emptyTreeContent: _jsx(EmptyTreeContent, { icon: documentSvg }), ...rest, treeName: ExternalSourcesTreeComponent.id, getHierarchyDefinition: getDefinitionsProvider, selectionMode: selectionMode ?? "none", treeRenderer: (treeProps) => (_jsx(TreeRenderer, { ...treeProps, actions: actions, getDecorations: getDecorations ?? ((node) => _jsx(ExternalSourcesTreeIcon, { node: node })) })) }));
18
15
  }
19
16
  const getDefinitionsProvider = (props) => {
20
17
  return new ExternalSourcesTreeDefinition(props);
21
18
  };
22
- function getIcon(node) {
19
+ const classSvg = new URL("@itwin/itwinui-icons/bis-class.svg", import.meta.url).href;
20
+ const elementSvg = new URL("@itwin/itwinui-icons/bis-element.svg", import.meta.url).href;
21
+ const documentSvg = new URL("@itwin/itwinui-icons/document.svg", import.meta.url).href;
22
+ const ecSchemaSvg = new URL("@itwin/itwinui-icons/selection-children.svg", import.meta.url).href;
23
+ /** @beta */
24
+ export function ExternalSourcesTreeIcon({ node }) {
23
25
  if (node.extendedData?.imageId === undefined) {
24
26
  return undefined;
25
27
  }
26
- switch (node.extendedData.imageId) {
27
- case "icon-item":
28
- return elementSvg;
29
- case "icon-ec-class":
30
- return classSvg;
31
- case "icon-document":
32
- return documentSvg;
33
- case "icon-ec-schema":
34
- return ecSchemaSvg;
35
- }
36
- return undefined;
28
+ const getIcon = () => {
29
+ switch (node.extendedData.imageId) {
30
+ case "icon-item":
31
+ return elementSvg;
32
+ case "icon-ec-class":
33
+ return classSvg;
34
+ case "icon-document":
35
+ return documentSvg;
36
+ case "icon-ec-schema":
37
+ return ecSchemaSvg;
38
+ default:
39
+ return undefined;
40
+ }
41
+ };
42
+ return _jsx(Icon, { href: getIcon() });
37
43
  }
38
44
  //# sourceMappingURL=ExternalSourcesTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExternalSourcesTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,QAAQ,MAAM,oCAAoC,CAAC;AAC1D,OAAO,UAAU,MAAM,sCAAsC,CAAC;AAC9D,OAAO,WAAW,MAAM,mCAAmC,CAAC;AAC5D,OAAO,WAAW,MAAM,6CAA6C,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAanF,YAAY;AACZ,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,OAAO,CACL,KAAC,IAAI,IACH,gBAAgB,EAAE,KAAC,gBAAgB,IAAC,IAAI,EAAE,WAAW,GAAI,KACrD,KAAK,EACT,QAAQ,EAAE,4BAA4B,CAAC,EAAE,EACzC,sBAAsB,EAAE,sBAAsB,EAC9C,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,MAAM,EAC5C,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,KAAC,YAAY,OAAK,SAAS,EAAE,OAAO,EAAE,OAAO,GAAI,GAC9E,CACH,CAAC;AACJ,CAAC;AAED,MAAM,sBAAsB,GAAwC,CAAC,KAAK,EAAE,EAAE;IAC5E,OAAO,IAAI,6BAA6B,CAAC,KAAK,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,SAAS,OAAO,CAAC,IAA+B;IAC9C,IAAI,IAAI,CAAC,YAAY,EAAE,OAAO,KAAK,SAAS,EAAE;QAC5C,OAAO,SAAS,CAAC;KAClB;IAED,QAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;QACjC,KAAK,WAAW;YACd,OAAO,UAAU,CAAC;QACpB,KAAK,eAAe;YAClB,OAAO,QAAQ,CAAC;QAClB,KAAK,eAAe;YAClB,OAAO,WAAW,CAAC;QACrB,KAAK,gBAAgB;YACnB,OAAO,WAAW,CAAC;KACtB;IAED,OAAO,SAAS,CAAC;AACnB,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 classSvg from \"@itwin/itwinui-icons/bis-class.svg\";\nimport elementSvg from \"@itwin/itwinui-icons/bis-element.svg\";\nimport documentSvg from \"@itwin/itwinui-icons/document.svg\";\nimport ecSchemaSvg from \"@itwin/itwinui-icons/selection-children.svg\";\nimport { EmptyTreeContent } from \"../common/components/EmptyTree.js\";\nimport { Tree } from \"../common/components/Tree.js\";\nimport { TreeRenderer } from \"../common/components/TreeRenderer.js\";\nimport { ExternalSourcesTreeComponent } from \"./ExternalSourcesTreeComponent.js\";\nimport { ExternalSourcesTreeDefinition } from \"./ExternalSourcesTreeDefinition.js\";\n\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { BaseTreeRendererProps } from \"../common/components/BaseTreeRenderer.js\";\nimport type { TreeProps } from \"../common/components/Tree.js\";\n/** @beta */\nexport type ExternalSourcesTreeProps = Pick<TreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"selectionMode\" | \"emptyTreeContent\"> &\n Pick<BaseTreeRendererProps, \"actions\"> & {\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n };\n\n/** @beta */\nexport function ExternalSourcesTree(props: ExternalSourcesTreeProps) {\n return (\n <Tree\n emptyTreeContent={<EmptyTreeContent icon={documentSvg} />}\n {...props}\n treeName={ExternalSourcesTreeComponent.id}\n getHierarchyDefinition={getDefinitionsProvider}\n selectionMode={props.selectionMode ?? \"none\"}\n treeRenderer={(treeProps) => <TreeRenderer {...treeProps} getIcon={getIcon} />}\n />\n );\n}\n\nconst getDefinitionsProvider: TreeProps[\"getHierarchyDefinition\"] = (props) => {\n return new ExternalSourcesTreeDefinition(props);\n};\n\nfunction getIcon(node: PresentationHierarchyNode): string | undefined {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n\n switch (node.extendedData.imageId) {\n case \"icon-item\":\n return elementSvg;\n case \"icon-ec-class\":\n return classSvg;\n case \"icon-document\":\n return documentSvg;\n case \"icon-ec-schema\":\n return ecSchemaSvg;\n }\n\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"ExternalSourcesTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/external-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,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACzF,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,mCAAmC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACvF,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,6CAA6C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AAEjG,YAAY;AACZ,MAAM,UAAU,uBAAuB,CAAC,EAAE,IAAI,EAAuC;IACnF,IAAI,IAAI,CAAC,YAAY,EAAE,OAAO,KAAK,SAAS,EAAE;QAC5C,OAAO,SAAS,CAAC;KAClB;IACD,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,QAAQ,IAAI,CAAC,YAAa,CAAC,OAAO,EAAE;YAClC,KAAK,WAAW;gBACd,OAAO,UAAU,CAAC;YACpB,KAAK,eAAe;gBAClB,OAAO,QAAQ,CAAC;YAClB,KAAK,eAAe;gBAClB,OAAO,WAAW,CAAC;YACrB,KAAK,gBAAgB;gBACnB,OAAO,WAAW,CAAC;YACrB;gBACE,OAAO,SAAS,CAAC;SACpB;IACH,CAAC,CAAC;IAEF,OAAO,KAAC,IAAI,IAAC,IAAI,EAAE,OAAO,EAAE,GAAI,CAAC;AACnC,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 { Icon } from \"@itwin/itwinui-react/bricks\";\nimport { EmptyTreeContent } from \"../common/components/EmptyTree.js\";\nimport { Tree } from \"../common/components/Tree.js\";\nimport { TreeRenderer } from \"../common/components/TreeRenderer.js\";\nimport { ExternalSourcesTreeComponent } from \"./ExternalSourcesTreeComponent.js\";\nimport { ExternalSourcesTreeDefinition } from \"./ExternalSourcesTreeDefinition.js\";\n\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { BaseTreeRendererProps } from \"../common/components/BaseTreeRenderer.js\";\nimport type { TreeProps } from \"../common/components/Tree.js\";\n/** @beta */\nexport type ExternalSourcesTreeProps = Pick<TreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"selectionMode\" | \"emptyTreeContent\"> &\n Pick<BaseTreeRendererProps, \"actions\" | \"getDecorations\"> & {\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n };\n\n/** @beta */\nexport function ExternalSourcesTree({ actions, getDecorations, selectionMode, ...rest }: ExternalSourcesTreeProps) {\n return (\n <Tree\n emptyTreeContent={<EmptyTreeContent icon={documentSvg} />}\n {...rest}\n treeName={ExternalSourcesTreeComponent.id}\n getHierarchyDefinition={getDefinitionsProvider}\n selectionMode={selectionMode ?? \"none\"}\n treeRenderer={(treeProps) => (\n <TreeRenderer {...treeProps} actions={actions} getDecorations={getDecorations ?? ((node) => <ExternalSourcesTreeIcon node={node} />)} />\n )}\n />\n );\n}\n\nconst getDefinitionsProvider: TreeProps[\"getHierarchyDefinition\"] = (props) => {\n return new ExternalSourcesTreeDefinition(props);\n};\n\nconst classSvg = new URL(\"@itwin/itwinui-icons/bis-class.svg\", import.meta.url).href;\nconst elementSvg = new URL(\"@itwin/itwinui-icons/bis-element.svg\", import.meta.url).href;\nconst documentSvg = new URL(\"@itwin/itwinui-icons/document.svg\", import.meta.url).href;\nconst ecSchemaSvg = new URL(\"@itwin/itwinui-icons/selection-children.svg\", import.meta.url).href;\n\n/** @beta */\nexport function ExternalSourcesTreeIcon({ node }: { node: PresentationHierarchyNode }) {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n const getIcon = () => {\n switch (node.extendedData!.imageId) {\n case \"icon-item\":\n return elementSvg;\n case \"icon-ec-class\":\n return classSvg;\n case \"icon-document\":\n return documentSvg;\n case \"icon-ec-schema\":\n return ecSchemaSvg;\n default:\n return undefined;\n }\n };\n\n return <Icon href={getIcon()} />;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { ExternalSourcesTreeProps } from "./ExternalSourcesTree.js";
2
2
  /** @beta */
3
- interface ExternalSourcesTreeComponentProps extends Pick<ExternalSourcesTreeProps, "getSchemaContext" | "selectionStorage" | "selectionMode" | "hierarchyLevelConfig" | "selectionMode" | "emptyTreeContent" | "actions"> {
3
+ interface ExternalSourcesTreeComponentProps extends Pick<ExternalSourcesTreeProps, "getSchemaContext" | "selectionStorage" | "selectionMode" | "hierarchyLevelConfig" | "selectionMode" | "emptyTreeContent" | "actions" | "getDecorations"> {
4
4
  onPerformanceMeasured?: (featureId: string, duration: number) => void;
5
5
  onFeatureUsed?: (feature: string) => void;
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ExternalSourcesTreeComponent.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAa/D;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EAAE,aAAa,EAAE,qBAAqB,EAAE,GAAG,KAAK,EAAqC,EAAE,EAAE;IACpI,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAE3C,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,KAAC,wBAAwB,IAAC,mBAAmB,EAAE,4BAA4B,CAAC,EAAE,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,qBAAqB,YACxJ,KAAC,cAAc,cACb,KAAC,mBAAmB,OAAK,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,GACnC,GACQ,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,4BAA4B,CAAC,EAAE,GAAG,0BAA0B,CAAC;AAE7D;;;GAGG;AACH,4BAA4B,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,2BAA2B,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 { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { SelectableTree } from \"../../tree-header/SelectableTree.js\";\nimport { TelemetryContextProvider } from \"../common/UseTelemetryContext.js\";\nimport { ExternalSourcesTree } from \"./ExternalSourcesTree.js\";\n\nimport type { ExternalSourcesTreeProps } from \"./ExternalSourcesTree.js\";\n/** @beta */\ninterface ExternalSourcesTreeComponentProps\n extends Pick<\n ExternalSourcesTreeProps,\n \"getSchemaContext\" | \"selectionStorage\" | \"selectionMode\" | \"hierarchyLevelConfig\" | \"selectionMode\" | \"emptyTreeContent\" | \"actions\"\n > {\n onPerformanceMeasured?: (featureId: string, duration: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\n/**\n * A component that renders `ExternalSourcesTree`.\n * @beta\n */\nexport const ExternalSourcesTreeComponent = ({ onFeatureUsed, onPerformanceMeasured, ...props }: ExternalSourcesTreeComponentProps) => {\n const imodel = useActiveIModelConnection();\n\n if (!imodel) {\n return null;\n }\n\n return (\n <TelemetryContextProvider componentIdentifier={ExternalSourcesTreeComponent.id} onFeatureUsed={onFeatureUsed} onPerformanceMeasured={onPerformanceMeasured}>\n <SelectableTree>\n <ExternalSourcesTree {...props} imodel={imodel} />\n </SelectableTree>\n </TelemetryContextProvider>\n );\n};\n\n/**\n * Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nExternalSourcesTreeComponent.id = \"external-sources-tree-v2\";\n\n/**\n * Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nExternalSourcesTreeComponent.getLabel = () => TreeWidget.translate(\"externalSourcesTree.label\");\n"]}
1
+ {"version":3,"file":"ExternalSourcesTreeComponent.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAa/D;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EAAE,aAAa,EAAE,qBAAqB,EAAE,GAAG,KAAK,EAAqC,EAAE,EAAE;IACpI,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAE3C,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,KAAC,wBAAwB,IAAC,mBAAmB,EAAE,4BAA4B,CAAC,EAAE,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,qBAAqB,YACxJ,KAAC,cAAc,cACb,KAAC,mBAAmB,OAAK,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,GACnC,GACQ,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,4BAA4B,CAAC,EAAE,GAAG,0BAA0B,CAAC;AAE7D;;;GAGG;AACH,4BAA4B,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,2BAA2B,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 { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { SelectableTree } from \"../../tree-header/SelectableTree.js\";\nimport { TelemetryContextProvider } from \"../common/UseTelemetryContext.js\";\nimport { ExternalSourcesTree } from \"./ExternalSourcesTree.js\";\n\nimport type { ExternalSourcesTreeProps } from \"./ExternalSourcesTree.js\";\n/** @beta */\ninterface ExternalSourcesTreeComponentProps\n extends Pick<\n ExternalSourcesTreeProps,\n \"getSchemaContext\" | \"selectionStorage\" | \"selectionMode\" | \"hierarchyLevelConfig\" | \"selectionMode\" | \"emptyTreeContent\" | \"actions\" | \"getDecorations\"\n > {\n onPerformanceMeasured?: (featureId: string, duration: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\n/**\n * A component that renders `ExternalSourcesTree`.\n * @beta\n */\nexport const ExternalSourcesTreeComponent = ({ onFeatureUsed, onPerformanceMeasured, ...props }: ExternalSourcesTreeComponentProps) => {\n const imodel = useActiveIModelConnection();\n\n if (!imodel) {\n return null;\n }\n\n return (\n <TelemetryContextProvider componentIdentifier={ExternalSourcesTreeComponent.id} onFeatureUsed={onFeatureUsed} onPerformanceMeasured={onPerformanceMeasured}>\n <SelectableTree>\n <ExternalSourcesTree {...props} imodel={imodel} />\n </SelectableTree>\n </TelemetryContextProvider>\n );\n};\n\n/**\n * Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nExternalSourcesTreeComponent.id = \"external-sources-tree-v2\";\n\n/**\n * Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nExternalSourcesTreeComponent.getLabel = () => TreeWidget.translate(\"externalSourcesTree.label\");\n"]}
@@ -1,11 +1,16 @@
1
+ import type { PresentationHierarchyNode } from "@itwin/presentation-hierarchies-react";
1
2
  import type { BaseTreeRendererProps } from "../common/components/BaseTreeRenderer.js";
2
3
  import type { TreeProps } from "../common/components/Tree.js";
3
4
  /** @beta */
4
- export type IModelContentTreeProps = Pick<TreeProps, "imodel" | "getSchemaContext" | "selectionStorage" | "selectionMode" | "emptyTreeContent"> & Pick<BaseTreeRendererProps, "actions"> & {
5
+ export type IModelContentTreeProps = Pick<TreeProps, "imodel" | "getSchemaContext" | "selectionStorage" | "selectionMode" | "emptyTreeContent"> & Pick<BaseTreeRendererProps, "actions" | "getDecorations"> & {
5
6
  hierarchyLevelConfig?: {
6
7
  sizeLimit?: number;
7
8
  };
8
9
  };
9
10
  /** @beta */
10
- export declare function IModelContentTree(props: IModelContentTreeProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function IModelContentTree({ actions, getDecorations, selectionMode, ...rest }: IModelContentTreeProps): import("react/jsx-runtime").JSX.Element;
12
+ /** @beta */
13
+ export declare function IModelContentTreeIcon({ node }: {
14
+ node: PresentationHierarchyNode;
15
+ }): import("react/jsx-runtime").JSX.Element | undefined;
11
16
  //# sourceMappingURL=IModelContentTree.d.ts.map
@@ -3,13 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
- import categorySvg from "@itwin/itwinui-icons/bis-category-3d.svg";
7
- import classSvg from "@itwin/itwinui-icons/bis-class.svg";
8
- import elementSvg from "@itwin/itwinui-icons/bis-element.svg";
9
- import subjectSvg from "@itwin/itwinui-icons/bis-subject.svg";
10
- import groupSvg from "@itwin/itwinui-icons/group.svg";
11
- import modelSvg from "@itwin/itwinui-icons/model-cube.svg";
12
- import hierarchyTreeSvg from "@itwin/itwinui-icons/selection-children.svg";
6
+ import { Icon } from "@itwin/itwinui-react/bricks";
13
7
  import { EmptyTreeContent } from "../common/components/EmptyTree.js";
14
8
  import { Tree } from "../common/components/Tree.js";
15
9
  import { TreeRenderer } from "../common/components/TreeRenderer.js";
@@ -17,8 +11,8 @@ import { IModelContentTreeComponent } from "./IModelContentTreeComponent.js";
17
11
  import { IModelContentTreeDefinition } from "./IModelContentTreeDefinition.js";
18
12
  import { IModelContentTreeIdsCache } from "./internal/IModelContentTreeIdsCache.js";
19
13
  /** @beta */
20
- export function IModelContentTree(props) {
21
- return (_jsx(Tree, { emptyTreeContent: _jsx(EmptyTreeContent, { icon: modelSvg }), ...props, treeName: IModelContentTreeComponent.id, getHierarchyDefinition: getDefinitionsProvider, selectionMode: props.selectionMode ?? "extended", treeRenderer: (treeProps) => _jsx(TreeRenderer, { ...treeProps, getIcon: getIcon }) }));
14
+ export function IModelContentTree({ actions, getDecorations, selectionMode, ...rest }) {
15
+ return (_jsx(Tree, { emptyTreeContent: _jsx(EmptyTreeContent, { icon: modelSvg }), ...rest, treeName: IModelContentTreeComponent.id, getHierarchyDefinition: getDefinitionsProvider, selectionMode: selectionMode ?? "extended", treeRenderer: (treeProps) => (_jsx(TreeRenderer, { ...treeProps, actions: actions, getDecorations: getDecorations ?? ((node) => _jsx(IModelContentTreeIcon, { node: node })) })) }));
22
16
  }
23
17
  const getDefinitionsProvider = ({ imodelAccess }) => {
24
18
  return new IModelContentTreeDefinition({
@@ -26,26 +20,38 @@ const getDefinitionsProvider = ({ imodelAccess }) => {
26
20
  idsCache: new IModelContentTreeIdsCache(imodelAccess),
27
21
  });
28
22
  };
29
- function getIcon(node) {
23
+ const categorySvg = new URL("@itwin/itwinui-icons/bis-category-3d.svg", import.meta.url).href;
24
+ const classSvg = new URL("@itwin/itwinui-icons/bis-class.svg", import.meta.url).href;
25
+ const elementSvg = new URL("@itwin/itwinui-icons/bis-element.svg", import.meta.url).href;
26
+ const subjectSvg = new URL("@itwin/itwinui-icons/bis-subject.svg", import.meta.url).href;
27
+ const groupSvg = new URL("@itwin/itwinui-icons/group.svg", import.meta.url).href;
28
+ const modelSvg = new URL("@itwin/itwinui-icons/model-cube.svg", import.meta.url).href;
29
+ const hierarchyTreeSvg = new URL("@itwin/itwinui-icons/selection-children.svg", import.meta.url).href;
30
+ /** @beta */
31
+ export function IModelContentTreeIcon({ node }) {
30
32
  if (node.extendedData?.imageId === undefined) {
31
33
  return undefined;
32
34
  }
33
- switch (node.extendedData.imageId) {
34
- case "icon-layers":
35
- return categorySvg;
36
- case "icon-item":
37
- return elementSvg;
38
- case "icon-ec-class":
39
- return classSvg;
40
- case "icon-folder":
41
- return subjectSvg;
42
- case "icon-model":
43
- return modelSvg;
44
- case "icon-hierarchy-tree":
45
- return hierarchyTreeSvg;
46
- case "icon-group":
47
- return groupSvg;
48
- }
49
- return undefined;
35
+ const getIcon = () => {
36
+ switch (node.extendedData.imageId) {
37
+ case "icon-layers":
38
+ return categorySvg;
39
+ case "icon-item":
40
+ return elementSvg;
41
+ case "icon-ec-class":
42
+ return classSvg;
43
+ case "icon-folder":
44
+ return subjectSvg;
45
+ case "icon-model":
46
+ return modelSvg;
47
+ case "icon-hierarchy-tree":
48
+ return hierarchyTreeSvg;
49
+ case "icon-group":
50
+ return groupSvg;
51
+ default:
52
+ return undefined;
53
+ }
54
+ };
55
+ return _jsx(Icon, { href: getIcon() });
50
56
  }
51
57
  //# sourceMappingURL=IModelContentTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IModelContentTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,WAAW,MAAM,0CAA0C,CAAC;AACnE,OAAO,QAAQ,MAAM,oCAAoC,CAAC;AAC1D,OAAO,UAAU,MAAM,sCAAsC,CAAC;AAC9D,OAAO,UAAU,MAAM,sCAAsC,CAAC;AAC9D,OAAO,QAAQ,MAAM,gCAAgC,CAAC;AACtD,OAAO,QAAQ,MAAM,qCAAqC,CAAC;AAC3D,OAAO,gB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AQ,CAAC;QAClB,KAAK,aAAa;YAChB,OAAO,UAAU,CAAC;QACpB,KAAK,YAAY;YACf,OAAO,QAAQ,CAAC;QAClB,KAAK,qBAAqB;YACxB,OAAO,gBAAgB,CAAC;QAC1B,KAAK,YAAY;YACf,OAAO,QAAQ,CAAC;KACnB;IAED,OAAO,SAAS,CAAC;AACnB,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 categorySvg from \"@itwin/itwinui-icons/bis-category-3d.svg\";\nimport classSvg from \"@itwin/itwinui-icons/bis-class.svg\";\nimport elementSvg from \"@itwin/itwinui-icons/bis-element.svg\";\nimport subjectSvg from \"@itwin/itwinui-icons/bis-subject.svg\";\nimport groupSvg from \"@itwin/itwinui-icons/group.svg\";\nimport modelSvg from \"@itwin/itwinui-icons/model-cube.svg\";\nimport hierarchyTreeSvg from \"@itwin/itwinui-icons/selection-children.svg\";\nimport { EmptyTreeContent } from \"../common/components/EmptyTree.js\";\nimport { Tree } from \"../common/components/Tree.js\";\nimport { TreeRenderer } from \"../common/components/TreeRenderer.js\";\nimport { IModelContentTreeComponent } from \"./IModelContentTreeComponent.js\";\nimport { IModelContentTreeDefinition } from \"./IModelContentTreeDefinition.js\";\nimport { IModelContentTreeIdsCache } from \"./internal/IModelContentTreeIdsCache.js\";\n\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { BaseTreeRendererProps } from \"../common/components/BaseTreeRenderer.js\";\nimport type { TreeProps } from \"../common/components/Tree.js\";\n/** @beta */\nexport type IModelContentTreeProps = Pick<TreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"selectionMode\" | \"emptyTreeContent\"> &\n Pick<BaseTreeRendererProps, \"actions\"> & {\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n };\n\n/** @beta */\nexport function IModelContentTree(props: IModelContentTreeProps) {\n return (\n <Tree\n emptyTreeContent={<EmptyTreeContent icon={modelSvg} />}\n {...props}\n treeName={IModelContentTreeComponent.id}\n getHierarchyDefinition={getDefinitionsProvider}\n selectionMode={props.selectionMode ?? \"extended\"}\n treeRenderer={(treeProps) => <TreeRenderer {...treeProps} getIcon={getIcon} />}\n />\n );\n}\n\nconst getDefinitionsProvider: TreeProps[\"getHierarchyDefinition\"] = ({ imodelAccess }) => {\n return new IModelContentTreeDefinition({\n imodelAccess,\n idsCache: new IModelContentTreeIdsCache(imodelAccess),\n });\n};\n\nfunction getIcon(node: PresentationHierarchyNode): string | undefined {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n\n switch (node.extendedData.imageId) {\n case \"icon-layers\":\n return categorySvg;\n case \"icon-item\":\n return elementSvg;\n case \"icon-ec-class\":\n return classSvg;\n case \"icon-folder\":\n return subjectSvg;\n case \"icon-model\":\n return modelSvg;\n case \"icon-hierarchy-tree\":\n return hierarchyTreeSvg;\n case \"icon-group\":\n return groupSvg;\n }\n\n return undefined;\n}\n"]}
1
+ {"version":3,"file":"IModelContentTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAapF,YAAY;AACZ,MAAM,UAAU,iBAAiB,CAAC,EAAE,OAAO,EAAE,cA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C,GAAG,CAAC,CAAC,IAAI,CAAC;AACjF,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,qCAAqC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACtF,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,6CAA6C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AAEtG,YAAY;AACZ,MAAM,UAAU,qBAAqB,CAAC,EAAE,IAAI,EAAuC;IACjF,IAAI,IAAI,CAAC,YAAY,EAAE,OAAO,KAAK,SAAS,EAAE;QAC5C,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,QAAQ,IAAI,CAAC,YAAa,CAAC,OAAO,EAAE;YAClC,KAAK,aAAa;gBAChB,OAAO,WAAW,CAAC;YACrB,KAAK,WAAW;gBACd,OAAO,UAAU,CAAC;YACpB,KAAK,eAAe;gBAClB,OAAO,QAAQ,CAAC;YAClB,KAAK,aAAa;gBAChB,OAAO,UAAU,CAAC;YACpB,KAAK,YAAY;gBACf,OAAO,QAAQ,CAAC;YAClB,KAAK,qBAAqB;gBACxB,OAAO,gBAAgB,CAAC;YAC1B,KAAK,YAAY;gBACf,OAAO,QAAQ,CAAC;YAClB;gBACE,OAAO,SAAS,CAAC;SACpB;IACH,CAAC,CAAC;IAEF,OAAO,KAAC,IAAI,IAAC,IAAI,EAAE,OAAO,EAAE,GAAI,CAAC;AACnC,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 { Icon } from \"@itwin/itwinui-react/bricks\";\nimport { EmptyTreeContent } from \"../common/components/EmptyTree.js\";\nimport { Tree } from \"../common/components/Tree.js\";\nimport { TreeRenderer } from \"../common/components/TreeRenderer.js\";\nimport { IModelContentTreeComponent } from \"./IModelContentTreeComponent.js\";\nimport { IModelContentTreeDefinition } from \"./IModelContentTreeDefinition.js\";\nimport { IModelContentTreeIdsCache } from \"./internal/IModelContentTreeIdsCache.js\";\n\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { BaseTreeRendererProps } from \"../common/components/BaseTreeRenderer.js\";\nimport type { TreeProps } from \"../common/components/Tree.js\";\n/** @beta */\nexport type IModelContentTreeProps = Pick<TreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"selectionMode\" | \"emptyTreeContent\"> &\n Pick<BaseTreeRendererProps, \"actions\" | \"getDecorations\"> & {\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n };\n\n/** @beta */\nexport function IModelContentTree({ actions, getDecorations, selectionMode, ...rest }: IModelContentTreeProps) {\n return (\n <Tree\n emptyTreeContent={<EmptyTreeContent icon={modelSvg} />}\n {...rest}\n treeName={IModelContentTreeComponent.id}\n getHierarchyDefinition={getDefinitionsProvider}\n selectionMode={selectionMode ?? \"extended\"}\n treeRenderer={(treeProps) => (\n <TreeRenderer {...treeProps} actions={actions} getDecorations={getDecorations ?? ((node) => <IModelContentTreeIcon node={node} />)} />\n )}\n />\n );\n}\n\nconst getDefinitionsProvider: TreeProps[\"getHierarchyDefinition\"] = ({ imodelAccess }) => {\n return new IModelContentTreeDefinition({\n imodelAccess,\n idsCache: new IModelContentTreeIdsCache(imodelAccess),\n });\n};\n\nconst categorySvg = new URL(\"@itwin/itwinui-icons/bis-category-3d.svg\", import.meta.url).href;\nconst classSvg = new URL(\"@itwin/itwinui-icons/bis-class.svg\", import.meta.url).href;\nconst elementSvg = new URL(\"@itwin/itwinui-icons/bis-element.svg\", import.meta.url).href;\nconst subjectSvg = new URL(\"@itwin/itwinui-icons/bis-subject.svg\", import.meta.url).href;\nconst groupSvg = new URL(\"@itwin/itwinui-icons/group.svg\", import.meta.url).href;\nconst modelSvg = new URL(\"@itwin/itwinui-icons/model-cube.svg\", import.meta.url).href;\nconst hierarchyTreeSvg = new URL(\"@itwin/itwinui-icons/selection-children.svg\", import.meta.url).href;\n\n/** @beta */\nexport function IModelContentTreeIcon({ node }: { node: PresentationHierarchyNode }) {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n\n const getIcon = () => {\n switch (node.extendedData!.imageId) {\n case \"icon-layers\":\n return categorySvg;\n case \"icon-item\":\n return elementSvg;\n case \"icon-ec-class\":\n return classSvg;\n case \"icon-folder\":\n return subjectSvg;\n case \"icon-model\":\n return modelSvg;\n case \"icon-hierarchy-tree\":\n return hierarchyTreeSvg;\n case \"icon-group\":\n return groupSvg;\n default:\n return undefined;\n }\n };\n\n return <Icon href={getIcon()} />;\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { IModelContentTreeProps } from "./IModelContentTree.js";
2
2
  /** @beta */
3
- interface IModelContentTreeComponentProps extends Pick<IModelContentTreeProps, "getSchemaContext" | "selectionStorage" | "hierarchyLevelConfig" | "selectionMode" | "emptyTreeContent" | "actions"> {
3
+ interface IModelContentTreeComponentProps extends Pick<IModelContentTreeProps, "getSchemaContext" | "selectionStorage" | "hierarchyLevelConfig" | "selectionMode" | "emptyTreeContent" | "actions" | "getDecorations"> {
4
4
  onPerformanceMeasured?: (featureId: string, duration: number) => void;
5
5
  onFeatureUsed?: (feature: string) => void;
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"IModelContentTreeComponent.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAU3D;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EAAE,aAAa,EAAE,qBAAqB,EAAE,GAAG,KAAK,EAAmC,EAAE,EAAE;IAChI,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAE3C,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,KAAC,wBAAwB,IAAC,mBAAmB,EAAE,0BAA0B,CAAC,EAAE,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,qBAAqB,YACtJ,KAAC,cAAc,cACb,KAAC,iBAAiB,IAAC,OAAO,EAAE,SAAS,KAAM,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,GACrD,GACQ,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,0BAA0B,CAAC,EAAE,GAAG,wBAAwB,CAAC;AAEzD;;;GAGG;AACH,0BAA0B,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,yBAAyB,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 { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { SelectableTree } from \"../../tree-header/SelectableTree.js\";\nimport { TelemetryContextProvider } from \"../common/UseTelemetryContext.js\";\nimport { IModelContentTree } from \"./IModelContentTree.js\";\n\nimport type { IModelContentTreeProps } from \"./IModelContentTree.js\";\n/** @beta */\ninterface IModelContentTreeComponentProps\n extends Pick<IModelContentTreeProps, \"getSchemaContext\" | \"selectionStorage\" | \"hierarchyLevelConfig\" | \"selectionMode\" | \"emptyTreeContent\" | \"actions\"> {\n onPerformanceMeasured?: (featureId: string, duration: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\n/**\n * A component that renders `IModelContentTree`.\n * @beta\n */\nexport const IModelContentTreeComponent = ({ onFeatureUsed, onPerformanceMeasured, ...props }: IModelContentTreeComponentProps) => {\n const imodel = useActiveIModelConnection();\n\n if (!imodel) {\n return null;\n }\n\n return (\n <TelemetryContextProvider componentIdentifier={IModelContentTreeComponent.id} onFeatureUsed={onFeatureUsed} onPerformanceMeasured={onPerformanceMeasured}>\n <SelectableTree>\n <IModelContentTree actions={undefined} {...props} imodel={imodel} />\n </SelectableTree>\n </TelemetryContextProvider>\n );\n};\n\n/**\n * Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nIModelContentTreeComponent.id = \"imodel-content-tree-v2\";\n\n/**\n * Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nIModelContentTreeComponent.getLabel = () => TreeWidget.translate(\"imodelContentTree.label\");\n"]}
1
+ {"version":3,"file":"IModelContentTreeComponent.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAa3D;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EAAE,aAAa,EAAE,qBAAqB,EAAE,GAAG,KAAK,EAAmC,EAAE,EAAE;IAChI,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAE3C,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,KAAC,wBAAwB,IAAC,mBAAmB,EAAE,0BAA0B,CAAC,EAAE,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,qBAAqB,YACtJ,KAAC,cAAc,cACb,KAAC,iBAAiB,IAAC,OAAO,EAAE,SAAS,KAAM,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,GACrD,GACQ,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,0BAA0B,CAAC,EAAE,GAAG,wBAAwB,CAAC;AAEzD;;;GAGG;AACH,0BAA0B,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,yBAAyB,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 { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { SelectableTree } from \"../../tree-header/SelectableTree.js\";\nimport { TelemetryContextProvider } from \"../common/UseTelemetryContext.js\";\nimport { IModelContentTree } from \"./IModelContentTree.js\";\n\nimport type { IModelContentTreeProps } from \"./IModelContentTree.js\";\n/** @beta */\ninterface IModelContentTreeComponentProps\n extends Pick<\n IModelContentTreeProps,\n \"getSchemaContext\" | \"selectionStorage\" | \"hierarchyLevelConfig\" | \"selectionMode\" | \"emptyTreeContent\" | \"actions\" | \"getDecorations\"\n > {\n onPerformanceMeasured?: (featureId: string, duration: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\n/**\n * A component that renders `IModelContentTree`.\n * @beta\n */\nexport const IModelContentTreeComponent = ({ onFeatureUsed, onPerformanceMeasured, ...props }: IModelContentTreeComponentProps) => {\n const imodel = useActiveIModelConnection();\n\n if (!imodel) {\n return null;\n }\n\n return (\n <TelemetryContextProvider componentIdentifier={IModelContentTreeComponent.id} onFeatureUsed={onFeatureUsed} onPerformanceMeasured={onPerformanceMeasured}>\n <SelectableTree>\n <IModelContentTree actions={undefined} {...props} imodel={imodel} />\n </SelectableTree>\n </TelemetryContextProvider>\n );\n};\n\n/**\n * Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nIModelContentTreeComponent.id = \"imodel-content-tree-v2\";\n\n/**\n * Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nIModelContentTreeComponent.getLabel = () => TreeWidget.translate(\"imodelContentTree.label\");\n"]}
@@ -1,9 +1,11 @@
1
1
  export { ModelsTreeComponent } from "./models-tree/ModelsTreeComponent.js";
2
2
  export { CategoriesTreeComponent } from "./categories-tree/CategoriesTreeComponent.js";
3
3
  export { IModelContentTreeComponent } from "./imodel-content-tree/IModelContentTreeComponent.js";
4
+ export { IModelContentTreeIcon } from "./imodel-content-tree/IModelContentTree.js";
4
5
  export { ExternalSourcesTreeComponent } from "./external-sources-tree/ExternalSourcesTreeComponent.js";
5
- export { useModelsTree } from "./models-tree/UseModelsTree.js";
6
- export { useCategoriesTree } from "./categories-tree/UseCategoriesTree.js";
6
+ export { ExternalSourcesTreeIcon } from "./external-sources-tree/ExternalSourcesTree.js";
7
+ export { useModelsTree, ModelsTreeIcon } from "./models-tree/UseModelsTree.js";
8
+ export { useCategoriesTree, CategoriesTreeIcon } from "./categories-tree/UseCategoriesTree.js";
7
9
  export { useModelsTreeButtonProps } from "./models-tree/ModelsTreeButtons.js";
8
10
  export { useCategoriesTreeButtonProps } from "./categories-tree/CategoriesTreeButtons.js";
9
11
  export { BaseTreeRendererProps } from "./common/components/BaseTreeRenderer.js";
@@ -5,9 +5,11 @@
5
5
  export { ModelsTreeComponent } from "./models-tree/ModelsTreeComponent.js";
6
6
  export { CategoriesTreeComponent } from "./categories-tree/CategoriesTreeComponent.js";
7
7
  export { IModelContentTreeComponent } from "./imodel-content-tree/IModelContentTreeComponent.js";
8
+ export { IModelContentTreeIcon } from "./imodel-content-tree/IModelContentTree.js";
8
9
  export { ExternalSourcesTreeComponent } from "./external-sources-tree/ExternalSourcesTreeComponent.js";
9
- export { useModelsTree } from "./models-tree/UseModelsTree.js";
10
- export { useCategoriesTree } from "./categories-tree/UseCategoriesTree.js";
10
+ export { ExternalSourcesTreeIcon } from "./external-sources-tree/ExternalSourcesTree.js";
11
+ export { useModelsTree, ModelsTreeIcon } from "./models-tree/UseModelsTree.js";
12
+ export { useCategoriesTree, CategoriesTreeIcon } from "./categories-tree/UseCategoriesTree.js";
11
13
  export { useModelsTreeButtonProps } from "./models-tree/ModelsTreeButtons.js";
12
14
  export { useCategoriesTreeButtonProps } from "./categories-tree/CategoriesTreeButtons.js";
13
15
  export { FocusedInstancesContextProvider, useFocusedInstancesContext } from "./common/FocusedInstancesContext.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/tree-widget-react/components/trees/index.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,qDAAqD,CAAC;AACjG,OAAO,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AAEvG,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAG1F,OAAO,EAAE,+BAA+B,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAElH,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nexport { ModelsTreeComponent } from \"./models-tree/ModelsTreeComponent.js\";\nexport { CategoriesTreeComponent } from \"./categories-tree/CategoriesTreeComponent.js\";\nexport { IModelContentTreeComponent } from \"./imodel-content-tree/IModelContentTreeComponent.js\";\nexport { ExternalSourcesTreeComponent } from \"./external-sources-tree/ExternalSourcesTreeComponent.js\";\n\nexport { useModelsTree } from \"./models-tree/UseModelsTree.js\";\nexport { useCategoriesTree } from \"./categories-tree/UseCategoriesTree.js\";\n\nexport { useModelsTreeButtonProps } from \"./models-tree/ModelsTreeButtons.js\";\nexport { useCategoriesTreeButtonProps } from \"./categories-tree/CategoriesTreeButtons.js\";\n\nexport { BaseTreeRendererProps } from \"./common/components/BaseTreeRenderer.js\";\nexport { FocusedInstancesContextProvider, useFocusedInstancesContext } from \"./common/FocusedInstancesContext.js\";\n\nexport { Tree } from \"./common/components/Tree.js\";\nexport { VisibilityTree } from \"./common/components/VisibilityTree.js\";\nexport { TreeRenderer } from \"./common/components/TreeRenderer.js\";\nexport { VisibilityTreeRenderer } from \"./common/components/VisibilityTreeRenderer.js\";\nexport { HierarchyVisibilityHandler, VisibilityStatus } from \"./common/UseHierarchyVisibility.js\";\nexport { TelemetryContextProvider } from \"./common/UseTelemetryContext.js\";\nexport { FilterLimitExceededError } from \"./common/TreeErrors.js\";\n\nexport { ModelsTreeVisibilityHandlerOverrides } from \"./models-tree/internal/ModelsTreeVisibilityHandler.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/tree-widget-react/components/trees/index.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,qDAAqD,CAAC;AACjG,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AACvG,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAEzF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAE/F,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAG1F,OAAO,EAAE,+BAA+B,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAElH,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nexport { ModelsTreeComponent } from \"./models-tree/ModelsTreeComponent.js\";\nexport { CategoriesTreeComponent } from \"./categories-tree/CategoriesTreeComponent.js\";\nexport { IModelContentTreeComponent } from \"./imodel-content-tree/IModelContentTreeComponent.js\";\nexport { IModelContentTreeIcon } from \"./imodel-content-tree/IModelContentTree.js\";\nexport { ExternalSourcesTreeComponent } from \"./external-sources-tree/ExternalSourcesTreeComponent.js\";\nexport { ExternalSourcesTreeIcon } from \"./external-sources-tree/ExternalSourcesTree.js\";\n\nexport { useModelsTree, ModelsTreeIcon } from \"./models-tree/UseModelsTree.js\";\nexport { useCategoriesTree, CategoriesTreeIcon } from \"./categories-tree/UseCategoriesTree.js\";\n\nexport { useModelsTreeButtonProps } from \"./models-tree/ModelsTreeButtons.js\";\nexport { useCategoriesTreeButtonProps } from \"./categories-tree/CategoriesTreeButtons.js\";\n\nexport { BaseTreeRendererProps } from \"./common/components/BaseTreeRenderer.js\";\nexport { FocusedInstancesContextProvider, useFocusedInstancesContext } from \"./common/FocusedInstancesContext.js\";\n\nexport { Tree } from \"./common/components/Tree.js\";\nexport { VisibilityTree } from \"./common/components/VisibilityTree.js\";\nexport { TreeRenderer } from \"./common/components/TreeRenderer.js\";\nexport { VisibilityTreeRenderer } from \"./common/components/VisibilityTreeRenderer.js\";\nexport { HierarchyVisibilityHandler, VisibilityStatus } from \"./common/UseHierarchyVisibility.js\";\nexport { TelemetryContextProvider } from \"./common/UseTelemetryContext.js\";\nexport { FilterLimitExceededError } from \"./common/TreeErrors.js\";\n\nexport { ModelsTreeVisibilityHandlerOverrides } from \"./models-tree/internal/ModelsTreeVisibilityHandler.js\";\n"]}
@@ -2,11 +2,11 @@ import type { VisibilityTreeRendererProps } from "../common/components/Visibilit
2
2
  import type { UseModelsTreeProps } from "./UseModelsTree.js";
3
3
  import type { VisibilityTreeProps } from "../common/components/VisibilityTree.js";
4
4
  /** @beta */
5
- export type ModelsTreeProps = Pick<VisibilityTreeProps, "imodel" | "getSchemaContext" | "selectionStorage" | "selectionMode" | "emptyTreeContent"> & Pick<VisibilityTreeRendererProps, "actions"> & UseModelsTreeProps & {
5
+ export type ModelsTreeProps = Pick<VisibilityTreeProps, "imodel" | "getSchemaContext" | "selectionStorage" | "selectionMode" | "emptyTreeContent"> & Pick<VisibilityTreeRendererProps, "actions" | "getDecorations"> & UseModelsTreeProps & {
6
6
  hierarchyLevelConfig?: {
7
7
  sizeLimit?: number;
8
8
  };
9
9
  };
10
10
  /** @beta */
11
- export declare function ModelsTree({ imodel, getSchemaContext, selectionStorage, activeView, filter, hierarchyLevelConfig, hierarchyConfig, selectionMode, selectionPredicate, visibilityHandlerOverrides, getFilteredPaths, onModelsFiltered, actions, emptyTreeContent, }: ModelsTreeProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function ModelsTree({ imodel, getSchemaContext, selectionStorage, activeView, filter, hierarchyLevelConfig, hierarchyConfig, selectionMode, selectionPredicate, visibilityHandlerOverrides, getFilteredPaths, getDecorations, onModelsFiltered, actions, emptyTreeContent, }: ModelsTreeProps): import("react/jsx-runtime").JSX.Element;
12
12
  //# sourceMappingURL=ModelsTree.d.ts.map
@@ -7,7 +7,7 @@ import { VisibilityTree } from "../common/components/VisibilityTree.js";
7
7
  import { VisibilityTreeRenderer } from "../common/components/VisibilityTreeRenderer.js";
8
8
  import { useModelsTree } from "./UseModelsTree.js";
9
9
  /** @beta */
10
- export function ModelsTree({ imodel, getSchemaContext, selectionStorage, activeView, filter, hierarchyLevelConfig, hierarchyConfig, selectionMode, selectionPredicate, visibilityHandlerOverrides, getFilteredPaths, onModelsFiltered, actions, emptyTreeContent, }) {
10
+ export function ModelsTree({ imodel, getSchemaContext, selectionStorage, activeView, filter, hierarchyLevelConfig, hierarchyConfig, selectionMode, selectionPredicate, visibilityHandlerOverrides, getFilteredPaths, getDecorations, onModelsFiltered, actions, emptyTreeContent, }) {
11
11
  const { modelsTreeProps, rendererProps } = useModelsTree({
12
12
  activeView,
13
13
  filter,
@@ -18,6 +18,6 @@ export function ModelsTree({ imodel, getSchemaContext, selectionStorage, activeV
18
18
  selectionPredicate,
19
19
  emptyTreeContent,
20
20
  });
21
- return (_jsx(VisibilityTree, { ...modelsTreeProps, imodel: imodel, selectionStorage: selectionStorage, getSchemaContext: getSchemaContext, hierarchyLevelSizeLimit: hierarchyLevelConfig?.sizeLimit, selectionMode: selectionMode, treeRenderer: (treeProps) => _jsx(VisibilityTreeRenderer, { ...treeProps, ...rendererProps, actions: actions }) }));
21
+ return (_jsx(VisibilityTree, { ...modelsTreeProps, imodel: imodel, selectionStorage: selectionStorage, getSchemaContext: getSchemaContext, hierarchyLevelSizeLimit: hierarchyLevelConfig?.sizeLimit, selectionMode: selectionMode, treeRenderer: (treeProps) => (_jsx(VisibilityTreeRenderer, { ...treeProps, ...rendererProps, actions: actions, getDecorations: getDecorations ?? rendererProps.getDecorations })) }));
22
22
  }
23
23
  //# sourceMappingURL=ModelsTree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModelsTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/models-tree/ModelsTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAcnD,YAAY;AACZ,MAAM,UAAU,UAAU,CAAC,EACzB,MAAM,EACN,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,MAAM,EACN,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,0BAA0B,EAC1B,gBAAgB,EAChB,gBAAgB,EAChB,OAAO,EACP,gBAAgB,GACA;IAChB,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC;QACvD,UAAU;QACV,MAAM;QACN,eAAe;QACf,0BAA0B;QAC1B,gBAAgB;QAChB,gBAAgB;QAChB,kBAAkB;QAClB,gBAAgB;KACjB,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,cAAc,OACT,eAAe,EACnB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,uBAAuB,EAAE,oBAAoB,EAAE,SAAS,EACxD,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,KAAC,sBAAsB,OAAK,SAAS,KAAM,aAAa,EAAE,OAAO,EAAE,OAAO,GAAI,GAC3G,CACH,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { VisibilityTree } from \"../common/components/VisibilityTree.js\";\nimport { VisibilityTreeRenderer } from \"../common/components/VisibilityTreeRenderer.js\";\nimport { useModelsTree } from \"./UseModelsTree.js\";\n\nimport type { VisibilityTreeRendererProps } from \"../common/components/VisibilityTreeRenderer.js\";\nimport type { UseModelsTreeProps } from \"./UseModelsTree.js\";\nimport type { VisibilityTreeProps } from \"../common/components/VisibilityTree.js\";\n/** @beta */\nexport type ModelsTreeProps = Pick<VisibilityTreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"selectionMode\" | \"emptyTreeContent\"> &\n Pick<VisibilityTreeRendererProps, \"actions\"> &\n UseModelsTreeProps & {\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n };\n\n/** @beta */\nexport function ModelsTree({\n imodel,\n getSchemaContext,\n selectionStorage,\n activeView,\n filter,\n hierarchyLevelConfig,\n hierarchyConfig,\n selectionMode,\n selectionPredicate,\n visibilityHandlerOverrides,\n getFilteredPaths,\n onModelsFiltered,\n actions,\n emptyTreeContent,\n}: ModelsTreeProps) {\n const { modelsTreeProps, rendererProps } = useModelsTree({\n activeView,\n filter,\n hierarchyConfig,\n visibilityHandlerOverrides,\n getFilteredPaths,\n onModelsFiltered,\n selectionPredicate,\n emptyTreeContent,\n });\n\n return (\n <VisibilityTree\n {...modelsTreeProps}\n imodel={imodel}\n selectionStorage={selectionStorage}\n getSchemaContext={getSchemaContext}\n hierarchyLevelSizeLimit={hierarchyLevelConfig?.sizeLimit}\n selectionMode={selectionMode}\n treeRenderer={(treeProps) => <VisibilityTreeRenderer {...treeProps} {...rendererProps} actions={actions} />}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"ModelsTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/models-tree/ModelsTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAcnD,YAAY;AACZ,MAAM,UAAU,UAAU,CAAC,EACzB,MAAM,EACN,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,MAAM,EACN,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,0BAA0B,EAC1B,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,gBAAgB,GACA;IAChB,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,GAAG,aAAa,CAAC;QACvD,UAAU;QACV,MAAM;QACN,eAAe;QACf,0BAA0B;QAC1B,gBAAgB;QAChB,gBAAgB;QAChB,kBAAkB;QAClB,gBAAgB;KACjB,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,cAAc,OACT,eAAe,EACnB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,uBAAuB,EAAE,oBAAoB,EAAE,SAAS,EACxD,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,CAC3B,KAAC,sBAAsB,OAAK,SAAS,KAAM,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,IAAI,aAAa,CAAC,cAAc,GAAI,CAC/I,GACD,CACH,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { VisibilityTree } from \"../common/components/VisibilityTree.js\";\nimport { VisibilityTreeRenderer } from \"../common/components/VisibilityTreeRenderer.js\";\nimport { useModelsTree } from \"./UseModelsTree.js\";\n\nimport type { VisibilityTreeRendererProps } from \"../common/components/VisibilityTreeRenderer.js\";\nimport type { UseModelsTreeProps } from \"./UseModelsTree.js\";\nimport type { VisibilityTreeProps } from \"../common/components/VisibilityTree.js\";\n/** @beta */\nexport type ModelsTreeProps = Pick<VisibilityTreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"selectionMode\" | \"emptyTreeContent\"> &\n Pick<VisibilityTreeRendererProps, \"actions\" | \"getDecorations\"> &\n UseModelsTreeProps & {\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n };\n\n/** @beta */\nexport function ModelsTree({\n imodel,\n getSchemaContext,\n selectionStorage,\n activeView,\n filter,\n hierarchyLevelConfig,\n hierarchyConfig,\n selectionMode,\n selectionPredicate,\n visibilityHandlerOverrides,\n getFilteredPaths,\n getDecorations,\n onModelsFiltered,\n actions,\n emptyTreeContent,\n}: ModelsTreeProps) {\n const { modelsTreeProps, rendererProps } = useModelsTree({\n activeView,\n filter,\n hierarchyConfig,\n visibilityHandlerOverrides,\n getFilteredPaths,\n onModelsFiltered,\n selectionPredicate,\n emptyTreeContent,\n });\n\n return (\n <VisibilityTree\n {...modelsTreeProps}\n imodel={imodel}\n selectionStorage={selectionStorage}\n getSchemaContext={getSchemaContext}\n hierarchyLevelSizeLimit={hierarchyLevelConfig?.sizeLimit}\n selectionMode={selectionMode}\n treeRenderer={(treeProps) => (\n <VisibilityTreeRenderer {...treeProps} {...rendererProps} actions={actions} getDecorations={getDecorations ?? rendererProps.getDecorations} />\n )}\n />\n );\n}\n"]}
@@ -4,12 +4,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  * See LICENSE.md in the project root for license terms and full copyright notice.
5
5
  *--------------------------------------------------------------------------------------------*/
6
6
  import { useEffect, useMemo, useState } from "react";
7
- import toggle2DSvg from "@itwin/itwinui-icons/2d.svg";
8
- import toggle3DSvg from "@itwin/itwinui-icons/3d.svg";
9
- import focusModeSvg from "@itwin/itwinui-icons/cursor-click.svg";
10
- import visibilityHideSvg from "@itwin/itwinui-icons/visibility-hide.svg";
11
- import visibilityShowSvg from "@itwin/itwinui-icons/visibility-show.svg";
12
- import visibilityInvertSvg from "@itwin/itwinui-icons/visibilty-invert.svg";
13
7
  import { IconButton } from "@itwin/itwinui-react/bricks";
14
8
  import { TreeWidget } from "../../../TreeWidget.js";
15
9
  import { useFocusedInstancesContext } from "../common/FocusedInstancesContext.js";
@@ -74,6 +68,7 @@ async function queryModelsForHeaderActions(iModel) {
74
68
  const modelProps = await iModel.models.queryProps(queryParams);
75
69
  return modelProps.map(({ id, isPlanProjection }) => ({ id, isPlanProjection })).filter(({ id }) => id);
76
70
  }
71
+ const visibilityShowSvg = new URL("@itwin/itwinui-icons/visibility-show.svg", import.meta.url).href;
77
72
  /** @public */
78
73
  export function ShowAllButton(props) {
79
74
  return (_jsx(IconButton, { variant: "ghost", label: TreeWidget.translate("modelsTree.buttons.showAll.tooltip"), onClick: () => {
@@ -81,6 +76,7 @@ export function ShowAllButton(props) {
81
76
  void showAllModels(props.models.map((model) => model.id), props.viewport);
82
77
  }, icon: visibilityShowSvg }));
83
78
  }
79
+ const visibilityHideSvg = new URL("@itwin/itwinui-icons/visibility-hide.svg", import.meta.url).href;
84
80
  /** @public */
85
81
  export function HideAllButton(props) {
86
82
  return (_jsx(IconButton, { variant: "ghost", label: TreeWidget.translate("modelsTree.buttons.hideAll.tooltip"), onClick: () => {
@@ -88,6 +84,7 @@ export function HideAllButton(props) {
88
84
  void hideAllModels(props.models.map((model) => model.id), props.viewport);
89
85
  }, icon: visibilityHideSvg }));
90
86
  }
87
+ const visibilityInvertSvg = new URL("@itwin/itwinui-icons/visibilty-invert.svg", import.meta.url).href;
91
88
  /** @public */
92
89
  export function InvertButton(props) {
93
90
  return (_jsx(IconButton, { variant: "ghost", label: TreeWidget.translate("modelsTree.buttons.invert.tooltip"), onClick: () => {
@@ -95,6 +92,7 @@ export function InvertButton(props) {
95
92
  void invertAllModels(props.models.map((model) => model.id), props.viewport);
96
93
  }, icon: visibilityInvertSvg }));
97
94
  }
95
+ const toggle2DSvg = new URL("@itwin/itwinui-icons/2d.svg", import.meta.url).href;
98
96
  /** @public */
99
97
  export function View2DButton(props) {
100
98
  const models2d = useMemo(() => {
@@ -110,6 +108,7 @@ export function View2DButton(props) {
110
108
  void toggleModels(models2d, is2dToggleActive, props.viewport);
111
109
  }, "aria-disabled": models2d.length === 0, isActive: is2dToggleActive, icon: toggle2DSvg }));
112
110
  }
111
+ const toggle3DSvg = new URL("@itwin/itwinui-icons/3d.svg", import.meta.url).href;
113
112
  /** @public */
114
113
  export function View3DButton(props) {
115
114
  const models3d = useMemo(() => {
@@ -125,6 +124,7 @@ export function View3DButton(props) {
125
124
  void toggleModels(models3d, is3dToggleActive, props.viewport);
126
125
  }, "aria-disabled": models3d.length === 0, isActive: is3dToggleActive, icon: toggle3DSvg }));
127
126
  }
127
+ const focusModeSvg = new URL("@itwin/itwinui-icons/cursor-click.svg", import.meta.url).href;
128
128
  /** @public */
129
129
  export function ToggleInstancesFocusButton({ onFeatureUsed, disabled }) {
130
130
  const { enabled, toggle } = useFocusedInstancesContext();
@@ -1 +1 @@
1
- {"version":3,"file":"ModelsTreeButtons.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAA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,CAAC,SAAS,CAAC,mDAAmD,CAAC,CAAC;IAChF,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,GAAG,EAAE;YACZ,aAAa,EAAE,CAAC,4BAA4B,CAAC,CAAC;YAC9C,MAAM,EAAE,CAAC;QACX,CAAC,mBACc,QAAQ,EACvB,QAAQ,EAAE,OAAO,EACjB,IAAI,EAAE,YAAY,GAClB,CACH,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useEffect, useMemo, useState } from \"react\";\nimport toggle2DSvg from \"@itwin/itwinui-icons/2d.svg\";\nimport toggle3DSvg from \"@itwin/itwinui-icons/3d.svg\";\nimport focusModeSvg from \"@itwin/itwinui-icons/cursor-click.svg\";\nimport visibilityHideSvg from \"@itwin/itwinui-icons/visibility-hide.svg\";\nimport visibilityShowSvg from \"@itwin/itwinui-icons/visibility-show.svg\";\nimport visibilityInvertSvg from \"@itwin/itwinui-icons/visibilty-invert.svg\";\nimport { IconButton } from \"@itwin/itwinui-react/bricks\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { useFocusedInstancesContext } from \"../common/FocusedInstancesContext.js\";\nimport { areAllModelsVisible, hideAllModels, invertAllModels, showAllModels, toggleModels } from \"./internal/ModelsTreeVisibilityHandler.js\";\n\nimport type { Id64String } from \"@itwin/core-bentley\";\nimport type { GeometricModel3dProps, ModelQueryParams } from \"@itwin/core-common\";\nimport type { IModelConnection, Viewport } from \"@itwin/core-frontend\";\nimport type { TreeToolbarButtonProps } from \"../../tree-header/SelectableTree.js\";\n\n/**\n * Information about a single Model.\n * @public\n */\nexport interface ModelInfo {\n id: string;\n isPlanProjection?: boolean;\n}\n\n/**\n * Props that get passed to `ModelsTreeComponent` header button renderer.\n * @see ModelTreeComponentProps.headerButtons\n * @public\n */\nexport interface ModelsTreeHeaderButtonProps extends TreeToolbarButtonProps {\n /** A list of models available in the iModel. */\n models: ModelInfo[];\n}\n\n/**\n * Custom hook that creates props required to render `ModelsTreeComponent` header button.\n *\n * Example:\n * ```tsx\n * const { buttonProps, onModelsFiltered } = useModelsTreeButtonProps({ imodel, viewport });\n * <TreeWithHeader\n * buttons={[\n * <ModelsTreeComponent.ShowAllButton {...buttonProps} />,\n * <ModelsTreeComponent.HideAllButton {...buttonProps} />,\n * ]}\n * >\n * <ModelsTree {...treeProps} onModelsFiltered={onModelsFiltered} />\n * </TreeWithHeader>\n * ```\n *\n *\n * @public\n */\nexport function useModelsTreeButtonProps({ imodel, viewport }: { imodel: IModelConnection; viewport: Viewport }): {\n buttonProps: Pick<ModelsTreeHeaderButtonProps, \"models\" | \"viewport\">;\n onModelsFiltered: (models: Id64String[] | undefined) => void;\n} {\n const [filteredModels, setFilteredModels] = useState<Id64String[] | undefined>();\n const models = useAvailableModels(imodel);\n const availableModels = useMemo(() => (!filteredModels ? models : models.filter((model) => filteredModels.includes(model.id))), [models, filteredModels]);\n return {\n buttonProps: {\n models: availableModels,\n viewport,\n },\n onModelsFiltered: setFilteredModels,\n };\n}\n\nfunction useAvailableModels(imodel: IModelConnection): ModelInfo[] {\n const [availableModels, setAvailableModels] = useState<ModelInfo[]>([]);\n\n useEffect(() => {\n queryModelsForHeaderActions(imodel)\n .then((modelInfos: ModelInfo[]) => {\n setAvailableModels(modelInfos);\n })\n .catch(() => {\n setAvailableModels([]);\n });\n }, [imodel]);\n\n return availableModels;\n}\n\nasync function queryModelsForHeaderActions(iModel: IModelConnection) {\n const queryParams: ModelQueryParams = {\n from: \"BisCore.GeometricModel3d\",\n where: `\n EXISTS (\n SELECT 1\n FROM BisCore.Element e\n WHERE e.ECClassId IS (BisCore.GeometricElement3d, BisCore.InformationPartitionElement)\n AND e.ECInstanceId = GeometricModel3d.ModeledElement.Id\n )\n `,\n wantPrivate: false,\n };\n\n const modelProps = await iModel.models.queryProps(queryParams);\n return modelProps.map(({ id, isPlanProjection }: GeometricModel3dProps) => ({ id, isPlanProjection })).filter(({ id }) => id) as ModelInfo[];\n}\n\n/** @public */\nexport type ModelsTreeHeaderButtonType = (props: ModelsTreeHeaderButtonProps) => React.ReactElement | null;\n\n/** @public */\nexport function ShowAllButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n variant={\"ghost\"}\n label={TreeWidget.translate(\"modelsTree.buttons.showAll.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-showall\");\n void showAllModels(\n props.models.map((model) => model.id),\n props.viewport,\n );\n }}\n icon={visibilityShowSvg}\n />\n );\n}\n\n/** @public */\nexport function HideAllButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n variant={\"ghost\"}\n label={TreeWidget.translate(\"modelsTree.buttons.hideAll.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-hideall\");\n void hideAllModels(\n props.models.map((model) => model.id),\n props.viewport,\n );\n }}\n icon={visibilityHideSvg}\n />\n );\n}\n\n/** @public */\nexport function InvertButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n variant={\"ghost\"}\n label={TreeWidget.translate(\"modelsTree.buttons.invert.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-invert\");\n void invertAllModels(\n props.models.map((model) => model.id),\n props.viewport,\n );\n }}\n icon={visibilityInvertSvg}\n />\n );\n}\n\n/** @public */\nexport function View2DButton(props: ModelsTreeHeaderButtonProps) {\n const models2d = useMemo(() => {\n return props.models.filter((model) => model.isPlanProjection).map((model) => model.id);\n }, [props.models]);\n\n const [is2dToggleActive, setIs2dToggleActive] = useState(false);\n\n useEffect(() => {\n setIs2dToggleActive(areAllModelsVisible(models2d, props.viewport));\n return props.viewport.onViewedModelsChanged.addListener((vp: Viewport) => setIs2dToggleActive(areAllModelsVisible(models2d, vp)));\n }, [models2d, props.viewport]);\n\n return (\n <IconButton\n variant={\"ghost\"}\n label={TreeWidget.translate(\"modelsTree.buttons.toggle2d.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-view2d\");\n void toggleModels(models2d, is2dToggleActive, props.viewport);\n }}\n aria-disabled={models2d.length === 0}\n isActive={is2dToggleActive}\n icon={toggle2DSvg}\n />\n );\n}\n\n/** @public */\nexport function View3DButton(props: ModelsTreeHeaderButtonProps) {\n const models3d = useMemo(() => {\n return props.models.filter((model) => !model.isPlanProjection).map((model) => model.id);\n }, [props.models]);\n\n const [is3dToggleActive, setIs3dToggleActive] = useState(false);\n\n useEffect(() => {\n setIs3dToggleActive(areAllModelsVisible(models3d, props.viewport));\n return props.viewport.onViewedModelsChanged.addListener((vp: Viewport) => setIs3dToggleActive(areAllModelsVisible(models3d, vp)));\n }, [models3d, props.viewport]);\n\n return (\n <IconButton\n variant={\"ghost\"}\n label={TreeWidget.translate(\"modelsTree.buttons.toggle3d.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-view3d\");\n void toggleModels(models3d, is3dToggleActive, props.viewport);\n }}\n aria-disabled={models3d.length === 0}\n isActive={is3dToggleActive}\n icon={toggle3DSvg}\n />\n );\n}\n\n/** @public */\nexport function ToggleInstancesFocusButton({ onFeatureUsed, disabled }: { onFeatureUsed?: (feature: string) => void; disabled?: boolean }) {\n const { enabled, toggle } = useFocusedInstancesContext();\n const label = disabled\n ? TreeWidget.translate(\"modelsTree.buttons.toggleFocusMode.disabled.tooltip\")\n : enabled\n ? TreeWidget.translate(\"modelsTree.buttons.toggleFocusMode.disable.tooltip\")\n : TreeWidget.translate(\"modelsTree.buttons.toggleFocusMode.enable.tooltip\");\n return (\n <IconButton\n variant={\"ghost\"}\n label={label}\n onClick={() => {\n onFeatureUsed?.(\"models-tree-instancesfocus\");\n toggle();\n }}\n aria-disabled={disabled}\n isActive={enabled}\n icon={focusModeSvg}\n />\n );\n}\n"]}
1
+ {"version":3,"file":"ModelsTre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AE,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QAChE,CAAC,mBACc,QAAQ,CAAC,MAAM,KAAK,CAAC,EACpC,QAAQ,EAAE,gBAAgB,EAC1B,IAAI,EAAE,WAAW,GACjB,CACH,CAAC;AACJ,CAAC;AAED,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,uCAAuC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AAE5F,cAAc;AACd,MAAM,UAAU,0BAA0B,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAqE;IACvI,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,0BAA0B,EAAE,CAAC;IACzD,MAAM,KAAK,GAAG,QAAQ;QACpB,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,qDAAqD,CAAC;QAC7E,CAAC,CAAC,OAAO;YACP,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,oDAAoD,CAAC;YAC5E,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,mDAAmD,CAAC,CAAC;IAChF,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,GAAG,EAAE;YACZ,aAAa,EAAE,CAAC,4BAA4B,CAAC,CAAC;YAC9C,MAAM,EAAE,CAAC;QACX,CAAC,mBACc,QAAQ,EACvB,QAAQ,EAAE,OAAO,EACjB,IAAI,EAAE,YAAY,GAClB,CACH,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useEffect, useMemo, useState } from \"react\";\nimport { IconButton } from \"@itwin/itwinui-react/bricks\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { useFocusedInstancesContext } from \"../common/FocusedInstancesContext.js\";\nimport { areAllModelsVisible, hideAllModels, invertAllModels, showAllModels, toggleModels } from \"./internal/ModelsTreeVisibilityHandler.js\";\n\nimport type { Id64String } from \"@itwin/core-bentley\";\nimport type { GeometricModel3dProps, ModelQueryParams } from \"@itwin/core-common\";\nimport type { IModelConnection, Viewport } from \"@itwin/core-frontend\";\nimport type { TreeToolbarButtonProps } from \"../../tree-header/SelectableTree.js\";\n\n/**\n * Information about a single Model.\n * @public\n */\nexport interface ModelInfo {\n id: string;\n isPlanProjection?: boolean;\n}\n\n/**\n * Props that get passed to `ModelsTreeComponent` header button renderer.\n * @see ModelTreeComponentProps.headerButtons\n * @public\n */\nexport interface ModelsTreeHeaderButtonProps extends TreeToolbarButtonProps {\n /** A list of models available in the iModel. */\n models: ModelInfo[];\n}\n\n/**\n * Custom hook that creates props required to render `ModelsTreeComponent` header button.\n *\n * Example:\n * ```tsx\n * const { buttonProps, onModelsFiltered } = useModelsTreeButtonProps({ imodel, viewport });\n * <TreeWithHeader\n * buttons={[\n * <ModelsTreeComponent.ShowAllButton {...buttonProps} />,\n * <ModelsTreeComponent.HideAllButton {...buttonProps} />,\n * ]}\n * >\n * <ModelsTree {...treeProps} onModelsFiltered={onModelsFiltered} />\n * </TreeWithHeader>\n * ```\n *\n *\n * @public\n */\nexport function useModelsTreeButtonProps({ imodel, viewport }: { imodel: IModelConnection; viewport: Viewport }): {\n buttonProps: Pick<ModelsTreeHeaderButtonProps, \"models\" | \"viewport\">;\n onModelsFiltered: (models: Id64String[] | undefined) => void;\n} {\n const [filteredModels, setFilteredModels] = useState<Id64String[] | undefined>();\n const models = useAvailableModels(imodel);\n const availableModels = useMemo(() => (!filteredModels ? models : models.filter((model) => filteredModels.includes(model.id))), [models, filteredModels]);\n return {\n buttonProps: {\n models: availableModels,\n viewport,\n },\n onModelsFiltered: setFilteredModels,\n };\n}\n\nfunction useAvailableModels(imodel: IModelConnection): ModelInfo[] {\n const [availableModels, setAvailableModels] = useState<ModelInfo[]>([]);\n\n useEffect(() => {\n queryModelsForHeaderActions(imodel)\n .then((modelInfos: ModelInfo[]) => {\n setAvailableModels(modelInfos);\n })\n .catch(() => {\n setAvailableModels([]);\n });\n }, [imodel]);\n\n return availableModels;\n}\n\nasync function queryModelsForHeaderActions(iModel: IModelConnection) {\n const queryParams: ModelQueryParams = {\n from: \"BisCore.GeometricModel3d\",\n where: `\n EXISTS (\n SELECT 1\n FROM BisCore.Element e\n WHERE e.ECClassId IS (BisCore.GeometricElement3d, BisCore.InformationPartitionElement)\n AND e.ECInstanceId = GeometricModel3d.ModeledElement.Id\n )\n `,\n wantPrivate: false,\n };\n\n const modelProps = await iModel.models.queryProps(queryParams);\n return modelProps.map(({ id, isPlanProjection }: GeometricModel3dProps) => ({ id, isPlanProjection })).filter(({ id }) => id) as ModelInfo[];\n}\n\n/** @public */\nexport type ModelsTreeHeaderButtonType = (props: ModelsTreeHeaderButtonProps) => React.ReactElement | null;\n\nconst visibilityShowSvg = new URL(\"@itwin/itwinui-icons/visibility-show.svg\", import.meta.url).href;\n\n/** @public */\nexport function ShowAllButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n variant={\"ghost\"}\n label={TreeWidget.translate(\"modelsTree.buttons.showAll.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-showall\");\n void showAllModels(\n props.models.map((model) => model.id),\n props.viewport,\n );\n }}\n icon={visibilityShowSvg}\n />\n );\n}\n\nconst visibilityHideSvg = new URL(\"@itwin/itwinui-icons/visibility-hide.svg\", import.meta.url).href;\n\n/** @public */\nexport function HideAllButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n variant={\"ghost\"}\n label={TreeWidget.translate(\"modelsTree.buttons.hideAll.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-hideall\");\n void hideAllModels(\n props.models.map((model) => model.id),\n props.viewport,\n );\n }}\n icon={visibilityHideSvg}\n />\n );\n}\n\nconst visibilityInvertSvg = new URL(\"@itwin/itwinui-icons/visibilty-invert.svg\", import.meta.url).href;\n\n/** @public */\nexport function InvertButton(props: ModelsTreeHeaderButtonProps) {\n return (\n <IconButton\n variant={\"ghost\"}\n label={TreeWidget.translate(\"modelsTree.buttons.invert.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-invert\");\n void invertAllModels(\n props.models.map((model) => model.id),\n props.viewport,\n );\n }}\n icon={visibilityInvertSvg}\n />\n );\n}\n\nconst toggle2DSvg = new URL(\"@itwin/itwinui-icons/2d.svg\", import.meta.url).href;\n\n/** @public */\nexport function View2DButton(props: ModelsTreeHeaderButtonProps) {\n const models2d = useMemo(() => {\n return props.models.filter((model) => model.isPlanProjection).map((model) => model.id);\n }, [props.models]);\n\n const [is2dToggleActive, setIs2dToggleActive] = useState(false);\n\n useEffect(() => {\n setIs2dToggleActive(areAllModelsVisible(models2d, props.viewport));\n return props.viewport.onViewedModelsChanged.addListener((vp: Viewport) => setIs2dToggleActive(areAllModelsVisible(models2d, vp)));\n }, [models2d, props.viewport]);\n\n return (\n <IconButton\n variant={\"ghost\"}\n label={TreeWidget.translate(\"modelsTree.buttons.toggle2d.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-view2d\");\n void toggleModels(models2d, is2dToggleActive, props.viewport);\n }}\n aria-disabled={models2d.length === 0}\n isActive={is2dToggleActive}\n icon={toggle2DSvg}\n />\n );\n}\n\nconst toggle3DSvg = new URL(\"@itwin/itwinui-icons/3d.svg\", import.meta.url).href;\n\n/** @public */\nexport function View3DButton(props: ModelsTreeHeaderButtonProps) {\n const models3d = useMemo(() => {\n return props.models.filter((model) => !model.isPlanProjection).map((model) => model.id);\n }, [props.models]);\n\n const [is3dToggleActive, setIs3dToggleActive] = useState(false);\n\n useEffect(() => {\n setIs3dToggleActive(areAllModelsVisible(models3d, props.viewport));\n return props.viewport.onViewedModelsChanged.addListener((vp: Viewport) => setIs3dToggleActive(areAllModelsVisible(models3d, vp)));\n }, [models3d, props.viewport]);\n\n return (\n <IconButton\n variant={\"ghost\"}\n label={TreeWidget.translate(\"modelsTree.buttons.toggle3d.tooltip\")}\n onClick={() => {\n props.onFeatureUsed?.(\"models-tree-view3d\");\n void toggleModels(models3d, is3dToggleActive, props.viewport);\n }}\n aria-disabled={models3d.length === 0}\n isActive={is3dToggleActive}\n icon={toggle3DSvg}\n />\n );\n}\n\nconst focusModeSvg = new URL(\"@itwin/itwinui-icons/cursor-click.svg\", import.meta.url).href;\n\n/** @public */\nexport function ToggleInstancesFocusButton({ onFeatureUsed, disabled }: { onFeatureUsed?: (feature: string) => void; disabled?: boolean }) {\n const { enabled, toggle } = useFocusedInstancesContext();\n const label = disabled\n ? TreeWidget.translate(\"modelsTree.buttons.toggleFocusMode.disabled.tooltip\")\n : enabled\n ? TreeWidget.translate(\"modelsTree.buttons.toggleFocusMode.disable.tooltip\")\n : TreeWidget.translate(\"modelsTree.buttons.toggleFocusMode.enable.tooltip\");\n return (\n <IconButton\n variant={\"ghost\"}\n label={label}\n onClick={() => {\n onFeatureUsed?.(\"models-tree-instancesfocus\");\n toggle();\n }}\n aria-disabled={disabled}\n isActive={enabled}\n icon={focusModeSvg}\n />\n );\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  import type { ModelsTreeProps } from "./ModelsTree.js";
3
3
  import type { ModelsTreeHeaderButtonProps, ModelsTreeHeaderButtonType } from "./ModelsTreeButtons.js";
4
4
  /** @public */
5
- interface ModelsTreeComponentProps extends Pick<ModelsTreeProps, "getSchemaContext" | "selectionStorage" | "hierarchyLevelConfig" | "selectionMode" | "selectionPredicate" | "hierarchyConfig" | "visibilityHandlerOverrides" | "getFilteredPaths" | "filter" | "emptyTreeContent" | "actions"> {
5
+ interface ModelsTreeComponentProps extends Pick<ModelsTreeProps, "getSchemaContext" | "selectionStorage" | "hierarchyLevelConfig" | "selectionMode" | "selectionPredicate" | "hierarchyConfig" | "visibilityHandlerOverrides" | "getFilteredPaths" | "filter" | "emptyTreeContent" | "actions" | "getDecorations"> {
6
6
  /**
7
7
  * Renderers of header buttons. Defaults to:
8
8
  * ```ts