@itwin/tree-widget-react 3.0.0-dev.3 → 3.0.0-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +122 -6
- package/lib/cjs/components/SelectableTree.js +1 -2
- package/lib/cjs/components/SelectableTree.js.map +1 -1
- package/lib/cjs/components/SelectableTree.scss +5 -0
- package/lib/cjs/components/tree-header/TreeHeader.d.ts +12 -9
- package/lib/cjs/components/tree-header/TreeHeader.js +4 -6
- package/lib/cjs/components/tree-header/TreeHeader.js.map +1 -1
- package/lib/cjs/components/tree-header/TreeWithHeader.d.ts +13 -0
- package/lib/cjs/components/tree-header/TreeWithHeader.js +20 -0
- package/lib/cjs/components/tree-header/TreeWithHeader.js.map +1 -0
- package/lib/cjs/components/trees/categories-tree/CategoriesTree.d.ts +3 -7
- package/lib/cjs/components/trees/categories-tree/CategoriesTree.js +7 -63
- package/lib/cjs/components/trees/categories-tree/CategoriesTree.js.map +1 -1
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.d.ts +9 -2
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.js +24 -4
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.d.ts +0 -1
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.js +17 -19
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +2 -2
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeDefinition.js +5 -4
- package/lib/cjs/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
- package/lib/cjs/components/trees/categories-tree/CategoriesVisibilityHandler.d.ts +1 -9
- package/lib/cjs/components/trees/categories-tree/CategoriesVisibilityHandler.js +2 -6
- package/lib/cjs/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +1 -1
- package/lib/cjs/components/trees/categories-tree/UseCategoriesTree.d.ts +25 -0
- package/lib/cjs/components/trees/categories-tree/UseCategoriesTree.js +90 -0
- package/lib/cjs/components/trees/categories-tree/UseCategoriesTree.js.map +1 -0
- package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.d.ts +6 -6
- package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.js +32 -78
- package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/cjs/components/trees/common/FocusedInstancesContext.d.ts +1 -1
- package/lib/cjs/components/trees/common/FocusedInstancesContext.js.map +1 -1
- package/lib/cjs/components/trees/common/FocusedInstancesContextProvider.js +4 -4
- package/lib/cjs/components/trees/common/FocusedInstancesContextProvider.js.map +1 -1
- package/lib/cjs/components/trees/common/TreeErrors.d.ts +9 -0
- package/lib/cjs/components/trees/common/TreeErrors.js +19 -0
- package/lib/cjs/components/trees/common/TreeErrors.js.map +1 -0
- package/lib/cjs/components/trees/common/UseActiveViewport.d.ts +7 -0
- package/lib/cjs/components/trees/common/UseActiveViewport.js +25 -0
- package/lib/cjs/components/trees/common/UseActiveViewport.js.map +1 -0
- package/lib/cjs/components/trees/common/UseTelemetryContext.d.ts +1 -1
- package/lib/cjs/components/trees/common/UseTelemetryContext.js.map +1 -1
- package/lib/cjs/components/trees/common/components/Tree.d.ts +0 -2
- package/lib/cjs/components/trees/common/components/Tree.js +5 -4
- package/lib/cjs/components/trees/common/components/Tree.js.map +1 -1
- package/lib/cjs/components/trees/common/components/VisibilityTree.d.ts +2 -3
- package/lib/cjs/components/trees/common/components/VisibilityTree.js.map +1 -1
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +1 -1
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +1 -2
- package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.d.ts +1 -1
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.js +1 -2
- package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/index.d.ts +5 -0
- package/lib/cjs/components/trees/index.js +11 -1
- package/lib/cjs/components/trees/index.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTree.d.ts +6 -11
- package/lib/cjs/components/trees/models-tree/ModelsTree.js +4 -203
- package/lib/cjs/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.d.ts +9 -3
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js +13 -3
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.d.ts +1 -2
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js +29 -21
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeDefinition.d.ts +10 -6
- package/lib/cjs/components/trees/models-tree/ModelsTreeDefinition.js +63 -43
- package/lib/cjs/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/UseModelsTree.d.ts +38 -0
- package/lib/cjs/components/trees/models-tree/UseModelsTree.js +253 -0
- package/lib/cjs/components/trees/models-tree/UseModelsTree.js.map +1 -0
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +5 -4
- package/lib/cjs/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
- package/lib/cjs/tree-widget-react.d.ts +1 -0
- package/lib/cjs/tree-widget-react.js +3 -1
- package/lib/cjs/tree-widget-react.js.map +1 -1
- package/lib/esm/components/SelectableTree.js +2 -3
- package/lib/esm/components/SelectableTree.js.map +1 -1
- package/lib/esm/components/SelectableTree.scss +5 -0
- package/lib/esm/components/tree-header/TreeHeader.d.ts +12 -9
- package/lib/esm/components/tree-header/TreeHeader.js +4 -6
- package/lib/esm/components/tree-header/TreeHeader.js.map +1 -1
- package/lib/esm/components/tree-header/TreeWithHeader.d.ts +13 -0
- package/lib/esm/components/tree-header/TreeWithHeader.js +13 -0
- package/lib/esm/components/tree-header/TreeWithHeader.js.map +1 -0
- package/lib/esm/components/trees/categories-tree/CategoriesTree.d.ts +3 -7
- package/lib/esm/components/trees/categories-tree/CategoriesTree.js +7 -63
- package/lib/esm/components/trees/categories-tree/CategoriesTree.js.map +1 -1
- package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.d.ts +9 -2
- package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.js +22 -4
- package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
- package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.d.ts +0 -1
- package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.js +18 -17
- package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +2 -2
- package/lib/esm/components/trees/categories-tree/CategoriesTreeDefinition.js +5 -4
- package/lib/esm/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
- package/lib/esm/components/trees/categories-tree/CategoriesVisibilityHandler.d.ts +1 -9
- package/lib/esm/components/trees/categories-tree/CategoriesVisibilityHandler.js +2 -6
- package/lib/esm/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +1 -1
- package/lib/esm/components/trees/categories-tree/UseCategoriesTree.d.ts +25 -0
- package/lib/esm/components/trees/categories-tree/UseCategoriesTree.js +86 -0
- package/lib/esm/components/trees/categories-tree/UseCategoriesTree.js.map +1 -0
- package/lib/esm/components/trees/common/CategoriesVisibilityUtils.d.ts +6 -6
- package/lib/esm/components/trees/common/CategoriesVisibilityUtils.js +33 -79
- package/lib/esm/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/esm/components/trees/common/FocusedInstancesContext.d.ts +1 -1
- package/lib/esm/components/trees/common/FocusedInstancesContext.js.map +1 -1
- package/lib/esm/components/trees/common/FocusedInstancesContextProvider.js +4 -4
- package/lib/esm/components/trees/common/FocusedInstancesContextProvider.js.map +1 -1
- package/lib/esm/components/trees/common/TreeErrors.d.ts +9 -0
- package/lib/esm/components/trees/common/TreeErrors.js +15 -0
- package/lib/esm/components/trees/common/TreeErrors.js.map +1 -0
- package/lib/esm/components/trees/common/UseActiveViewport.d.ts +7 -0
- package/lib/esm/components/trees/common/UseActiveViewport.js +21 -0
- package/lib/esm/components/trees/common/UseActiveViewport.js.map +1 -0
- package/lib/esm/components/trees/common/UseTelemetryContext.d.ts +1 -1
- package/lib/esm/components/trees/common/UseTelemetryContext.js.map +1 -1
- package/lib/esm/components/trees/common/components/Tree.d.ts +0 -2
- package/lib/esm/components/trees/common/components/Tree.js +5 -4
- package/lib/esm/components/trees/common/components/Tree.js.map +1 -1
- package/lib/esm/components/trees/common/components/VisibilityTree.d.ts +2 -3
- package/lib/esm/components/trees/common/components/VisibilityTree.js.map +1 -1
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +1 -1
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +1 -2
- package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.d.ts +1 -1
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.js +1 -2
- package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/index.d.ts +5 -0
- package/lib/esm/components/trees/index.js +5 -0
- package/lib/esm/components/trees/index.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTree.d.ts +6 -11
- package/lib/esm/components/trees/models-tree/ModelsTree.js +5 -204
- package/lib/esm/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.d.ts +9 -3
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js +12 -2
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.d.ts +1 -2
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js +31 -20
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeDefinition.d.ts +10 -6
- package/lib/esm/components/trees/models-tree/ModelsTreeDefinition.js +63 -43
- package/lib/esm/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
- package/lib/esm/components/trees/models-tree/UseModelsTree.d.ts +38 -0
- package/lib/esm/components/trees/models-tree/UseModelsTree.js +249 -0
- package/lib/esm/components/trees/models-tree/UseModelsTree.js.map +1 -0
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +6 -5
- package/lib/esm/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
- package/lib/esm/tree-widget-react.d.ts +1 -0
- package/lib/esm/tree-widget-react.js +1 -0
- package/lib/esm/tree-widget-react.js.map +1 -1
- package/package.json +37 -41
- package/lib/cjs/components/trees/categories-tree/UseCategories.d.ts +0 -8
- package/lib/cjs/components/trees/categories-tree/UseCategories.js +0 -22
- package/lib/cjs/components/trees/categories-tree/UseCategories.js.map +0 -1
- package/lib/cjs/components/utils/AutoSizer.d.ts +0 -13
- package/lib/cjs/components/utils/AutoSizer.js +0 -21
- package/lib/cjs/components/utils/AutoSizer.js.map +0 -1
- package/lib/esm/components/trees/categories-tree/UseCategories.d.ts +0 -8
- package/lib/esm/components/trees/categories-tree/UseCategories.js +0 -18
- package/lib/esm/components/trees/categories-tree/UseCategories.js.map +0 -1
- package/lib/esm/components/utils/AutoSizer.d.ts +0 -13
- package/lib/esm/components/utils/AutoSizer.js +0 -17
- package/lib/esm/components/utils/AutoSizer.js.map +0 -1
- /package/lib/cjs/components/{trees/Tree.scss → tree-header/TreeWithHeader.scss} +0 -0
- /package/lib/esm/components/{trees/Tree.scss → tree-header/TreeWithHeader.scss} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalSourcesTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/external-sources-tree/ExternalSourcesTree.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,oEAA8E;AAC9E,oDAAiD;AACjD,oEAAiE;AACjE,iFAA8E;AAC9E,mFAAgF;
|
|
1
|
+
{"version":3,"file":"ExternalSourcesTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/external-sources-tree/ExternalSourcesTree.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,oEAA8E;AAC9E,oDAAiD;AACjD,oEAAiE;AACjE,iFAA8E;AAC9E,mFAAgF;AAkBhF,YAAY;AACZ,SAAgB,mBAAmB,CAAC,KAA+B;IACjE,OAAO,CACL,uBAAC,WAAI,OACC,KAAK,EACT,QAAQ,EAAE,2DAA4B,CAAC,EAAE,EACzC,sBAAsB,EAAE,sBAAsB,EAC9C,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,MAAM,EAC5C,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,uBAAC,2BAAY,OAAK,SAAS,EAAE,OAAO,EAAE,OAAO,GAAI,GAC9E,CACH,CAAC;AACJ,CAAC;AAVD,kDAUC;AAED,MAAM,sBAAsB,GAAwC,CAAC,KAAK,EAAE,EAAE;IAC5E,OAAO,IAAI,6DAA6B,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,uBAAC,6BAAO,KAAG,CAAC;QACrB,KAAK,eAAe;YAClB,OAAO,uBAAC,6BAAO,KAAG,CAAC;QACrB,KAAK,eAAe;YAClB,OAAO,uBAAC,iCAAW,KAAG,CAAC;QACzB,KAAK,gBAAgB;YACnB,OAAO,uBAAC,gCAAU,KAAG,CAAC;KACzB;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 { SvgDetails, SvgDocument, SvgItem } from \"@itwin/itwinui-icons-react\";\nimport { Tree } from \"../common/components/Tree\";\nimport { TreeRenderer } from \"../common/components/TreeRenderer\";\nimport { ExternalSourcesTreeComponent } from \"./ExternalSourcesTreeComponent\";\nimport { ExternalSourcesTreeDefinition } from \"./ExternalSourcesTreeDefinition\";\n\nimport type { ReactElement } from \"react\";\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\n\n/** @beta */\ninterface ExternalSourcesTreeOwnProps {\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n}\n\n/** @beta */\ntype TreeProps = Parameters<typeof Tree>[0];\n\n/** @beta */\ntype ExternalSourcesTreeProps = ExternalSourcesTreeOwnProps & Pick<TreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"density\" | \"selectionMode\">;\n\n/** @beta */\nexport function ExternalSourcesTree(props: ExternalSourcesTreeProps) {\n return (\n <Tree\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): ReactElement | undefined {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n\n switch (node.extendedData.imageId) {\n case \"icon-item\":\n return <SvgItem />;\n case \"icon-ec-class\":\n return <SvgItem />;\n case \"icon-document\":\n return <SvgDocument />;\n case \"icon-ec-schema\":\n return <SvgDetails />;\n }\n\n return undefined;\n}\n"]}
|
|
@@ -8,7 +8,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
8
8
|
*--------------------------------------------------------------------------------------------*/
|
|
9
9
|
const appui_react_1 = require("@itwin/appui-react");
|
|
10
10
|
const TreeWidget_1 = require("../../../TreeWidget");
|
|
11
|
-
const AutoSizer_1 = require("../../utils/AutoSizer");
|
|
12
11
|
const UseTelemetryContext_1 = require("../common/UseTelemetryContext");
|
|
13
12
|
const ExternalSourcesTree_1 = require("./ExternalSourcesTree");
|
|
14
13
|
/**
|
|
@@ -20,7 +19,7 @@ const ExternalSourcesTreeComponent = ({ onFeatureUsed, onPerformanceMeasured, ..
|
|
|
20
19
|
if (!imodel) {
|
|
21
20
|
return null;
|
|
22
21
|
}
|
|
23
|
-
return ((0, jsx_runtime_1.jsx)(UseTelemetryContext_1.TelemetryContextProvider, { componentIdentifier: exports.ExternalSourcesTreeComponent.id, onFeatureUsed: onFeatureUsed, onPerformanceMeasured: onPerformanceMeasured, children: (0, jsx_runtime_1.jsx)(
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(UseTelemetryContext_1.TelemetryContextProvider, { componentIdentifier: exports.ExternalSourcesTreeComponent.id, onFeatureUsed: onFeatureUsed, onPerformanceMeasured: onPerformanceMeasured, children: (0, jsx_runtime_1.jsx)(ExternalSourcesTree_1.ExternalSourcesTree, { ...props, imodel: imodel }) }));
|
|
24
23
|
};
|
|
25
24
|
exports.ExternalSourcesTreeComponent = ExternalSourcesTreeComponent;
|
|
26
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalSourcesTreeComponent.js","sourceRoot":"","sources":["../../../../../src/components/trees/external-sources-tree/ExternalSourcesTreeComponent.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,oDAA+D;AAC/D,oDAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"ExternalSourcesTreeComponent.js","sourceRoot":"","sources":["../../../../../src/components/trees/external-sources-tree/ExternalSourcesTreeComponent.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,oDAA+D;AAC/D,oDAAiD;AACjD,uEAAyE;AACzE,+DAA4D;AAc5D;;;GAGG;AACI,MAAM,4BAA4B,GAAG,CAAC,EAAE,aAAa,EAAE,qBAAqB,EAAE,GAAG,KAAK,EAAqC,EAAE,EAAE;IACpI,MAAM,MAAM,GAAG,IAAA,uCAAyB,GAAE,CAAC;IAE3C,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,uBAAC,8CAAwB,IAAC,mBAAmB,EAAE,oCAA4B,CAAC,EAAE,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,qBAAqB,YACxJ,uBAAC,yCAAmB,OAAK,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,GACzB,CAC5B,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,4BAA4B,gCAYvC;AAEF;;;GAGG;AACH,oCAA4B,CAAC,EAAE,GAAG,0BAA0B,CAAC;AAE7D;;;GAGG;AACH,oCAA4B,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC,uBAAU,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\";\nimport { TelemetryContextProvider } from \"../common/UseTelemetryContext\";\nimport { ExternalSourcesTree } from \"./ExternalSourcesTree\";\n\nimport type { ComponentPropsWithoutRef } from \"react\";\n\n/** @beta */\ninterface ExternalSourcesTreeComponentProps\n extends Pick<\n ComponentPropsWithoutRef<typeof ExternalSourcesTree>,\n \"getSchemaContext\" | \"selectionStorage\" | \"selectionMode\" | \"density\" | \"hierarchyLevelConfig\" | \"selectionMode\"\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 <ExternalSourcesTree {...props} imodel={imodel} />\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"]}
|
|
@@ -9,7 +9,7 @@ interface IModelContentTreeOwnProps {
|
|
|
9
9
|
/** @beta */
|
|
10
10
|
type TreeProps = Parameters<typeof Tree>[0];
|
|
11
11
|
/** @beta */
|
|
12
|
-
type IModelContentTreeProps = IModelContentTreeOwnProps & Pick<TreeProps, "imodel" | "getSchemaContext" | "selectionStorage" | "
|
|
12
|
+
type IModelContentTreeProps = IModelContentTreeOwnProps & Pick<TreeProps, "imodel" | "getSchemaContext" | "selectionStorage" | "density" | "selectionMode">;
|
|
13
13
|
/** @beta */
|
|
14
14
|
export declare function IModelContentTree(props: IModelContentTreeProps): JSX.Element;
|
|
15
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelContentTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/imodel-content-tree/IModelContentTree.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,oEAAkI;AAClI,oDAAiD;AACjD,oEAAiE;AACjE,6EAA0E;AAC1E,+EAA4E;AAC5E,oFAAiF;
|
|
1
|
+
{"version":3,"file":"IModelContentTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/imodel-content-tree/IModelContentTree.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,oEAAkI;AAClI,oDAAiD;AACjD,oEAAiE;AACjE,6EAA0E;AAC1E,+EAA4E;AAC5E,oFAAiF;AAkBjF,YAAY;AACZ,SAAgB,iBAAiB,CAAC,KAA6B;IAC7D,OAAO,CACL,uBAAC,WAAI,OACC,KAAK,EACT,QAAQ,EAAE,uDAA0B,CAAC,EAAE,EACvC,sBAAsB,EAAE,sBAAsB,EAC9C,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,UAAU,EAChD,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,uBAAC,2BAAY,OAAK,SAAS,EAAE,OAAO,EAAE,OAAO,GAAI,GAC9E,CACH,CAAC;AACJ,CAAC;AAVD,8CAUC;AAED,MAAM,sBAAsB,GAAwC,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;IACvF,OAAO,IAAI,yDAA2B,CAAC;QACrC,YAAY;QACZ,QAAQ,EAAE,IAAI,qDAAyB,CAAC,YAAY,CAAC;KACtD,CAAC,CAAC;AACL,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,aAAa;YAChB,OAAO,uBAAC,+BAAS,KAAG,CAAC;QACvB,KAAK,WAAW;YACd,OAAO,uBAAC,6BAAO,KAAG,CAAC;QACrB,KAAK,eAAe;YAClB,OAAO,uBAAC,6BAAO,KAAG,CAAC;QACrB,KAAK,sBAAsB;YACzB,OAAO,uBAAC,qCAAe,KAAG,CAAC;QAC7B,KAAK,aAAa;YAChB,OAAO,uBAAC,+BAAS,KAAG,CAAC;QACvB,KAAK,YAAY;YACf,OAAO,uBAAC,8BAAQ,KAAG,CAAC;QACtB,KAAK,qBAAqB;YACxB,OAAO,uBAAC,sCAAgB,KAAG,CAAC;QAC9B,KAAK,YAAY;YACf,OAAO,uBAAC,8BAAQ,KAAG,CAAC;KACvB;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 { SvgFolder, SvgGroup, SvgHierarchyTree, SvgImodelHollow, SvgItem, SvgLayers, SvgModel } from \"@itwin/itwinui-icons-react\";\nimport { Tree } from \"../common/components/Tree\";\nimport { TreeRenderer } from \"../common/components/TreeRenderer\";\nimport { IModelContentTreeComponent } from \"./IModelContentTreeComponent\";\nimport { IModelContentTreeDefinition } from \"./IModelContentTreeDefinition\";\nimport { IModelContentTreeIdsCache } from \"./internal/IModelContentTreeIdsCache\";\n\nimport type { ReactElement } from \"react\";\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\n\n/** @beta */\ninterface IModelContentTreeOwnProps {\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n}\n\n/** @beta */\ntype TreeProps = Parameters<typeof Tree>[0];\n\n/** @beta */\ntype IModelContentTreeProps = IModelContentTreeOwnProps & Pick<TreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"density\" | \"selectionMode\">;\n\n/** @beta */\nexport function IModelContentTree(props: IModelContentTreeProps) {\n return (\n <Tree\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): ReactElement | undefined {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n\n switch (node.extendedData.imageId) {\n case \"icon-layers\":\n return <SvgLayers />;\n case \"icon-item\":\n return <SvgItem />;\n case \"icon-ec-class\":\n return <SvgItem />;\n case \"icon-imodel-hollow-2\":\n return <SvgImodelHollow />;\n case \"icon-folder\":\n return <SvgFolder />;\n case \"icon-model\":\n return <SvgModel />;\n case \"icon-hierarchy-tree\":\n return <SvgHierarchyTree />;\n case \"icon-group\":\n return <SvgGroup />;\n }\n\n return undefined;\n}\n"]}
|
|
@@ -8,7 +8,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
8
8
|
*--------------------------------------------------------------------------------------------*/
|
|
9
9
|
const appui_react_1 = require("@itwin/appui-react");
|
|
10
10
|
const TreeWidget_1 = require("../../../TreeWidget");
|
|
11
|
-
const AutoSizer_1 = require("../../utils/AutoSizer");
|
|
12
11
|
const UseTelemetryContext_1 = require("../common/UseTelemetryContext");
|
|
13
12
|
const IModelContentTree_1 = require("./IModelContentTree");
|
|
14
13
|
/**
|
|
@@ -20,7 +19,7 @@ const IModelContentTreeComponent = ({ onFeatureUsed, onPerformanceMeasured, ...p
|
|
|
20
19
|
if (!imodel) {
|
|
21
20
|
return null;
|
|
22
21
|
}
|
|
23
|
-
return ((0, jsx_runtime_1.jsx)(UseTelemetryContext_1.TelemetryContextProvider, { componentIdentifier: exports.IModelContentTreeComponent.id, onFeatureUsed: onFeatureUsed, onPerformanceMeasured: onPerformanceMeasured, children: (0, jsx_runtime_1.jsx)(
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(UseTelemetryContext_1.TelemetryContextProvider, { componentIdentifier: exports.IModelContentTreeComponent.id, onFeatureUsed: onFeatureUsed, onPerformanceMeasured: onPerformanceMeasured, children: (0, jsx_runtime_1.jsx)(IModelContentTree_1.IModelContentTree, { ...props, imodel: imodel }) }));
|
|
24
23
|
};
|
|
25
24
|
exports.IModelContentTreeComponent = IModelContentTreeComponent;
|
|
26
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelContentTreeComponent.js","sourceRoot":"","sources":["../../../../../src/components/trees/imodel-content-tree/IModelContentTreeComponent.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,oDAA+D;AAC/D,oDAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"IModelContentTreeComponent.js","sourceRoot":"","sources":["../../../../../src/components/trees/imodel-content-tree/IModelContentTreeComponent.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,oDAA+D;AAC/D,oDAAiD;AACjD,uEAAyE;AACzE,2DAAwD;AAcxD;;;GAGG;AACI,MAAM,0BAA0B,GAAG,CAAC,EAAE,aAAa,EAAE,qBAAqB,EAAE,GAAG,KAAK,EAAmC,EAAE,EAAE;IAChI,MAAM,MAAM,GAAG,IAAA,uCAAyB,GAAE,CAAC;IAE3C,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,uBAAC,8CAAwB,IAAC,mBAAmB,EAAE,kCAA0B,CAAC,EAAE,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,qBAAqB,YACtJ,uBAAC,qCAAiB,OAAK,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,GACvB,CAC5B,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,0BAA0B,8BAYrC;AAEF;;;GAGG;AACH,kCAA0B,CAAC,EAAE,GAAG,wBAAwB,CAAC;AAEzD;;;GAGG;AACH,kCAA0B,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC,uBAAU,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\";\nimport { TelemetryContextProvider } from \"../common/UseTelemetryContext\";\nimport { IModelContentTree } from \"./IModelContentTree\";\n\nimport type { ComponentPropsWithoutRef } from \"react\";\n\n/** @beta */\ninterface IModelContentTreeComponentProps\n extends Pick<\n ComponentPropsWithoutRef<typeof IModelContentTree>,\n \"getSchemaContext\" | \"selectionStorage\" | \"density\" | \"hierarchyLevelConfig\" | \"selectionMode\"\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 <IModelContentTree {...props} imodel={imodel} />\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"]}
|
|
@@ -2,11 +2,16 @@ export { ModelsTreeComponent } from "./models-tree/ModelsTreeComponent";
|
|
|
2
2
|
export { CategoriesTreeComponent } from "./categories-tree/CategoriesTreeComponent";
|
|
3
3
|
export { IModelContentTreeComponent } from "./imodel-content-tree/IModelContentTreeComponent";
|
|
4
4
|
export { ExternalSourcesTreeComponent } from "./external-sources-tree/ExternalSourcesTreeComponent";
|
|
5
|
+
export { useModelsTree } from "./models-tree/UseModelsTree";
|
|
6
|
+
export { useCategoriesTree } from "./categories-tree/UseCategoriesTree";
|
|
7
|
+
export { useModelsTreeButtonProps } from "./models-tree/ModelsTreeButtons";
|
|
8
|
+
export { useCategoriesTreeButtonProps } from "./categories-tree/CategoriesTreeButtons";
|
|
5
9
|
export { Tree } from "./common/components/Tree";
|
|
6
10
|
export { VisibilityTree } from "./common/components/VisibilityTree";
|
|
7
11
|
export { TreeRenderer } from "./common/components/TreeRenderer";
|
|
8
12
|
export { VisibilityTreeRenderer } from "./common/components/VisibilityTreeRenderer";
|
|
9
13
|
export { HierarchyVisibilityHandler, VisibilityStatus } from "./common/UseHierarchyVisibility";
|
|
10
14
|
export { TelemetryContextProvider } from "./common/UseTelemetryContext";
|
|
15
|
+
export { FilterLimitExceededError } from "./common/TreeErrors";
|
|
11
16
|
export { ModelsTreeVisibilityHandlerOverrides } from "./models-tree/internal/ModelsTreeVisibilityHandler";
|
|
12
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.TelemetryContextProvider = exports.VisibilityTreeRenderer = exports.TreeRenderer = exports.VisibilityTree = exports.Tree = exports.ExternalSourcesTreeComponent = exports.IModelContentTreeComponent = exports.CategoriesTreeComponent = exports.ModelsTreeComponent = void 0;
|
|
7
|
+
exports.FilterLimitExceededError = exports.TelemetryContextProvider = exports.VisibilityTreeRenderer = exports.TreeRenderer = exports.VisibilityTree = exports.Tree = exports.useCategoriesTreeButtonProps = exports.useModelsTreeButtonProps = exports.useCategoriesTree = exports.useModelsTree = exports.ExternalSourcesTreeComponent = exports.IModelContentTreeComponent = exports.CategoriesTreeComponent = exports.ModelsTreeComponent = void 0;
|
|
8
8
|
var ModelsTreeComponent_1 = require("./models-tree/ModelsTreeComponent");
|
|
9
9
|
Object.defineProperty(exports, "ModelsTreeComponent", { enumerable: true, get: function () { return ModelsTreeComponent_1.ModelsTreeComponent; } });
|
|
10
10
|
var CategoriesTreeComponent_1 = require("./categories-tree/CategoriesTreeComponent");
|
|
@@ -13,6 +13,14 @@ var IModelContentTreeComponent_1 = require("./imodel-content-tree/IModelContentT
|
|
|
13
13
|
Object.defineProperty(exports, "IModelContentTreeComponent", { enumerable: true, get: function () { return IModelContentTreeComponent_1.IModelContentTreeComponent; } });
|
|
14
14
|
var ExternalSourcesTreeComponent_1 = require("./external-sources-tree/ExternalSourcesTreeComponent");
|
|
15
15
|
Object.defineProperty(exports, "ExternalSourcesTreeComponent", { enumerable: true, get: function () { return ExternalSourcesTreeComponent_1.ExternalSourcesTreeComponent; } });
|
|
16
|
+
var UseModelsTree_1 = require("./models-tree/UseModelsTree");
|
|
17
|
+
Object.defineProperty(exports, "useModelsTree", { enumerable: true, get: function () { return UseModelsTree_1.useModelsTree; } });
|
|
18
|
+
var UseCategoriesTree_1 = require("./categories-tree/UseCategoriesTree");
|
|
19
|
+
Object.defineProperty(exports, "useCategoriesTree", { enumerable: true, get: function () { return UseCategoriesTree_1.useCategoriesTree; } });
|
|
20
|
+
var ModelsTreeButtons_1 = require("./models-tree/ModelsTreeButtons");
|
|
21
|
+
Object.defineProperty(exports, "useModelsTreeButtonProps", { enumerable: true, get: function () { return ModelsTreeButtons_1.useModelsTreeButtonProps; } });
|
|
22
|
+
var CategoriesTreeButtons_1 = require("./categories-tree/CategoriesTreeButtons");
|
|
23
|
+
Object.defineProperty(exports, "useCategoriesTreeButtonProps", { enumerable: true, get: function () { return CategoriesTreeButtons_1.useCategoriesTreeButtonProps; } });
|
|
16
24
|
var Tree_1 = require("./common/components/Tree");
|
|
17
25
|
Object.defineProperty(exports, "Tree", { enumerable: true, get: function () { return Tree_1.Tree; } });
|
|
18
26
|
var VisibilityTree_1 = require("./common/components/VisibilityTree");
|
|
@@ -23,4 +31,6 @@ var VisibilityTreeRenderer_1 = require("./common/components/VisibilityTreeRender
|
|
|
23
31
|
Object.defineProperty(exports, "VisibilityTreeRenderer", { enumerable: true, get: function () { return VisibilityTreeRenderer_1.VisibilityTreeRenderer; } });
|
|
24
32
|
var UseTelemetryContext_1 = require("./common/UseTelemetryContext");
|
|
25
33
|
Object.defineProperty(exports, "TelemetryContextProvider", { enumerable: true, get: function () { return UseTelemetryContext_1.TelemetryContextProvider; } });
|
|
34
|
+
var TreeErrors_1 = require("./common/TreeErrors");
|
|
35
|
+
Object.defineProperty(exports, "FilterLimitExceededError", { enumerable: true, get: function () { return TreeErrors_1.FilterLimitExceededError; } });
|
|
26
36
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/trees/index.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,yEAAwE;AAA/D,0HAAA,mBAAmB,OAAA;AAC5B,qFAAoF;AAA3E,kIAAA,uBAAuB,OAAA;AAChC,+FAA8F;AAArF,wIAAA,0BAA0B,OAAA;AACnC,qGAAoG;AAA3F,4IAAA,4BAA4B,OAAA;AAErC,iDAAgD;AAAvC,4FAAA,IAAI,OAAA;AACb,qEAAoE;AAA3D,gHAAA,cAAc,OAAA;AACvB,iEAAgE;AAAvD,4GAAA,YAAY,OAAA;AACrB,qFAAoF;AAA3E,gIAAA,sBAAsB,OAAA;AAE/B,oEAAwE;AAA/D,+HAAA,wBAAwB,OAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nexport { ModelsTreeComponent } from \"./models-tree/ModelsTreeComponent\";\nexport { CategoriesTreeComponent } from \"./categories-tree/CategoriesTreeComponent\";\nexport { IModelContentTreeComponent } from \"./imodel-content-tree/IModelContentTreeComponent\";\nexport { ExternalSourcesTreeComponent } from \"./external-sources-tree/ExternalSourcesTreeComponent\";\n\nexport { Tree } from \"./common/components/Tree\";\nexport { VisibilityTree } from \"./common/components/VisibilityTree\";\nexport { TreeRenderer } from \"./common/components/TreeRenderer\";\nexport { VisibilityTreeRenderer } from \"./common/components/VisibilityTreeRenderer\";\nexport { HierarchyVisibilityHandler, VisibilityStatus } from \"./common/UseHierarchyVisibility\";\nexport { TelemetryContextProvider } from \"./common/UseTelemetryContext\";\n\nexport { ModelsTreeVisibilityHandlerOverrides } from \"./models-tree/internal/ModelsTreeVisibilityHandler\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/trees/index.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,yEAAwE;AAA/D,0HAAA,mBAAmB,OAAA;AAC5B,qFAAoF;AAA3E,kIAAA,uBAAuB,OAAA;AAChC,+FAA8F;AAArF,wIAAA,0BAA0B,OAAA;AACnC,qGAAoG;AAA3F,4IAAA,4BAA4B,OAAA;AAErC,6DAA4D;AAAnD,8GAAA,aAAa,OAAA;AACtB,yEAAwE;AAA/D,sHAAA,iBAAiB,OAAA;AAE1B,qEAA2E;AAAlE,6HAAA,wBAAwB,OAAA;AACjC,iFAAuF;AAA9E,qIAAA,4BAA4B,OAAA;AAErC,iDAAgD;AAAvC,4FAAA,IAAI,OAAA;AACb,qEAAoE;AAA3D,gHAAA,cAAc,OAAA;AACvB,iEAAgE;AAAvD,4GAAA,YAAY,OAAA;AACrB,qFAAoF;AAA3E,gIAAA,sBAAsB,OAAA;AAE/B,oEAAwE;AAA/D,+HAAA,wBAAwB,OAAA;AACjC,kDAA+D;AAAtD,sHAAA,wBAAwB,OAAA","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nexport { ModelsTreeComponent } from \"./models-tree/ModelsTreeComponent\";\nexport { CategoriesTreeComponent } from \"./categories-tree/CategoriesTreeComponent\";\nexport { IModelContentTreeComponent } from \"./imodel-content-tree/IModelContentTreeComponent\";\nexport { ExternalSourcesTreeComponent } from \"./external-sources-tree/ExternalSourcesTreeComponent\";\n\nexport { useModelsTree } from \"./models-tree/UseModelsTree\";\nexport { useCategoriesTree } from \"./categories-tree/UseCategoriesTree\";\n\nexport { useModelsTreeButtonProps } from \"./models-tree/ModelsTreeButtons\";\nexport { useCategoriesTreeButtonProps } from \"./categories-tree/CategoriesTreeButtons\";\n\nexport { Tree } from \"./common/components/Tree\";\nexport { VisibilityTree } from \"./common/components/VisibilityTree\";\nexport { TreeRenderer } from \"./common/components/TreeRenderer\";\nexport { VisibilityTreeRenderer } from \"./common/components/VisibilityTreeRenderer\";\nexport { HierarchyVisibilityHandler, VisibilityStatus } from \"./common/UseHierarchyVisibility\";\nexport { TelemetryContextProvider } from \"./common/UseTelemetryContext\";\nexport { FilterLimitExceededError } from \"./common/TreeErrors\";\n\nexport { ModelsTreeVisibilityHandlerOverrides } from \"./models-tree/internal/ModelsTreeVisibilityHandler\";\n"]}
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
import { VisibilityTree } from "../common/components/VisibilityTree";
|
|
2
|
-
import
|
|
3
|
-
import type { ModelsTreeHierarchyConfiguration } from "./ModelsTreeDefinition";
|
|
2
|
+
import { useModelsTree } from "./UseModelsTree";
|
|
4
3
|
import type { ComponentPropsWithoutRef } from "react";
|
|
5
|
-
|
|
4
|
+
/** @beta */
|
|
5
|
+
type VisibilityTreeProps = ComponentPropsWithoutRef<typeof VisibilityTree>;
|
|
6
6
|
/** @beta */
|
|
7
7
|
interface ModelsTreeOwnProps {
|
|
8
|
-
activeView: Viewport;
|
|
9
8
|
hierarchyLevelConfig?: {
|
|
10
9
|
sizeLimit?: number;
|
|
11
10
|
};
|
|
12
|
-
hierarchyConfig?: Partial<ModelsTreeHierarchyConfiguration>;
|
|
13
|
-
visibilityHandlerOverrides?: ModelsTreeVisibilityHandlerOverrides;
|
|
14
|
-
filter?: string;
|
|
15
11
|
}
|
|
12
|
+
type UseModelsTreeProps = Parameters<typeof useModelsTree>[0];
|
|
16
13
|
/** @beta */
|
|
17
|
-
type
|
|
18
|
-
/** @beta */
|
|
19
|
-
type ModelsTreeProps = ModelsTreeOwnProps & Pick<VisibilityTreeProps, "imodel" | "getSchemaContext" | "selectionStorage" | "height" | "width" | "density" | "selectionMode">;
|
|
14
|
+
type ModelsTreeProps = ModelsTreeOwnProps & UseModelsTreeProps & Pick<VisibilityTreeProps, "imodel" | "getSchemaContext" | "selectionStorage" | "density" | "selectionMode">;
|
|
20
15
|
/** @beta */
|
|
21
|
-
export declare function ModelsTree({ imodel, getSchemaContext, selectionStorage,
|
|
16
|
+
export declare function ModelsTree({ imodel, getSchemaContext, selectionStorage, activeView, filter, density, hierarchyLevelConfig, hierarchyConfig, selectionMode, visibilityHandlerOverrides, getFilteredPaths, }: ModelsTreeProps): JSX.Element;
|
|
22
17
|
export {};
|
|
23
18
|
//# sourceMappingURL=ModelsTree.d.ts.map
|
|
@@ -6,212 +6,13 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
6
6
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
7
7
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
8
|
*--------------------------------------------------------------------------------------------*/
|
|
9
|
-
const react_1 = require("react");
|
|
10
|
-
const core_frontend_1 = require("@itwin/core-frontend");
|
|
11
|
-
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
12
|
-
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
13
|
-
const presentation_core_interop_1 = require("@itwin/presentation-core-interop");
|
|
14
|
-
const presentation_hierarchies_1 = require("@itwin/presentation-hierarchies");
|
|
15
|
-
const TreeWidget_1 = require("../../../TreeWidget");
|
|
16
9
|
const VisibilityTree_1 = require("../common/components/VisibilityTree");
|
|
17
10
|
const VisibilityTreeRenderer_1 = require("../common/components/VisibilityTreeRenderer");
|
|
18
|
-
const
|
|
19
|
-
const UseIModelChangeListener_1 = require("../common/UseIModelChangeListener");
|
|
20
|
-
const UseTelemetryContext_1 = require("../common/UseTelemetryContext");
|
|
21
|
-
const ModelsTreeIdsCache_1 = require("./internal/ModelsTreeIdsCache");
|
|
22
|
-
const ModelsTreeVisibilityHandler_1 = require("./internal/ModelsTreeVisibilityHandler");
|
|
23
|
-
const ModelsTreeComponent_1 = require("./ModelsTreeComponent");
|
|
24
|
-
const ModelsTreeDefinition_1 = require("./ModelsTreeDefinition");
|
|
11
|
+
const UseModelsTree_1 = require("./UseModelsTree");
|
|
25
12
|
/** @beta */
|
|
26
|
-
function ModelsTree({ imodel, getSchemaContext, selectionStorage,
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
...ModelsTreeDefinition_1.defaultHierarchyConfiguration,
|
|
30
|
-
...hierarchyConfig,
|
|
31
|
-
}),
|
|
32
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
|
-
Object.values(hierarchyConfig ?? {}));
|
|
34
|
-
const { onFeatureUsed } = (0, UseTelemetryContext_1.useTelemetryContext)();
|
|
35
|
-
const { getModelsTreeIdsCache, visibilityHandlerFactory } = useCachedVisibility(activeView, hierarchyConfiguration, visibilityHandlerOverrides);
|
|
36
|
-
const { loadInstanceKeys: loadFocusedInstancesKeys } = (0, FocusedInstancesContext_1.useFocusedInstancesContext)();
|
|
37
|
-
const getHierarchyDefinition = (0, react_1.useCallback)(({ imodelAccess }) => new ModelsTreeDefinition_1.ModelsTreeDefinition({ imodelAccess, idsCache: getModelsTreeIdsCache(), hierarchyConfig: hierarchyConfiguration }), [getModelsTreeIdsCache, hierarchyConfiguration]);
|
|
38
|
-
const onNodeDoubleClick = (0, react_1.useCallback)(async ({ nodeData, extendedData }) => {
|
|
39
|
-
if (!presentation_hierarchies_1.HierarchyNode.isInstancesNode(nodeData) || (extendedData && (extendedData.isSubject || extendedData.isModel || extendedData.isCategory))) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const instanceIds = nodeData.key.instanceKeys.map((instanceKey) => instanceKey.id);
|
|
43
|
-
await core_frontend_1.IModelApp.viewManager.selectedView?.zoomToElements(instanceIds);
|
|
44
|
-
onFeatureUsed({ featureId: "zoom-to-node", reportInteraction: false });
|
|
45
|
-
}, [onFeatureUsed]);
|
|
46
|
-
const getFocusedFilteredPaths = (0, react_1.useMemo)(() => {
|
|
47
|
-
setFilteringError(undefined);
|
|
48
|
-
if (!loadFocusedInstancesKeys) {
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
return async ({ imodelAccess }) => {
|
|
52
|
-
try {
|
|
53
|
-
const targetKeys = await collectTargetKeys(loadFocusedInstancesKeys);
|
|
54
|
-
return await ModelsTreeDefinition_1.ModelsTreeDefinition.createInstanceKeyPaths({
|
|
55
|
-
imodelAccess,
|
|
56
|
-
idsCache: getModelsTreeIdsCache(),
|
|
57
|
-
keys: targetKeys,
|
|
58
|
-
hierarchyConfig: hierarchyConfiguration,
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
catch (e) {
|
|
62
|
-
const newError = e instanceof Error && e.message.match(/Filter matches more than \d+ items/) ? "tooManyInstancesFocused" : "unknownInstanceFocusError";
|
|
63
|
-
setFilteringError(newError);
|
|
64
|
-
return [];
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
}, [loadFocusedInstancesKeys, getModelsTreeIdsCache, hierarchyConfiguration]);
|
|
68
|
-
const getSearchFilteredPaths = (0, react_1.useMemo)(() => {
|
|
69
|
-
setFilteringError(undefined);
|
|
70
|
-
if (!filter) {
|
|
71
|
-
return undefined;
|
|
72
|
-
}
|
|
73
|
-
return async ({ imodelAccess }) => {
|
|
74
|
-
onFeatureUsed({ featureId: "filtering", reportInteraction: true });
|
|
75
|
-
try {
|
|
76
|
-
return await ModelsTreeDefinition_1.ModelsTreeDefinition.createInstanceKeyPaths({
|
|
77
|
-
imodelAccess,
|
|
78
|
-
label: filter,
|
|
79
|
-
idsCache: getModelsTreeIdsCache(),
|
|
80
|
-
hierarchyConfig: hierarchyConfiguration,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
catch (e) {
|
|
84
|
-
const newError = e instanceof Error && e.message.match(/Filter matches more than \d+ items/) ? "tooManyFilterMatches" : "unknownFilterError";
|
|
85
|
-
setFilteringError(newError);
|
|
86
|
-
return [];
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}, [filter, getModelsTreeIdsCache, onFeatureUsed, hierarchyConfiguration]);
|
|
90
|
-
const getFilteredPaths = getFocusedFilteredPaths ?? getSearchFilteredPaths;
|
|
91
|
-
return ((0, jsx_runtime_1.jsx)(VisibilityTree_1.VisibilityTree, { height: height, width: width, imodel: imodel, treeName: ModelsTreeComponent_1.ModelsTreeComponent.id, selectionStorage: selectionStorage, getSchemaContext: getSchemaContext, visibilityHandlerFactory: visibilityHandlerFactory, getHierarchyDefinition: getHierarchyDefinition, getFilteredPaths: getFilteredPaths, hierarchyLevelSizeLimit: hierarchyLevelConfig?.sizeLimit, density: density, noDataMessage: getNoDataMessage(filter, filteringError), selectionMode: selectionMode, highlight: filter === undefined ? undefined : { text: filter }, treeRenderer: (treeProps) => (0, jsx_runtime_1.jsx)(VisibilityTreeRenderer_1.VisibilityTreeRenderer, { ...treeProps, getIcon: getIcon, onNodeDoubleClick: onNodeDoubleClick }) }));
|
|
13
|
+
function ModelsTree({ imodel, getSchemaContext, selectionStorage, activeView, filter, density, hierarchyLevelConfig, hierarchyConfig, selectionMode, visibilityHandlerOverrides, getFilteredPaths, }) {
|
|
14
|
+
const { modelsTreeProps, rendererProps } = (0, UseModelsTree_1.useModelsTree)({ activeView, filter, hierarchyConfig, visibilityHandlerOverrides, getFilteredPaths });
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)(VisibilityTree_1.VisibilityTree, { ...modelsTreeProps, imodel: imodel, selectionStorage: selectionStorage, getSchemaContext: getSchemaContext, hierarchyLevelSizeLimit: hierarchyLevelConfig?.sizeLimit, density: density, selectionMode: selectionMode, treeRenderer: (treeProps) => (0, jsx_runtime_1.jsx)(VisibilityTreeRenderer_1.VisibilityTreeRenderer, { ...treeProps, ...rendererProps }) }));
|
|
92
16
|
}
|
|
93
17
|
exports.ModelsTree = ModelsTree;
|
|
94
|
-
function getNoDataMessage(filter, error) {
|
|
95
|
-
if (isInstanceFocusError(error)) {
|
|
96
|
-
return (0, jsx_runtime_1.jsx)(InstanceFocusError, { error: error });
|
|
97
|
-
}
|
|
98
|
-
if (isFilterError(error)) {
|
|
99
|
-
return (0, jsx_runtime_1.jsx)(itwinui_react_1.Text, { children: TreeWidget_1.TreeWidget.translate(`modelsTree.filtering.${error}`) });
|
|
100
|
-
}
|
|
101
|
-
if (filter) {
|
|
102
|
-
return (0, jsx_runtime_1.jsx)(itwinui_react_1.Text, { children: TreeWidget_1.TreeWidget.translate("modelsTree.filtering.noMatches", { filter }) });
|
|
103
|
-
}
|
|
104
|
-
return undefined;
|
|
105
|
-
}
|
|
106
|
-
function isFilterError(error) {
|
|
107
|
-
return error === "tooManyFilterMatches" || error === "unknownFilterError";
|
|
108
|
-
}
|
|
109
|
-
function isInstanceFocusError(error) {
|
|
110
|
-
return error === "tooManyInstancesFocused" || error === "unknownInstanceFocusError";
|
|
111
|
-
}
|
|
112
|
-
function InstanceFocusError({ error }) {
|
|
113
|
-
const { toggle } = (0, FocusedInstancesContext_1.useFocusedInstancesContext)();
|
|
114
|
-
const localizedMessage = createLocalizedMessage(TreeWidget_1.TreeWidget.translate(`modelsTree.filtering.${error}`), () => toggle());
|
|
115
|
-
return (0, jsx_runtime_1.jsx)(itwinui_react_1.Text, { children: localizedMessage });
|
|
116
|
-
}
|
|
117
|
-
function getIcon(node) {
|
|
118
|
-
if (node.extendedData?.imageId === undefined) {
|
|
119
|
-
return undefined;
|
|
120
|
-
}
|
|
121
|
-
switch (node.extendedData.imageId) {
|
|
122
|
-
case "icon-layers":
|
|
123
|
-
return (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgLayers, {});
|
|
124
|
-
case "icon-item":
|
|
125
|
-
return (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgItem, {});
|
|
126
|
-
case "icon-ec-class":
|
|
127
|
-
return (0, jsx_runtime_1.jsx)(SvgClassGrouping, {});
|
|
128
|
-
case "icon-imodel-hollow-2":
|
|
129
|
-
return (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgImodelHollow, {});
|
|
130
|
-
case "icon-folder":
|
|
131
|
-
return (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgFolder, {});
|
|
132
|
-
case "icon-model":
|
|
133
|
-
return (0, jsx_runtime_1.jsx)(itwinui_icons_react_1.SvgModel, {});
|
|
134
|
-
}
|
|
135
|
-
return undefined;
|
|
136
|
-
}
|
|
137
|
-
function createVisibilityHandlerFactory(activeView, idsCacheGetter, overrides) {
|
|
138
|
-
return ({ imodelAccess }) => (0, ModelsTreeVisibilityHandler_1.createModelsTreeVisibilityHandler)({ viewport: activeView, idsCache: idsCacheGetter(), imodelAccess, overrides });
|
|
139
|
-
}
|
|
140
|
-
function useCachedVisibility(activeView, hierarchyConfig, overrides) {
|
|
141
|
-
const cacheRef = (0, react_1.useRef)();
|
|
142
|
-
const currentIModelRef = (0, react_1.useRef)(activeView.iModel);
|
|
143
|
-
const getModelsTreeIdsCache = (0, react_1.useCallback)(() => {
|
|
144
|
-
if (!cacheRef.current) {
|
|
145
|
-
cacheRef.current = new ModelsTreeIdsCache_1.ModelsTreeIdsCache((0, presentation_core_interop_1.createECSqlQueryExecutor)(currentIModelRef.current), hierarchyConfig);
|
|
146
|
-
}
|
|
147
|
-
return cacheRef.current;
|
|
148
|
-
}, [hierarchyConfig]);
|
|
149
|
-
const [visibilityHandlerFactory, setVisibilityHandlerFactory] = (0, react_1.useState)(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));
|
|
150
|
-
(0, UseIModelChangeListener_1.useIModelChangeListener)({
|
|
151
|
-
imodel: activeView.iModel,
|
|
152
|
-
action: (0, react_1.useCallback)(() => {
|
|
153
|
-
cacheRef.current = undefined;
|
|
154
|
-
setVisibilityHandlerFactory(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));
|
|
155
|
-
}, [activeView, getModelsTreeIdsCache, overrides]),
|
|
156
|
-
});
|
|
157
|
-
(0, react_1.useEffect)(() => {
|
|
158
|
-
currentIModelRef.current = activeView.iModel;
|
|
159
|
-
cacheRef.current = undefined;
|
|
160
|
-
setVisibilityHandlerFactory(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));
|
|
161
|
-
}, [activeView, getModelsTreeIdsCache, overrides]);
|
|
162
|
-
return {
|
|
163
|
-
getModelsTreeIdsCache,
|
|
164
|
-
visibilityHandlerFactory,
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
function SvgClassGrouping() {
|
|
168
|
-
return ((0, jsx_runtime_1.jsx)(itwinui_react_1.Icon, { children: (0, jsx_runtime_1.jsx)("svg", { id: "Calque_1", "data-name": "Calque 1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", children: (0, jsx_runtime_1.jsx)("path", { d: "M8.00933,0,0,3.97672V11.986L8.00933,16,16,11.93V3.97651ZM1.66173,11.27642c-.26155.03734-.59754-.26154-.76553-.69085-.168-.41066-.09334-.784.168-.82152.26154-.03734.59754.26154.76553.67219C1.99772,10.86577,1.92306,11.23909,1.66173,11.27642Zm0-3.32319c-.26155.03733-.59754-.28-.76553-.69086-.168-.42932-.09334-.80285.168-.84.26133-.03733.59754.28.76532.69086C1.99772,7.54236,1.92306,7.89723,1.66173,7.95323Zm4.31276,5.52621a.18186.18186,0,0,1-.16821-.01866L3.41657,12.15394a.94275.94275,0,0,1-.29887-.80285c.03754-.33621.22421-.52265.41108-.41066L5.9185,12.24727a.88656.88656,0,0,1,.28.80285A.5057.5057,0,0,1,5.97449,13.47944Zm0-3.37919a.18184.18184,0,0,1-.16821-.01867L3.41657,8.77475a.943.943,0,0,1-.29887-.80286c.03754-.3362.22421-.52286.41108-.42953L5.9185,8.86786a.83112.83112,0,0,1,.28.78419A.51684.51684,0,0,1,5.97449,10.10025Z" }) }) }));
|
|
169
|
-
}
|
|
170
|
-
async function collectTargetKeys(loadFocusedInstancesKeys) {
|
|
171
|
-
const targetKeys = [];
|
|
172
|
-
const groupingNodeInfos = [];
|
|
173
|
-
for await (const key of loadFocusedInstancesKeys()) {
|
|
174
|
-
if ("id" in key) {
|
|
175
|
-
targetKeys.push(key);
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
if (!presentation_hierarchies_1.HierarchyNodeKey.isClassGrouping(key.key)) {
|
|
179
|
-
targetKeys.push(...key.groupedInstanceKeys);
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
182
|
-
if (!key.nonGroupingAncestor || !presentation_hierarchies_1.HierarchyNodeKey.isInstances(key.nonGroupingAncestor.key)) {
|
|
183
|
-
continue;
|
|
184
|
-
}
|
|
185
|
-
const parentKey = key.nonGroupingAncestor.key;
|
|
186
|
-
const type = key.nonGroupingAncestor.extendedData?.isCategory ? "category" : "element";
|
|
187
|
-
const modelIds = (key.nonGroupingAncestor.extendedData?.modelIds ?? []).flatMap((ids) => ids);
|
|
188
|
-
const groupInfo = groupingNodeInfos.find((group) => presentation_hierarchies_1.HierarchyNodeKey.equals(group.parentKey, parentKey));
|
|
189
|
-
if (groupInfo) {
|
|
190
|
-
groupInfo.classes.push(key.key.className);
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
groupingNodeInfos.push({ classes: [key.key.className], parentType: type, parentKey, modelIds });
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
targetKeys.push(...groupingNodeInfos.map(({ parentKey, parentType, classes, modelIds }) => ({
|
|
197
|
-
parent: parentType === "element"
|
|
198
|
-
? { type: "element", ids: parentKey.instanceKeys.map((key) => key.id) }
|
|
199
|
-
: { type: "category", ids: parentKey.instanceKeys.map((key) => key.id), modelIds },
|
|
200
|
-
classes,
|
|
201
|
-
})));
|
|
202
|
-
return targetKeys;
|
|
203
|
-
}
|
|
204
|
-
function createLocalizedMessage(message, onClick) {
|
|
205
|
-
const exp = new RegExp("<link>(.*)</link>");
|
|
206
|
-
const match = message.match(exp);
|
|
207
|
-
if (!match) {
|
|
208
|
-
return message;
|
|
209
|
-
}
|
|
210
|
-
const [fullText, innerText] = match;
|
|
211
|
-
const [textBefore, textAfter] = message.split(fullText);
|
|
212
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [textBefore ? textBefore : null, (0, jsx_runtime_1.jsx)(itwinui_react_1.Anchor, { underline: true, onClick: (e) => {
|
|
213
|
-
e.stopPropagation();
|
|
214
|
-
onClick?.();
|
|
215
|
-
}, children: innerText }), textAfter ? textAfter : null] }));
|
|
216
|
-
}
|
|
217
18
|
//# sourceMappingURL=ModelsTree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelsTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/ModelsTree.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,iCAA0E;AAC1E,wDAAiD;AACjD,oEAAsG;AACtG,wDAA0D;AAC1D,gFAA4E;AAC5E,8EAAkF;AAClF,oDAAiD;AACjD,wEAAqE;AACrE,w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IACpC,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAExD,OAAO,CACL,6DACG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAC/B,uBAAC,sBAAM,IACL,SAAS,QACT,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;oBACb,CAAC,CAAC,eAAe,EAAE,CAAC;oBACpB,OAAO,EAAE,EAAE,CAAC;gBACd,CAAC,YAEA,SAAS,GACH,EACR,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAC5B,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { SvgFolder, SvgImodelHollow, SvgItem, SvgLayers, SvgModel } from \"@itwin/itwinui-icons-react\";\nimport { Anchor, Icon, Text } from \"@itwin/itwinui-react\";\nimport { createECSqlQueryExecutor } from \"@itwin/presentation-core-interop\";\nimport { HierarchyNode, HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { VisibilityTree } from \"../common/components/VisibilityTree\";\nimport { VisibilityTreeRenderer } from \"../common/components/VisibilityTreeRenderer\";\nimport { useFocusedInstancesContext } from \"../common/FocusedInstancesContext\";\nimport { useIModelChangeListener } from \"../common/UseIModelChangeListener\";\nimport { useTelemetryContext } from \"../common/UseTelemetryContext\";\nimport { ModelsTreeIdsCache } from \"./internal/ModelsTreeIdsCache\";\nimport { createModelsTreeVisibilityHandler } from \"./internal/ModelsTreeVisibilityHandler\";\nimport { ModelsTreeComponent } from \"./ModelsTreeComponent\";\nimport { defaultHierarchyConfiguration, ModelsTreeDefinition } from \"./ModelsTreeDefinition\";\n\nimport type { ModelsTreeVisibilityHandlerOverrides } from \"./internal/ModelsTreeVisibilityHandler\";\nimport type { Id64String } from \"@itwin/core-bentley\";\nimport type { GroupingHierarchyNode, InstancesNodeKey } from \"@itwin/presentation-hierarchies\";\nimport type { ElementsGroupInfo, ModelsTreeHierarchyConfiguration } from \"./ModelsTreeDefinition\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\nimport type { ComponentPropsWithoutRef, ReactElement } from \"react\";\nimport type { Viewport } from \"@itwin/core-frontend\";\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\n\ntype ModelsTreeFilteringError = \"tooManyFilterMatches\" | \"tooManyInstancesFocused\" | \"unknownFilterError\" | \"unknownInstanceFocusError\";\n\n/** @beta */\ninterface ModelsTreeOwnProps {\n activeView: Viewport;\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n hierarchyConfig?: Partial<ModelsTreeHierarchyConfiguration>;\n visibilityHandlerOverrides?: ModelsTreeVisibilityHandlerOverrides;\n filter?: string;\n}\n\n/** @beta */\ntype VisibilityTreeProps = ComponentPropsWithoutRef<typeof VisibilityTree>;\n\n/** @beta */\ntype ModelsTreeProps = ModelsTreeOwnProps &\n Pick<VisibilityTreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"height\" | \"width\" | \"density\" | \"selectionMode\">;\n\n/** @beta */\nexport function ModelsTree({\n imodel,\n getSchemaContext,\n selectionStorage,\n height,\n width,\n activeView,\n filter,\n density,\n hierarchyLevelConfig,\n hierarchyConfig,\n selectionMode,\n visibilityHandlerOverrides,\n}: ModelsTreeProps) {\n const [filteringError, setFilteringError] = useState<ModelsTreeFilteringError | undefined>(undefined);\n const hierarchyConfiguration = useMemo<ModelsTreeHierarchyConfiguration>(\n () => ({\n ...defaultHierarchyConfiguration,\n ...hierarchyConfig,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n Object.values(hierarchyConfig ?? {}),\n );\n const { onFeatureUsed } = useTelemetryContext();\n\n const { getModelsTreeIdsCache, visibilityHandlerFactory } = useCachedVisibility(activeView, hierarchyConfiguration, visibilityHandlerOverrides);\n const { loadInstanceKeys: loadFocusedInstancesKeys } = useFocusedInstancesContext();\n\n const getHierarchyDefinition = useCallback<VisibilityTreeProps[\"getHierarchyDefinition\"]>(\n ({ imodelAccess }) => new ModelsTreeDefinition({ imodelAccess, idsCache: getModelsTreeIdsCache(), hierarchyConfig: hierarchyConfiguration }),\n [getModelsTreeIdsCache, hierarchyConfiguration],\n );\n\n const onNodeDoubleClick = useCallback(\n async ({ nodeData, extendedData }: PresentationHierarchyNode) => {\n if (!HierarchyNode.isInstancesNode(nodeData) || (extendedData && (extendedData.isSubject || extendedData.isModel || extendedData.isCategory))) {\n return;\n }\n const instanceIds = nodeData.key.instanceKeys.map((instanceKey) => instanceKey.id);\n await IModelApp.viewManager.selectedView?.zoomToElements(instanceIds);\n onFeatureUsed({ featureId: \"zoom-to-node\", reportInteraction: false });\n },\n [onFeatureUsed],\n );\n\n const getFocusedFilteredPaths = useMemo<VisibilityTreeProps[\"getFilteredPaths\"] | undefined>(() => {\n setFilteringError(undefined);\n if (!loadFocusedInstancesKeys) {\n return undefined;\n }\n return async ({ imodelAccess }) => {\n try {\n const targetKeys = await collectTargetKeys(loadFocusedInstancesKeys);\n return await ModelsTreeDefinition.createInstanceKeyPaths({\n imodelAccess,\n idsCache: getModelsTreeIdsCache(),\n keys: targetKeys,\n hierarchyConfig: hierarchyConfiguration,\n });\n } catch (e) {\n const newError = e instanceof Error && e.message.match(/Filter matches more than \\d+ items/) ? \"tooManyInstancesFocused\" : \"unknownInstanceFocusError\";\n setFilteringError(newError);\n return [];\n }\n };\n }, [loadFocusedInstancesKeys, getModelsTreeIdsCache, hierarchyConfiguration]);\n\n const getSearchFilteredPaths = useMemo<VisibilityTreeProps[\"getFilteredPaths\"] | undefined>(() => {\n setFilteringError(undefined);\n if (!filter) {\n return undefined;\n }\n return async ({ imodelAccess }) => {\n onFeatureUsed({ featureId: \"filtering\", reportInteraction: true });\n try {\n return await ModelsTreeDefinition.createInstanceKeyPaths({\n imodelAccess,\n label: filter,\n idsCache: getModelsTreeIdsCache(),\n hierarchyConfig: hierarchyConfiguration,\n });\n } catch (e) {\n const newError = e instanceof Error && e.message.match(/Filter matches more than \\d+ items/) ? \"tooManyFilterMatches\" : \"unknownFilterError\";\n setFilteringError(newError);\n return [];\n }\n };\n }, [filter, getModelsTreeIdsCache, onFeatureUsed, hierarchyConfiguration]);\n\n const getFilteredPaths = getFocusedFilteredPaths ?? getSearchFilteredPaths;\n\n return (\n <VisibilityTree\n height={height}\n width={width}\n imodel={imodel}\n treeName={ModelsTreeComponent.id}\n selectionStorage={selectionStorage}\n getSchemaContext={getSchemaContext}\n visibilityHandlerFactory={visibilityHandlerFactory}\n getHierarchyDefinition={getHierarchyDefinition}\n getFilteredPaths={getFilteredPaths}\n hierarchyLevelSizeLimit={hierarchyLevelConfig?.sizeLimit}\n density={density}\n noDataMessage={getNoDataMessage(filter, filteringError)}\n selectionMode={selectionMode}\n highlight={filter === undefined ? undefined : { text: filter }}\n treeRenderer={(treeProps) => <VisibilityTreeRenderer {...treeProps} getIcon={getIcon} onNodeDoubleClick={onNodeDoubleClick} />}\n />\n );\n}\n\nfunction getNoDataMessage(filter?: string, error?: ModelsTreeFilteringError) {\n if (isInstanceFocusError(error)) {\n return <InstanceFocusError error={error!} />;\n }\n if (isFilterError(error)) {\n return <Text>{TreeWidget.translate(`modelsTree.filtering.${error}`)}</Text>;\n }\n if (filter) {\n return <Text>{TreeWidget.translate(\"modelsTree.filtering.noMatches\", { filter })}</Text>;\n }\n return undefined;\n}\n\nfunction isFilterError(error: ModelsTreeFilteringError | undefined) {\n return error === \"tooManyFilterMatches\" || error === \"unknownFilterError\";\n}\n\nfunction isInstanceFocusError(error: ModelsTreeFilteringError | undefined) {\n return error === \"tooManyInstancesFocused\" || error === \"unknownInstanceFocusError\";\n}\n\nfunction InstanceFocusError({ error }: { error: ModelsTreeFilteringError }) {\n const { toggle } = useFocusedInstancesContext();\n const localizedMessage = createLocalizedMessage(TreeWidget.translate(`modelsTree.filtering.${error}`), () => toggle());\n return <Text>{localizedMessage}</Text>;\n}\n\nfunction getIcon(node: PresentationHierarchyNode): ReactElement | undefined {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n\n switch (node.extendedData.imageId) {\n case \"icon-layers\":\n return <SvgLayers />;\n case \"icon-item\":\n return <SvgItem />;\n case \"icon-ec-class\":\n return <SvgClassGrouping />;\n case \"icon-imodel-hollow-2\":\n return <SvgImodelHollow />;\n case \"icon-folder\":\n return <SvgFolder />;\n case \"icon-model\":\n return <SvgModel />;\n }\n\n return undefined;\n}\n\nfunction createVisibilityHandlerFactory(\n activeView: Viewport,\n idsCacheGetter: () => ModelsTreeIdsCache,\n overrides?: ModelsTreeVisibilityHandlerOverrides,\n): VisibilityTreeProps[\"visibilityHandlerFactory\"] {\n return ({ imodelAccess }) => createModelsTreeVisibilityHandler({ viewport: activeView, idsCache: idsCacheGetter(), imodelAccess, overrides });\n}\n\nfunction useCachedVisibility(activeView: Viewport, hierarchyConfig: ModelsTreeHierarchyConfiguration, overrides?: ModelsTreeVisibilityHandlerOverrides) {\n const cacheRef = useRef<ModelsTreeIdsCache>();\n const currentIModelRef = useRef(activeView.iModel);\n\n const getModelsTreeIdsCache = useCallback(() => {\n if (!cacheRef.current) {\n cacheRef.current = new ModelsTreeIdsCache(createECSqlQueryExecutor(currentIModelRef.current), hierarchyConfig);\n }\n return cacheRef.current;\n }, [hierarchyConfig]);\n\n const [visibilityHandlerFactory, setVisibilityHandlerFactory] = useState(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));\n\n useIModelChangeListener({\n imodel: activeView.iModel,\n action: useCallback(() => {\n cacheRef.current = undefined;\n setVisibilityHandlerFactory(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));\n }, [activeView, getModelsTreeIdsCache, overrides]),\n });\n\n useEffect(() => {\n currentIModelRef.current = activeView.iModel;\n cacheRef.current = undefined;\n setVisibilityHandlerFactory(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));\n }, [activeView, getModelsTreeIdsCache, overrides]);\n\n return {\n getModelsTreeIdsCache,\n visibilityHandlerFactory,\n };\n}\n\nfunction SvgClassGrouping() {\n return (\n <Icon>\n <svg id=\"Calque_1\" data-name=\"Calque 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M8.00933,0,0,3.97672V11.986L8.00933,16,16,11.93V3.97651ZM1.66173,11.27642c-.26155.03734-.59754-.26154-.76553-.69085-.168-.41066-.09334-.784.168-.82152.26154-.03734.59754.26154.76553.67219C1.99772,10.86577,1.92306,11.23909,1.66173,11.27642Zm0-3.32319c-.26155.03733-.59754-.28-.76553-.69086-.168-.42932-.09334-.80285.168-.84.26133-.03733.59754.28.76532.69086C1.99772,7.54236,1.92306,7.89723,1.66173,7.95323Zm4.31276,5.52621a.18186.18186,0,0,1-.16821-.01866L3.41657,12.15394a.94275.94275,0,0,1-.29887-.80285c.03754-.33621.22421-.52265.41108-.41066L5.9185,12.24727a.88656.88656,0,0,1,.28.80285A.5057.5057,0,0,1,5.97449,13.47944Zm0-3.37919a.18184.18184,0,0,1-.16821-.01867L3.41657,8.77475a.943.943,0,0,1-.29887-.80286c.03754-.3362.22421-.52286.41108-.42953L5.9185,8.86786a.83112.83112,0,0,1,.28.78419A.51684.51684,0,0,1,5.97449,10.10025Z\" />\n </svg>\n </Icon>\n );\n}\n\nasync function collectTargetKeys(loadFocusedInstancesKeys: () => AsyncIterableIterator<InstanceKey | GroupingHierarchyNode>) {\n const targetKeys: Array<InstanceKey | ElementsGroupInfo> = [];\n const groupingNodeInfos: Array<{ parentKey: InstancesNodeKey; parentType: \"element\" | \"category\"; classes: string[]; modelIds: Id64String[] }> = [];\n for await (const key of loadFocusedInstancesKeys()) {\n if (\"id\" in key) {\n targetKeys.push(key);\n continue;\n }\n\n if (!HierarchyNodeKey.isClassGrouping(key.key)) {\n targetKeys.push(...key.groupedInstanceKeys);\n continue;\n }\n\n if (!key.nonGroupingAncestor || !HierarchyNodeKey.isInstances(key.nonGroupingAncestor.key)) {\n continue;\n }\n\n const parentKey = key.nonGroupingAncestor.key;\n const type = key.nonGroupingAncestor.extendedData?.isCategory ? \"category\" : \"element\";\n const modelIds = ((key.nonGroupingAncestor.extendedData?.modelIds as Id64String[][]) ?? []).flatMap((ids) => ids);\n const groupInfo = groupingNodeInfos.find((group) => HierarchyNodeKey.equals(group.parentKey, parentKey));\n if (groupInfo) {\n groupInfo.classes.push(key.key.className);\n } else {\n groupingNodeInfos.push({ classes: [key.key.className], parentType: type, parentKey, modelIds });\n }\n }\n targetKeys.push(\n ...groupingNodeInfos.map(({ parentKey, parentType, classes, modelIds }) => ({\n parent:\n parentType === \"element\"\n ? { type: \"element\" as const, ids: parentKey.instanceKeys.map((key) => key.id) }\n : { type: \"category\" as const, ids: parentKey.instanceKeys.map((key) => key.id), modelIds },\n classes,\n })),\n );\n return targetKeys;\n}\n\nfunction createLocalizedMessage(message: string, onClick?: () => void) {\n const exp = new RegExp(\"<link>(.*)</link>\");\n const match = message.match(exp);\n if (!match) {\n return message;\n }\n\n const [fullText, innerText] = match;\n const [textBefore, textAfter] = message.split(fullText);\n\n return (\n <>\n {textBefore ? textBefore : null}\n <Anchor\n underline\n onClick={(e) => {\n e.stopPropagation();\n onClick?.();\n }}\n >\n {innerText}\n </Anchor>\n {textAfter ? textAfter : null}\n </>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ModelsTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/ModelsTree.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,wEAAqE;AACrE,wFAAqF;AACrF,mDAAgD;AAqBhD,YAAY;AACZ,SAAgB,UAAU,CAAC,EACzB,MAAM,EACN,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,MAAM,EACN,OAAO,EACP,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,0BAA0B,EAC1B,gBAAgB,GACA;IAChB,MAAM,EAAE,eAAe,EAAE,aAAa,EAAE,GAAG,IAAA,6BAAa,EAAC,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,0BAA0B,EAAE,gBAAgB,EAAE,CAAC,CAAC;IAEhJ,OAAO,CACL,uBAAC,+BAAc,OACT,eAAe,EACnB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,gBAAgB,EAClC,gBAAgB,EAAE,gBAAgB,EAClC,uBAAuB,EAAE,oBAAoB,EAAE,SAAS,EACxD,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,uBAAC,+CAAsB,OAAK,SAAS,KAAM,aAAa,GAAI,GACzF,CACH,CAAC;AACJ,CAAC;AA3BD,gCA2BC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { VisibilityTree } from \"../common/components/VisibilityTree\";\nimport { VisibilityTreeRenderer } from \"../common/components/VisibilityTreeRenderer\";\nimport { useModelsTree } from \"./UseModelsTree\";\n\nimport type { ComponentPropsWithoutRef } from \"react\";\n\n/** @beta */\ntype VisibilityTreeProps = ComponentPropsWithoutRef<typeof VisibilityTree>;\n\n/** @beta */\ninterface ModelsTreeOwnProps {\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n}\n\ntype UseModelsTreeProps = Parameters<typeof useModelsTree>[0];\n\n/** @beta */\ntype ModelsTreeProps = ModelsTreeOwnProps &\n UseModelsTreeProps &\n Pick<VisibilityTreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"density\" | \"selectionMode\">;\n\n/** @beta */\nexport function ModelsTree({\n imodel,\n getSchemaContext,\n selectionStorage,\n activeView,\n filter,\n density,\n hierarchyLevelConfig,\n hierarchyConfig,\n selectionMode,\n visibilityHandlerOverrides,\n getFilteredPaths,\n}: ModelsTreeProps) {\n const { modelsTreeProps, rendererProps } = useModelsTree({ activeView, filter, hierarchyConfig, visibilityHandlerOverrides, getFilteredPaths });\n\n return (\n <VisibilityTree\n {...modelsTreeProps}\n imodel={imodel}\n selectionStorage={selectionStorage}\n getSchemaContext={getSchemaContext}\n hierarchyLevelSizeLimit={hierarchyLevelConfig?.sizeLimit}\n density={density}\n selectionMode={selectionMode}\n treeRenderer={(treeProps) => <VisibilityTreeRenderer {...treeProps} {...rendererProps} />}\n />\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { TreeHeaderButtonProps } from "../../tree-header/TreeHeader";
|
|
3
|
-
import type { IModelConnection } from "@itwin/core-frontend";
|
|
3
|
+
import type { IModelConnection, Viewport } from "@itwin/core-frontend";
|
|
4
4
|
/**
|
|
5
5
|
* Information about a single Model.
|
|
6
6
|
* @public
|
|
@@ -18,8 +18,14 @@ export interface ModelsTreeHeaderButtonProps extends TreeHeaderButtonProps {
|
|
|
18
18
|
/** A list of models available in the iModel. */
|
|
19
19
|
models: ModelInfo[];
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Custom hook that creates props required to render `ModelsTreeComponent` header button.
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export declare function useModelsTreeButtonProps({ imodel, viewport, }: {
|
|
26
|
+
imodel: IModelConnection;
|
|
27
|
+
viewport: Viewport;
|
|
28
|
+
}): Pick<ModelsTreeHeaderButtonProps, "models" | "viewport">;
|
|
23
29
|
/** @public */
|
|
24
30
|
export declare function ShowAllButton(props: ModelsTreeHeaderButtonProps): JSX.Element;
|
|
25
31
|
/** @public */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ToggleInstancesFocusButton = exports.View3DButton = exports.View2DButton = exports.InvertButton = exports.HideAllButton = exports.ShowAllButton = exports.
|
|
3
|
+
exports.ToggleInstancesFocusButton = exports.View3DButton = exports.View2DButton = exports.InvertButton = exports.HideAllButton = exports.ShowAllButton = exports.useModelsTreeButtonProps = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
/*---------------------------------------------------------------------------------------------
|
|
6
6
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
@@ -12,7 +12,18 @@ const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
|
12
12
|
const TreeWidget_1 = require("../../../TreeWidget");
|
|
13
13
|
const FocusedInstancesContext_1 = require("../common/FocusedInstancesContext");
|
|
14
14
|
const ModelsTreeVisibilityHandler_1 = require("./internal/ModelsTreeVisibilityHandler");
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Custom hook that creates props required to render `ModelsTreeComponent` header button.
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
function useModelsTreeButtonProps({ imodel, viewport, }) {
|
|
20
|
+
const models = useAvailableModels(imodel);
|
|
21
|
+
return {
|
|
22
|
+
models,
|
|
23
|
+
viewport,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
exports.useModelsTreeButtonProps = useModelsTreeButtonProps;
|
|
16
27
|
function useAvailableModels(imodel) {
|
|
17
28
|
const [availableModels, setAvailableModels] = (0, react_1.useState)([]);
|
|
18
29
|
(0, react_1.useEffect)(() => {
|
|
@@ -26,7 +37,6 @@ function useAvailableModels(imodel) {
|
|
|
26
37
|
}, [imodel]);
|
|
27
38
|
return availableModels;
|
|
28
39
|
}
|
|
29
|
-
exports.useAvailableModels = useAvailableModels;
|
|
30
40
|
async function queryModelsForHeaderActions(iModel) {
|
|
31
41
|
const queryParams = {
|
|
32
42
|
from: "BisCore.GeometricModel3d",
|