@itwin/tree-widget-react 1.1.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,21 @@
1
1
  # Change Log - @itwin/tree-widget-react
2
2
 
3
- This log was last generated on Tue, 22 Aug 2023 14:39:05 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 19 Sep 2023 14:55:43 GMT and should not be manually modified.
4
+
5
+ ## 1.2.0
6
+ Tue, 19 Sep 2023 14:55:43 GMT
7
+
8
+ ### Minor changes
9
+
10
+ - `ModelsTree`: Add an option to pass `modelsVisibilityHandler` as a factory function.
11
+
12
+ ## 1.1.3
13
+ Tue, 29 Aug 2023 13:48:47 GMT
14
+
15
+ ### Patches
16
+
17
+ - Fix spacing between expander and label in iModelContentTree component.
18
+ - Fix Models tree search not loading Subject nodes with hidden content models
4
19
 
5
20
  ## 1.1.2
6
21
  Tue, 22 Aug 2023 14:39:05 GMT
@@ -32,7 +32,7 @@ const IModelContentTree = (props) => {
32
32
  });
33
33
  const eventHandler = (0, components_react_1.useTreeEventsHandler)((0, react_1.useMemo)(() => ({ nodeLoader, modelSource: nodeLoader.modelSource }), [nodeLoader]));
34
34
  const treeModel = (0, components_react_1.useTreeModel)(nodeLoader.modelSource);
35
- return ((0, jsx_runtime_1.jsx)("div", { className: "tree-widget-tree-container", children: (0, jsx_runtime_1.jsx)(components_react_1.ControlledTree, { width: width, height: height, nodeLoader: nodeLoader, selectionMode: selectionMode ?? components_react_1.SelectionMode.None, eventsHandler: eventHandler, model: treeModel, iconsEnabled: true, treeRenderer: (treeProps) => (0, jsx_runtime_1.jsx)(TreeRenderer_1.TreeRenderer, { ...treeProps, contextMenuItems: contextMenuItems, nodeLabelRenderer: props.nodeLabelRenderer, density: props.density }) }) }));
35
+ return ((0, jsx_runtime_1.jsx)("div", { className: "tree-widget-tree-container", children: (0, jsx_runtime_1.jsx)(components_react_1.ControlledTree, { width: width, height: height, nodeLoader: nodeLoader, selectionMode: selectionMode ?? components_react_1.SelectionMode.None, eventsHandler: eventHandler, model: treeModel, treeRenderer: (treeProps) => (0, jsx_runtime_1.jsx)(TreeRenderer_1.TreeRenderer, { ...treeProps, contextMenuItems: contextMenuItems, nodeLabelRenderer: props.nodeLabelRenderer, density: props.density }) }) }));
36
36
  };
37
37
  exports.IModelContentTree = IModelContentTree;
38
38
  const customizeTreeNodeItem = (0, Utils_1.combineTreeNodeItemCustomizations)([
@@ -1 +1 @@
1
- {"version":3,"file":"IModelContentTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/imodel-content-tree/IModelContentTree.tsx"],"names":[],"mappings":";;;;AAAA;;;+FAG+F;AAE/F,iCAAgC;AAChC,8DAA4G;AAC5G,4EAA+E;AAC/E,yDAAsD;AACtD,2CAAwG;AAKxG;;;GAGG;AACU,QAAA,sBAAsB,GAAY,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,yDAAyD;AAQzI;;;;GAIG;AACI,MAAM,iBAAiB,GAAG,CAAC,KAA6B,EAAE,EAAE;IACjE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC;IAEzE,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,uDAA6B,EAAC;QACnD,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,8BAAsB;QAC/B,UAAU,EAAE,EAAE;QACd,mCAAmC,EAAE,IAAI;QACzC,qBAAqB;KACtB,CAAC,CAAC;IACH,MAAM,YAAY,GAAG,IAAA,uCAAoB,EAAC,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE9H,MAAM,SAAS,GAAG,IAAA,+BAAY,EAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAEvD,OAAO,CACL,gCAAK,SAAS,EAAC,4BAA4B,YACzC,uBAAC,iCAAc,IACb,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,IAAI,gCAAa,CAAC,IAAI,EAClD,aAAa,EAAE,YAAY,EAC3B,KAAK,EAAE,SAAS,EAChB,YAAY,EAAE,IAAI,EAClB,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAC1B,uBAAC,2BAAY,OACP,SAAS,EACb,gBAAgB,EAAE,gBAAgB,EAClC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,EAC1C,OAAO,EAAE,KAAK,CAAC,OAAO,GACtB,GAEJ,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAnCW,QAAA,iBAAiB,qBAmC5B;AAEF,MAAM,qBAAqB,GAAG,IAAA,yCAAiC,EAAC;IAC9D,0CAAkC;CACnC,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 { useMemo } from \"react\";\nimport { ControlledTree, SelectionMode, useTreeEventsHandler, useTreeModel } from \"@itwin/components-react\";\nimport { usePresentationTreeNodeLoader } from \"@itwin/presentation-components\";\nimport { TreeRenderer } from \"../common/TreeRenderer\";\nimport { addCustomTreeNodeItemLabelRenderer, combineTreeNodeItemCustomizations } from \"../common/Utils\";\n\nimport type { Ruleset } from \"@itwin/presentation-common\";\nimport type { BaseTreeProps } from \"../common/Types\";\n\n/**\n * Presentation rules used by IModelContentTree\n * @internal\n */\nexport const RULESET_IMODEL_CONTENT: Ruleset = require(\"./IModelContent.json\"); // eslint-disable-line @typescript-eslint/no-var-requires\n\n/**\n * Props for [[IModelContentTree]].\n * @public\n */\nexport type IModelContentTreeProps = BaseTreeProps;\n\n/**\n * A tree that shows all iModel content starting from the root Subject, then the hierarchy of child\n * Subjects, their Models and Elements contained in those Models.\n * @public\n */\nexport const IModelContentTree = (props: IModelContentTreeProps) => {\n const { iModel, width, height, selectionMode, contextMenuItems } = props;\n\n const { nodeLoader } = usePresentationTreeNodeLoader({\n imodel: iModel,\n ruleset: RULESET_IMODEL_CONTENT,\n pagingSize: 20,\n appendChildrenCountForGroupingNodes: true,\n customizeTreeNodeItem,\n });\n const eventHandler = useTreeEventsHandler(useMemo(() => ({ nodeLoader, modelSource: nodeLoader.modelSource }), [nodeLoader]));\n\n const treeModel = useTreeModel(nodeLoader.modelSource);\n\n return (\n <div className=\"tree-widget-tree-container\">\n <ControlledTree\n width={width}\n height={height}\n nodeLoader={nodeLoader}\n selectionMode={selectionMode ?? SelectionMode.None}\n eventsHandler={eventHandler}\n model={treeModel}\n iconsEnabled={true}\n treeRenderer={(treeProps) =>\n <TreeRenderer\n {...treeProps}\n contextMenuItems={contextMenuItems}\n nodeLabelRenderer={props.nodeLabelRenderer}\n density={props.density}\n />\n }\n />\n </div>\n );\n};\n\nconst customizeTreeNodeItem = combineTreeNodeItemCustomizations([\n addCustomTreeNodeItemLabelRenderer,\n]);\n"]}
1
+ {"version":3,"file":"IModelContentTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/imodel-content-tree/IModelContentTree.tsx"],"names":[],"mappings":";;;;AAAA;;;+FAG+F;AAE/F,iCAAgC;AAChC,8DAA4G;AAC5G,4EAA+E;AAC/E,yDAAsD;AACtD,2CAAwG;AAKxG;;;GAGG;AACU,QAAA,sBAAsB,GAAY,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,yDAAyD;AAQzI;;;;GAIG;AACI,MAAM,iBAAiB,GAAG,CAAC,KAA6B,EAAE,EAAE;IACjE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC;IAEzE,MAAM,EAAE,UAAU,EAAE,GAAG,IAAA,uDAA6B,EAAC;QACnD,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,8BAAsB;QAC/B,UAAU,EAAE,EAAE;QACd,mCAAmC,EAAE,IAAI;QACzC,qBAAqB;KACtB,CAAC,CAAC;IACH,MAAM,YAAY,GAAG,IAAA,uCAAoB,EAAC,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE9H,MAAM,SAAS,GAAG,IAAA,+BAAY,EAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAEvD,OAAO,CACL,gCAAK,SAAS,EAAC,4BAA4B,YACzC,uBAAC,iCAAc,IACb,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,IAAI,gCAAa,CAAC,IAAI,EAClD,aAAa,EAAE,YAAY,EAC3B,KAAK,EAAE,SAAS,EAChB,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAC1B,uBAAC,2BAAY,OACP,SAAS,EACb,gBAAgB,EAAE,gBAAgB,EAClC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,EAC1C,OAAO,EAAE,KAAK,CAAC,OAAO,GACtB,GAEJ,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAlCW,QAAA,iBAAiB,qBAkC5B;AAEF,MAAM,qBAAqB,GAAG,IAAA,yCAAiC,EAAC;IAC9D,0CAAkC;CACnC,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 { useMemo } from \"react\";\nimport { ControlledTree, SelectionMode, useTreeEventsHandler, useTreeModel } from \"@itwin/components-react\";\nimport { usePresentationTreeNodeLoader } from \"@itwin/presentation-components\";\nimport { TreeRenderer } from \"../common/TreeRenderer\";\nimport { addCustomTreeNodeItemLabelRenderer, combineTreeNodeItemCustomizations } from \"../common/Utils\";\n\nimport type { Ruleset } from \"@itwin/presentation-common\";\nimport type { BaseTreeProps } from \"../common/Types\";\n\n/**\n * Presentation rules used by IModelContentTree\n * @internal\n */\nexport const RULESET_IMODEL_CONTENT: Ruleset = require(\"./IModelContent.json\"); // eslint-disable-line @typescript-eslint/no-var-requires\n\n/**\n * Props for [[IModelContentTree]].\n * @public\n */\nexport type IModelContentTreeProps = BaseTreeProps;\n\n/**\n * A tree that shows all iModel content starting from the root Subject, then the hierarchy of child\n * Subjects, their Models and Elements contained in those Models.\n * @public\n */\nexport const IModelContentTree = (props: IModelContentTreeProps) => {\n const { iModel, width, height, selectionMode, contextMenuItems } = props;\n\n const { nodeLoader } = usePresentationTreeNodeLoader({\n imodel: iModel,\n ruleset: RULESET_IMODEL_CONTENT,\n pagingSize: 20,\n appendChildrenCountForGroupingNodes: true,\n customizeTreeNodeItem,\n });\n const eventHandler = useTreeEventsHandler(useMemo(() => ({ nodeLoader, modelSource: nodeLoader.modelSource }), [nodeLoader]));\n\n const treeModel = useTreeModel(nodeLoader.modelSource);\n\n return (\n <div className=\"tree-widget-tree-container\">\n <ControlledTree\n width={width}\n height={height}\n nodeLoader={nodeLoader}\n selectionMode={selectionMode ?? SelectionMode.None}\n eventsHandler={eventHandler}\n model={treeModel}\n treeRenderer={(treeProps) =>\n <TreeRenderer\n {...treeProps}\n contextMenuItems={contextMenuItems}\n nodeLabelRenderer={props.nodeLabelRenderer}\n density={props.density}\n />\n }\n />\n </div>\n );\n};\n\nconst customizeTreeNodeItem = combineTreeNodeItemCustomizations([\n addCustomTreeNodeItemLabelRenderer,\n]);\n"]}
@@ -5,7 +5,7 @@ import { ModelsVisibilityHandler } from "./ModelsVisibilityHandler";
5
5
  import type { SingleSchemaClassSpecification } from "@itwin/presentation-common";
6
6
  import type { Viewport } from "@itwin/core-frontend";
7
7
  import type { BaseFilterableTreeProps } from "../common/Types";
8
- import type { ModelsTreeSelectionPredicate } from "./ModelsVisibilityHandler";
8
+ import type { ModelsTreeSelectionPredicate, ModelsVisibilityHandlerProps } from "./ModelsVisibilityHandler";
9
9
  /**
10
10
  * Props for configuring the hierarchy in [[ModelsTree]].
11
11
  * @public
@@ -46,7 +46,7 @@ export interface ModelsTreeProps extends BaseFilterableTreeProps {
46
46
  /**
47
47
  * Custom visibility handler.
48
48
  */
49
- modelsVisibilityHandler?: ModelsVisibilityHandler;
49
+ modelsVisibilityHandler?: ModelsVisibilityHandler | ((props: ModelsVisibilityHandlerProps) => ModelsVisibilityHandler);
50
50
  }
51
51
  /**
52
52
  * A tree component that shows a subject - model - category - element
@@ -101,8 +101,20 @@ function useModelsTreeNodeLoader(props) {
101
101
  }
102
102
  function useVisibilityHandler(rulesetId, iModel, activeView, visibilityHandler, filteredDataProvider, hierarchyAutoUpdateEnabled) {
103
103
  const subjectModelIdsCache = (0, react_1.useMemo)(() => new ModelsVisibilityHandler_1.SubjectModelIdsCache(iModel), [iModel]);
104
- const defaultVisibilityHandler = (0, core_react_1.useDisposable)((0, react_1.useCallback)(() => new ModelsVisibilityHandler_1.ModelsVisibilityHandler({ rulesetId, viewport: activeView, hierarchyAutoUpdateEnabled, subjectModelIdsCache }), [rulesetId, activeView, subjectModelIdsCache, hierarchyAutoUpdateEnabled]));
105
- const handler = visibilityHandler ?? defaultVisibilityHandler;
104
+ const disposableVisibilityHandler = (0, core_react_1.useDisposable)((0, react_1.useCallback)(() => {
105
+ const visibilityHandlerProps = {
106
+ rulesetId,
107
+ viewport: activeView,
108
+ hierarchyAutoUpdateEnabled,
109
+ subjectModelIdsCache,
110
+ };
111
+ return typeof visibilityHandler === "function"
112
+ ? visibilityHandler(visibilityHandlerProps)
113
+ : new ModelsVisibilityHandler_1.ModelsVisibilityHandler(visibilityHandlerProps);
114
+ }, [visibilityHandler, rulesetId, activeView, hierarchyAutoUpdateEnabled, subjectModelIdsCache]));
115
+ const handler = typeof visibilityHandler === "function" || visibilityHandler === undefined
116
+ ? disposableVisibilityHandler
117
+ : visibilityHandler;
106
118
  (0, react_1.useEffect)(() => {
107
119
  handler && handler.setFilteredDataProvider(filteredDataProvider);
108
120
  }, [handler, filteredDataProvider]);
@@ -1 +1 @@
1
- {"version":3,"file":"ModelsTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/ModelsTree.tsx"],"names":[],"mappings":";;;;;;;AAAA;;;+FAG+F;AAE/F,sCAAoC;AACpC,4DAAoC;AACpC,iCAAwD;AACxD,8DAAsF;AACtF,kDAAkD;AAClD,4EAA2G;AAC3G,oDAAiD;AACjD,2CAAsD;AACtD,2CAAiI;AACjI,8EAA2E;AAC3E,sEAAmI;AACnI,uEAA0F;AAC1F,mCAAyF;AAQzF,MAAM,WAAW,GAAG,EAAE,CAAC;AA8CvB;;;;;GAKG;AACH,SAAgB,UAAU,CAAC,KAAsB;IAC/C,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;IACvE,MAAM,EAAE,kBAAkB,EAAE,WAAW,EAAE,qBAAqB,EAAE,GAAG,IAAA,mDAA0B,EAAC,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IACnJ,MAAM,aAAa,GAAG,kBAAkB,KAAK,UAAU,CAAC;IAExD,MAAM,EAAE,UAAU,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAC;IAE1E,MAAM,iBAAiB,GAAG,oBAAoB,CAC5C,UAAU,CAAC,YAAY,CAAC,SAAS,EACjC,KAAK,CAAC,MAAM,EACZ,UAAU,EACV,uBAAuB,EACvB,uBAAuB,CAAC,kBAAkB,CAAC,YAAY,CAAC,EACxD,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACnC,MAAM,YAAY,GAAG,IAAA,0BAAa,EAAC,IAAA,mBAAW,EAAC,GAAG,EAAE,CAAC,IAAI,uDAA0B,CAAC;QA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,EAAC,IAAA,mBAAW,EACxD,GAAG,EAAE,CACH,IAAI,iDAAuB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,CAAC,EACpH,CAAC,SAAS,EAAE,UAAU,EAAE,oBAAoB,EAAE,0BAA0B,CAAC,CAAC,CAC3E,CAAC;IAEF,MAAM,OAAO,GAAG,iBAAiB,IAAI,wBAAwB,CAAC;IAE9D,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,OAAO,IAAI,OAAO,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;IACnE,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAEpC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,sBAAsB,GAAG,CAAC,YAAmF,EAAyD,EAAE;IAC5K,MAAM,gBAAgB,GAAG,YAAqD,CAAC;IAC/E,OAAO,gBAAgB,CAAC,iBAAiB,KAAK,SAAS,IAAI,gBAAgB,CAAC,cAAc,KAAK,SAAS,IAAI,gBAAgB,CAAC,qBAAqB,KAAK,SAAS,CAAC;AACnK,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAAC,YAAmF,EAAqD,EAAE;IACzK,OAAO,sBAAsB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;AACzE,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 \"../VisibilityTreeBase.scss\";\nimport classNames from \"classnames\";\nimport { useCallback, useEffect, useMemo } from \"react\";\nimport { ControlledTree, SelectionMode, useTreeModel } from \"@itwin/components-react\";\nimport { useDisposable } from \"@itwin/core-react\";\nimport { isPresentationTreeNodeItem, usePresentationTreeNodeLoader } from \"@itwin/presentation-components\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { ClassGroupingOption } from \"../common/Types\";\nimport { addCustomTreeNodeItemLabelRenderer, addTreeNodeItemCheckbox, combineTreeNodeItemCustomizations } from \"../common/Utils\";\nimport { VisibilityTreeEventHandler } from \"../VisibilityTreeEventHandler\";\nimport { createVisibilityTreeRenderer, useVisibilityTreeFiltering, VisibilityTreeNoFilteredData } from \"../VisibilityTreeRenderer\";\nimport { ModelsVisibilityHandler, SubjectModelIdsCache } from \"./ModelsVisibilityHandler\";\nimport { addModelsTreeNodeItemIcons, createRuleset, createSearchRuleset } from \"./Utils\";\n\nimport type { SingleSchemaClassSpecification } from \"@itwin/presentation-common\";\nimport type { IModelConnection, Viewport } from \"@itwin/core-frontend\";\nimport type { IFilteredPresentationTreeDataProvider, IPresentationTreeDataProvider } from \"@itwin/presentation-components\";\nimport type { BaseFilterableTreeProps } from \"../common/Types\";\nimport type { ModelsTreeSelectionPredicate } from \"./ModelsVisibilityHandler\";\n\nconst PAGING_SIZE = 20;\n\n/**\n * Props for configuring the hierarchy in [[ModelsTree]].\n * @public\n */\nexport interface ModelsTreeHierarchyConfiguration {\n /** Should the tree group displayed element nodes by class. Defaults to `ClassGroupingOption.No`. */\n enableElementsClassGrouping?: ClassGroupingOption;\n /**\n * Defines the `bis.GeometricElement3d` sub-class that should be used to load element nodes.\n * Defaults to `bis.GeometricElement3d`. It's expected for the given class to derive from it.\n */\n elementClassSpecification?: SingleSchemaClassSpecification;\n /** Should the tree show models without elements. */\n showEmptyModels?: boolean;\n}\n\n/**\n * Props for [[ModelsTree]] component.\n * @public\n */\nexport interface ModelsTreeProps extends BaseFilterableTreeProps {\n /**\n * Predicate which indicates whether node can be selected or no\n */\n selectionPredicate?: ModelsTreeSelectionPredicate;\n /**\n * Active view used to determine and control visibility\n */\n activeView: Viewport;\n /**\n * Configuration options for the hierarchy loaded in the component.\n */\n hierarchyConfig?: ModelsTreeHierarchyConfiguration;\n /**\n * Auto-update the hierarchy when data in the iModel changes.\n * @alpha\n */\n enableHierarchyAutoUpdate?: boolean;\n /**\n * Custom visibility handler.\n */\n modelsVisibilityHandler?: ModelsVisibilityHandler;\n}\n\n/**\n * A tree component that shows a subject - model - category - element\n * hierarchy along with checkboxes that represent and allow changing\n * the display of those instances.\n * @public\n */\nexport function ModelsTree(props: ModelsTreeProps) {\n const { nodeLoader, onItemsRendered } = useModelsTreeNodeLoader(props);\n const { filteredNodeLoader, isFiltering, nodeHighlightingProps } = useVisibilityTreeFiltering(nodeLoader, props.filterInfo, props.onFilterApplied);\n const filterApplied = filteredNodeLoader !== nodeLoader;\n\n const { activeView, modelsVisibilityHandler, selectionPredicate } = props;\n\n const visibilityHandler = useVisibilityHandler(\n nodeLoader.dataProvider.rulesetId,\n props.iModel,\n activeView,\n modelsVisibilityHandler,\n getFilteredDataProvider(filteredNodeLoader.dataProvider),\n props.enableHierarchyAutoUpdate);\n const eventHandler = useDisposable(useCallback(() => new VisibilityTreeEventHandler({\n nodeLoader: filteredNodeLoader,\n visibilityHandler,\n selectionPredicate: (node) => !selectionPredicate || !isPresentationTreeNodeItem(node) ? true : selectionPredicate(node.key, ModelsVisibilityHandler.getNodeType(node)),\n }), [filteredNodeLoader, visibilityHandler, selectionPredicate]));\n\n const treeModel = useTreeModel(filteredNodeLoader.modelSource);\n const treeRenderer = createVisibilityTreeRenderer({\n contextMenuItems: props.contextMenuItems,\n nodeLabelRenderer: props.nodeLabelRenderer,\n density: props.density,\n nodeRendererProps: {\n iconsEnabled: true,\n descriptionEnabled: false,\n levelOffset: 10,\n disableRootNodeCollapse: true,\n },\n });\n\n const overlay = isFiltering ? <div className=\"filteredTreeOverlay\" /> : undefined;\n\n // istanbul ignore next\n const noFilteredDataRenderer = useCallback(() => {\n return <VisibilityTreeNoFilteredData\n title={TreeWidget.translate(\"modelTree.noModelFound\")}\n message={TreeWidget.translate(\"modelTree.noMatchingModelNames\")}\n />;\n }, []);\n\n return (\n <div className={classNames(\"tree-widget-visibility-tree-base\", \"tree-widget-tree-container\")}>\n <ControlledTree\n nodeLoader={filteredNodeLoader}\n model={treeModel}\n selectionMode={props.selectionMode || SelectionMode.None}\n eventsHandler={eventHandler}\n treeRenderer={treeRenderer}\n nodeHighlightingProps={nodeHighlightingProps}\n noDataRenderer={filterApplied ? noFilteredDataRenderer : undefined}\n onItemsRendered={onItemsRendered}\n width={props.width}\n height={props.height}\n />\n {overlay}\n </div>\n );\n}\n\nconst customizeTreeNodeItem = combineTreeNodeItemCustomizations([\n addCustomTreeNodeItemLabelRenderer,\n addTreeNodeItemCheckbox,\n addModelsTreeNodeItemIcons,\n]);\n\nfunction useModelsTreeNodeLoader(props: ModelsTreeProps) {\n const rulesets = {\n general: useMemo(() => createRuleset({\n enableElementsClassGrouping: !!props.hierarchyConfig?.enableElementsClassGrouping,\n elementClassSpecification: props.hierarchyConfig?.elementClassSpecification,\n showEmptyModels: props.hierarchyConfig?.showEmptyModels,\n }), [props.hierarchyConfig?.enableElementsClassGrouping, props.hierarchyConfig?.elementClassSpecification, props.hierarchyConfig?.showEmptyModels]),\n search: useMemo(() => createSearchRuleset({\n elementClassSpecification: props.hierarchyConfig?.elementClassSpecification,\n showEmptyModels: props.hierarchyConfig?.showEmptyModels,\n }), [props.hierarchyConfig?.elementClassSpecification, props.hierarchyConfig?.showEmptyModels]),\n };\n\n const { nodeLoader, onItemsRendered } = usePresentationTreeNodeLoader({\n imodel: props.iModel,\n ruleset: rulesets.general,\n appendChildrenCountForGroupingNodes: (props.hierarchyConfig?.enableElementsClassGrouping === ClassGroupingOption.YesWithCounts),\n pagingSize: PAGING_SIZE,\n enableHierarchyAutoUpdate: props.enableHierarchyAutoUpdate,\n customizeTreeNodeItem,\n });\n const { nodeLoader: searchNodeLoader, onItemsRendered: onSearchItemsRendered } = usePresentationTreeNodeLoader({\n imodel: props.iModel,\n ruleset: rulesets.search,\n pagingSize: PAGING_SIZE,\n enableHierarchyAutoUpdate: props.enableHierarchyAutoUpdate,\n customizeTreeNodeItem,\n });\n\n const activeNodeLoader = props.filterInfo?.filter ? searchNodeLoader : nodeLoader;\n const activeItemsRenderedCallback = props.filterInfo?.filter ? onSearchItemsRendered : onItemsRendered;\n\n return {\n nodeLoader: activeNodeLoader,\n onItemsRendered: activeItemsRenderedCallback,\n };\n}\n\nfunction useVisibilityHandler(\n rulesetId: string,\n iModel: IModelConnection,\n activeView: Viewport,\n visibilityHandler?: ModelsVisibilityHandler,\n filteredDataProvider?: IFilteredPresentationTreeDataProvider,\n hierarchyAutoUpdateEnabled?: boolean,\n) {\n const subjectModelIdsCache = useMemo(() => new SubjectModelIdsCache(iModel), [iModel]);\n\n const defaultVisibilityHandler = useDisposable(useCallback(\n () =>\n new ModelsVisibilityHandler({ rulesetId, viewport: activeView, hierarchyAutoUpdateEnabled, subjectModelIdsCache }),\n [rulesetId, activeView, subjectModelIdsCache, hierarchyAutoUpdateEnabled])\n );\n\n const handler = visibilityHandler ?? defaultVisibilityHandler;\n\n useEffect(() => {\n handler && handler.setFilteredDataProvider(filteredDataProvider);\n }, [handler, filteredDataProvider]);\n\n return handler;\n}\n\nconst isFilteredDataProvider = (dataProvider: IPresentationTreeDataProvider | IFilteredPresentationTreeDataProvider): dataProvider is IFilteredPresentationTreeDataProvider => {\n const filteredProvider = dataProvider as IFilteredPresentationTreeDataProvider;\n return filteredProvider.nodeMatchesFilter !== undefined && filteredProvider.getActiveMatch !== undefined && filteredProvider.countFilteringResults !== undefined;\n};\n\nconst getFilteredDataProvider = (dataProvider: IPresentationTreeDataProvider | IFilteredPresentationTreeDataProvider): IFilteredPresentationTreeDataProvider | undefined => {\n return isFilteredDataProvider(dataProvider) ? dataProvider : undefined;\n};\n"]}
1
+ {"version":3,"file":"ModelsTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/ModelsTree.tsx"],"names":[],"mappings":";;;;;;;AAAA;;;+FAG+F;AAE/F,sCAAoC;AACpC,4DAAoC;AACpC,iCAAwD;AACxD,8DAAsF;AACtF,kDAAkD;AAClD,4EA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,EAAE,oBAAoB,CAAC,CAAC,CAC9F,CAAC;IAEF,MAAM,OAAO,GAAG,OAAO,iBAAiB,KAAK,UAAU,IAAI,iBAAiB,KAAK,SAAS;QACxF,CAAC,CAAC,2BAA2B;QAC7B,CAAC,CAAC,iBAAiB,CAAC;IAEtB,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,OAAO,IAAI,OAAO,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;IACnE,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAEpC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,sBAAsB,GAAG,CAAC,YAAmF,EAAyD,EAAE;IAC5K,MAAM,gBAAgB,GAAG,YAAqD,CAAC;IAC/E,OAAO,gBAAgB,CAAC,iBAAiB,KAAK,SAAS,IAAI,gBAAgB,CAAC,cAAc,KAAK,SAAS,IAAI,gBAAgB,CAAC,qBAAqB,KAAK,SAAS,CAAC;AACnK,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAAC,YAAmF,EAAqD,EAAE;IACzK,OAAO,sBAAsB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;AACzE,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 \"../VisibilityTreeBase.scss\";\nimport classNames from \"classnames\";\nimport { useCallback, useEffect, useMemo } from \"react\";\nimport { ControlledTree, SelectionMode, useTreeModel } from \"@itwin/components-react\";\nimport { useDisposable } from \"@itwin/core-react\";\nimport { isPresentationTreeNodeItem, usePresentationTreeNodeLoader } from \"@itwin/presentation-components\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { ClassGroupingOption } from \"../common/Types\";\nimport { addCustomTreeNodeItemLabelRenderer, addTreeNodeItemCheckbox, combineTreeNodeItemCustomizations } from \"../common/Utils\";\nimport { VisibilityTreeEventHandler } from \"../VisibilityTreeEventHandler\";\nimport { createVisibilityTreeRenderer, useVisibilityTreeFiltering, VisibilityTreeNoFilteredData } from \"../VisibilityTreeRenderer\";\nimport { ModelsVisibilityHandler, SubjectModelIdsCache } from \"./ModelsVisibilityHandler\";\nimport { addModelsTreeNodeItemIcons, createRuleset, createSearchRuleset } from \"./Utils\";\n\nimport type { SingleSchemaClassSpecification } from \"@itwin/presentation-common\";\nimport type { IModelConnection, Viewport } from \"@itwin/core-frontend\";\nimport type { IFilteredPresentationTreeDataProvider, IPresentationTreeDataProvider } from \"@itwin/presentation-components\";\nimport type { BaseFilterableTreeProps } from \"../common/Types\";\nimport type { ModelsTreeSelectionPredicate, ModelsVisibilityHandlerProps } from \"./ModelsVisibilityHandler\";\n\nconst PAGING_SIZE = 20;\n\n/**\n * Props for configuring the hierarchy in [[ModelsTree]].\n * @public\n */\nexport interface ModelsTreeHierarchyConfiguration {\n /** Should the tree group displayed element nodes by class. Defaults to `ClassGroupingOption.No`. */\n enableElementsClassGrouping?: ClassGroupingOption;\n /**\n * Defines the `bis.GeometricElement3d` sub-class that should be used to load element nodes.\n * Defaults to `bis.GeometricElement3d`. It's expected for the given class to derive from it.\n */\n elementClassSpecification?: SingleSchemaClassSpecification;\n /** Should the tree show models without elements. */\n showEmptyModels?: boolean;\n}\n\n/**\n * Props for [[ModelsTree]] component.\n * @public\n */\nexport interface ModelsTreeProps extends BaseFilterableTreeProps {\n /**\n * Predicate which indicates whether node can be selected or no\n */\n selectionPredicate?: ModelsTreeSelectionPredicate;\n /**\n * Active view used to determine and control visibility\n */\n activeView: Viewport;\n /**\n * Configuration options for the hierarchy loaded in the component.\n */\n hierarchyConfig?: ModelsTreeHierarchyConfiguration;\n /**\n * Auto-update the hierarchy when data in the iModel changes.\n * @alpha\n */\n enableHierarchyAutoUpdate?: boolean;\n /**\n * Custom visibility handler.\n */\n modelsVisibilityHandler?: ModelsVisibilityHandler | ((props: ModelsVisibilityHandlerProps) => ModelsVisibilityHandler);\n}\n\n/**\n * A tree component that shows a subject - model - category - element\n * hierarchy along with checkboxes that represent and allow changing\n * the display of those instances.\n * @public\n */\nexport function ModelsTree(props: ModelsTreeProps) {\n const { nodeLoader, onItemsRendered } = useModelsTreeNodeLoader(props);\n const { filteredNodeLoader, isFiltering, nodeHighlightingProps } = useVisibilityTreeFiltering(nodeLoader, props.filterInfo, props.onFilterApplied);\n const filterApplied = filteredNodeLoader !== nodeLoader;\n\n const { activeView, modelsVisibilityHandler, selectionPredicate } = props;\n\n const visibilityHandler = useVisibilityHandler(\n nodeLoader.dataProvider.rulesetId,\n props.iModel,\n activeView,\n modelsVisibilityHandler,\n getFilteredDataProvider(filteredNodeLoader.dataProvider),\n props.enableHierarchyAutoUpdate);\n const eventHandler = useDisposable(useCallback(() => new VisibilityTreeEventHandler({\n nodeLoader: filteredNodeLoader,\n visibilityHandler,\n selectionPredicate: (node) => !selectionPredicate || !isPresentationTreeNodeItem(node) ? true : selectionPredicate(node.key, ModelsVisibilityHandler.getNodeType(node)),\n }), [filteredNodeLoader, visibilityHandler, selectionPredicate]));\n\n const treeModel = useTreeModel(filteredNodeLoader.modelSource);\n const treeRenderer = createVisibilityTreeRenderer({\n contextMenuItems: props.contextMenuItems,\n nodeLabelRenderer: props.nodeLabelRenderer,\n density: props.density,\n nodeRendererProps: {\n iconsEnabled: true,\n descriptionEnabled: false,\n levelOffset: 10,\n disableRootNodeCollapse: true,\n },\n });\n\n const overlay = isFiltering ? <div className=\"filteredTreeOverlay\" /> : undefined;\n\n // istanbul ignore next\n const noFilteredDataRenderer = useCallback(() => {\n return <VisibilityTreeNoFilteredData\n title={TreeWidget.translate(\"modelTree.noModelFound\")}\n message={TreeWidget.translate(\"modelTree.noMatchingModelNames\")}\n />;\n }, []);\n\n return (\n <div className={classNames(\"tree-widget-visibility-tree-base\", \"tree-widget-tree-container\")}>\n <ControlledTree\n nodeLoader={filteredNodeLoader}\n model={treeModel}\n selectionMode={props.selectionMode || SelectionMode.None}\n eventsHandler={eventHandler}\n treeRenderer={treeRenderer}\n nodeHighlightingProps={nodeHighlightingProps}\n noDataRenderer={filterApplied ? noFilteredDataRenderer : undefined}\n onItemsRendered={onItemsRendered}\n width={props.width}\n height={props.height}\n />\n {overlay}\n </div>\n );\n}\n\nconst customizeTreeNodeItem = combineTreeNodeItemCustomizations([\n addCustomTreeNodeItemLabelRenderer,\n addTreeNodeItemCheckbox,\n addModelsTreeNodeItemIcons,\n]);\n\nfunction useModelsTreeNodeLoader(props: ModelsTreeProps) {\n const rulesets = {\n general: useMemo(() => createRuleset({\n enableElementsClassGrouping: !!props.hierarchyConfig?.enableElementsClassGrouping,\n elementClassSpecification: props.hierarchyConfig?.elementClassSpecification,\n showEmptyModels: props.hierarchyConfig?.showEmptyModels,\n }), [props.hierarchyConfig?.enableElementsClassGrouping, props.hierarchyConfig?.elementClassSpecification, props.hierarchyConfig?.showEmptyModels]),\n search: useMemo(() => createSearchRuleset({\n elementClassSpecification: props.hierarchyConfig?.elementClassSpecification,\n showEmptyModels: props.hierarchyConfig?.showEmptyModels,\n }), [props.hierarchyConfig?.elementClassSpecification, props.hierarchyConfig?.showEmptyModels]),\n };\n\n const { nodeLoader, onItemsRendered } = usePresentationTreeNodeLoader({\n imodel: props.iModel,\n ruleset: rulesets.general,\n appendChildrenCountForGroupingNodes: (props.hierarchyConfig?.enableElementsClassGrouping === ClassGroupingOption.YesWithCounts),\n pagingSize: PAGING_SIZE,\n enableHierarchyAutoUpdate: props.enableHierarchyAutoUpdate,\n customizeTreeNodeItem,\n });\n const { nodeLoader: searchNodeLoader, onItemsRendered: onSearchItemsRendered } = usePresentationTreeNodeLoader({\n imodel: props.iModel,\n ruleset: rulesets.search,\n pagingSize: PAGING_SIZE,\n enableHierarchyAutoUpdate: props.enableHierarchyAutoUpdate,\n customizeTreeNodeItem,\n });\n\n const activeNodeLoader = props.filterInfo?.filter ? searchNodeLoader : nodeLoader;\n const activeItemsRenderedCallback = props.filterInfo?.filter ? onSearchItemsRendered : onItemsRendered;\n\n return {\n nodeLoader: activeNodeLoader,\n onItemsRendered: activeItemsRenderedCallback,\n };\n}\n\nfunction useVisibilityHandler(\n rulesetId: string,\n iModel: IModelConnection,\n activeView: Viewport,\n visibilityHandler?: ModelsVisibilityHandler | ((props: ModelsVisibilityHandlerProps) => ModelsVisibilityHandler),\n filteredDataProvider?: IFilteredPresentationTreeDataProvider,\n hierarchyAutoUpdateEnabled?: boolean,\n) {\n const subjectModelIdsCache = useMemo(() => new SubjectModelIdsCache(iModel), [iModel]);\n\n const disposableVisibilityHandler = useDisposable(useCallback(\n () => {\n const visibilityHandlerProps: ModelsVisibilityHandlerProps = {\n rulesetId,\n viewport: activeView,\n hierarchyAutoUpdateEnabled,\n subjectModelIdsCache,\n };\n\n return typeof visibilityHandler === \"function\"\n ? visibilityHandler(visibilityHandlerProps)\n : new ModelsVisibilityHandler(visibilityHandlerProps);\n },\n [visibilityHandler, rulesetId, activeView, hierarchyAutoUpdateEnabled, subjectModelIdsCache])\n );\n\n const handler = typeof visibilityHandler === \"function\" || visibilityHandler === undefined\n ? disposableVisibilityHandler\n : visibilityHandler;\n\n useEffect(() => {\n handler && handler.setFilteredDataProvider(filteredDataProvider);\n }, [handler, filteredDataProvider]);\n\n return handler;\n}\n\nconst isFilteredDataProvider = (dataProvider: IPresentationTreeDataProvider | IFilteredPresentationTreeDataProvider): dataProvider is IFilteredPresentationTreeDataProvider => {\n const filteredProvider = dataProvider as IFilteredPresentationTreeDataProvider;\n return filteredProvider.nodeMatchesFilter !== undefined && filteredProvider.getActiveMatch !== undefined && filteredProvider.countFilteringResults !== undefined;\n};\n\nconst getFilteredDataProvider = (dataProvider: IPresentationTreeDataProvider | IFilteredPresentationTreeDataProvider): IFilteredPresentationTreeDataProvider | undefined => {\n return isFilteredDataProvider(dataProvider) ? dataProvider : undefined;\n};\n"]}
@@ -244,6 +244,7 @@ function createSearchRuleset(props) {
244
244
  {
245
245
  ...createRelatedNonHierarchySubjectSpecification(),
246
246
  hideExpression: `NOT ThisNode.HasChildren ANDALSO NOT ThisNode.ChildrenArtifacts.AnyMatches(x => x.isContentModel)`,
247
+ hideIfNoChildren: undefined,
247
248
  },
248
249
  ],
249
250
  customizationRules: [
@@ -273,7 +274,10 @@ function createSearchRuleset(props) {
273
274
  ruleType: "ChildNodes",
274
275
  condition: `ParentNode.IsOfClass("Subject", "BisCore")`,
275
276
  specifications: [
276
- createNonContentModelsSpecification(context),
277
+ {
278
+ ...createNonContentModelsSpecification(context),
279
+ hasChildren: "Unknown",
280
+ },
277
281
  ],
278
282
  customizationRules: [
279
283
  {
@@ -289,7 +293,10 @@ function createSearchRuleset(props) {
289
293
  ruleType: "ChildNodes",
290
294
  condition: `ParentNode.IsOfClass("Subject", "BisCore")`,
291
295
  specifications: [
292
- createContentModelsSpecification(context),
296
+ {
297
+ ...createContentModelsSpecification(context),
298
+ hasChildren: "Unknown",
299
+ },
293
300
  ],
294
301
  customizationRules: [
295
302
  {
@@ -1 +1 @@
1
- {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/Utils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,oEAAqD;AAOrD,gBAAgB;AAChB,MAAa,0BAA0B;IAErC,YAAoB,UAAsC;QAAtC,eAAU,GAAV,UAAU,CAA4B;QADlD,SAAI,GAAG,IAAI,KAAK,EAAc,CAAC;IAEvC,CAAC;IAEO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAE9D,KAAK,CAAA,CAAE,aAAa;QACzB,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE;YAC1B,MAAM,EAAE,CAAC;SACV;QAED,IAAI,MAAM,CAAC;QACX,OAAO,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,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aAAa,EAAyB;IAC5G,OAAO;QACL,QAAQ,EAAE,sBAAsB;QAChC,iBAAiB,EAAE;YACjB;gBACE,YAAY,EAAE;oBACZ,UAAU,EAAE,SAAS;oBACrB,SAAS,EAAE,0BAA0B;iBACtC;gBACD,SAAS,EAAE,SAAS;gBACpB,WAAW,EAAE,yBAAyB;aACvC;SACF;QACD,YAAY,EAAE,aAAa;QAC3B,YAAY,EAAE,KAAK;KACpB,CAAC;AACJ,CAAC;AAED,SAAS,iCAAiC,CAAC,EAAE,yBAAyB,EAAE,eAAe,EAAyB;IAC9G,MAAM,WAAW,GAAG,wEAAwE,yBAAyB,CAAC,UAAU,IAAI,yBAAyB,CAAC,SAAS,IAAI,CAAC;IAC5K,MAAM,cAAc,GAAG,qBAAqB,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,WAAW,EAAE,EAAE,CAAC;IAE3F,OAAO;QACL,QAAQ,EAAE,sBAAsB;QAChC,iBAAiB,EAAE;YACjB;gBACE,YAAY,EAAE;oBACZ,UAAU,EAAE,SAAS;oBACrB,SAAS,EAAE,mBAAmB;iBAC/B;gBACD,SAAS,EAAE,SAAS;gBACpB,WAAW,EAAE;oBACX,UAAU,EAAE,SAAS;oBACrB,SAAS,EAAE,kBAAkB;iBAC9B;aACF;SACF;QACD,cAAc;QACd,YAAY,EAAE,KAAK;QACnB,YAAY,EAAE,KAAK;KACpB,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,SAAgB,0BAA0B,CAAC,IAAsC,EAAE,IAAmB;IACpG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,IAAI,6BAAO,CAAC,sBAAsB,CAAC,IAAI,CAAC,GAAG,CAAC;QAC9D,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS;QAC9B,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC;AAC9B,CAAC;AAJD,gEAIC","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 { NodeKey } from \"@itwin/presentation-common\";\n\nimport type { Id64String } from \"@itwin/core-bentley\";\nimport type { ChildNodeSpecification, Node, Ruleset, SingleSchemaClassSpecification } from \"@itwin/presentation-common\";\nimport type { DelayLoadedTreeNodeItem } from \"@itwin/components-react\";\nimport type { ModelsTreeHierarchyConfiguration } from \"./ModelsTree\";\n\n/** @internal */\nexport class CachingElementIdsContainer {\n private _ids = new Array<Id64String>();\n constructor(private _generator: AsyncGenerator<Id64String>) {\n }\n\n private async next() { return (await this._generator.next()).value; }\n\n public async* getElementIds() {\n for (const id of this._ids) {\n yield id;\n }\n\n let nextId;\n while (nextId = await this.next()) {\n this._ids.push(nextId);\n yield nextId;\n }\n }\n}\n\n/** @internal */\nexport type CreateRulesetProps = Omit<ModelsTreeHierarchyConfiguration, \"enableElementsClassGrouping\"> & {\n enableElementsClassGrouping?: boolean;\n};\n\n/** @internal */\nexport function createRuleset(props: CreateRulesetProps): Ruleset {\n const context: SpecificationsContext = {\n elementClassSpecification: props.elementClassSpecification ?? { schemaName: \"BisCore\", className: \"GeometricElement3d\" },\n groupElements: !!props.enableElementsClassGrouping,\n showEmptyModels: !!props.showEmptyModels,\n };\n\n return {\n id: \"tree-widget-react/ModelsTree\",\n requiredSchemas: [\n {\n name: \"BisCore\",\n },\n ],\n rules: [\n {\n ruleType: \"RootNodes\",\n autoExpand: true,\n specifications: [\n createRootSubjectSpecification(),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: \"\\\"icon-imodel-hollow-2\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createRelatedHierarchySubjectSpecification(),\n createRelatedNonHierarchySubjectSpecification(),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: \"\\\"icon-folder\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createNonContentModelsSpecification(context),\n createContentModelsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"ISubModeledElement\", \"BisCore\")`,\n specifications: [\n createElementModelSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricModel3d\", \"BisCore\")`,\n specifications: [\n createModelCategoriesSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isCategory: \"true\",\n modelId: \"ParentNode.InstanceId\",\n icon: \"\\\"icon-layers\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"SpatialCategory\", \"BisCore\")`,\n specifications: [\n createCategoryElementsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n modelId: \"this.Model.Id\",\n categoryId: \"this.Category.Id\",\n icon: \"\\\"icon-item\\\"\",\n groupIcon: \"\\\"icon-ec-class\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricElement3d\", \"BisCore\")`,\n specifications: [\n createEementElementsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n modelId: \"this.Model.Id\",\n categoryId: \"this.Category.Id\",\n icon: \"\\\"icon-item\\\"\",\n groupIcon: \"\\\"icon-ec-class\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"SpatialCategory\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n {\n ruleType: \"Content\",\n condition: `ContentDisplayType = \"AssemblyElementsRequest\"`,\n specifications: [\n {\n specType: \"SelectedNodeInstances\",\n },\n {\n specType: \"ContentRelatedInstances\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ElementOwnsChildElements\",\n },\n direction: \"Forward\",\n count: \"*\",\n },\n ],\n },\n ],\n },\n ],\n };\n}\n\n/** @internal */\nexport type CreateSearchRulesetProps = Omit<ModelsTreeHierarchyConfiguration, \"enableElementsClassGrouping\">;\n\n/** @internal */\nexport function createSearchRuleset(props: CreateSearchRulesetProps): Ruleset {\n const context: SpecificationsContext = {\n elementClassSpecification: props.elementClassSpecification ?? { schemaName: \"BisCore\", className: \"GeometricElement3d\" },\n groupElements: false,\n showEmptyModels: !!props.showEmptyModels,\n };\n\n return {\n id: \"tree-widget-react/ModelsTreeSearch\",\n rules: [\n {\n ruleType: \"RootNodes\",\n specifications: [\n createRootSubjectSpecification(),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: \"\\\"icon-imodel-hollow-2\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createRelatedHierarchySubjectSpecification(),\n {\n ...createRelatedNonHierarchySubjectSpecification(),\n hideExpression: `NOT ThisNode.HasChildren ANDALSO NOT ThisNode.ChildrenArtifacts.AnyMatches(x => x.isContentModel)`,\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: \"\\\"icon-folder\\\"\",\n },\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createNonContentModelsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createContentModelsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"NodeArtifacts\",\n items: {\n isContentModel: \"true\",\n },\n },\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricModel3d\", \"BisCore\")`,\n specifications: [\n createModelSubModelsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n ],\n };\n}\n\ninterface SpecificationsContext {\n elementClassSpecification: SingleSchemaClassSpecification;\n groupElements: boolean;\n showEmptyModels: boolean;\n}\n\nfunction createRootSubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: [\n {\n schemaName: \"BisCore\",\n classNames: [\n \"Subject\",\n ],\n },\n ],\n instanceFilter: `this.Parent = NULL`,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createRelatedHierarchySubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"SubjectOwnsSubjects\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n },\n ],\n instanceFilter: `json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") <> NULL OR ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") = \"Hierarchy\"`,\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createRelatedNonHierarchySubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"SubjectOwnsSubjects\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n },\n ],\n instanceFilter: `json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") = NULL AND ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") <> \"Hierarchy\"`,\n hideIfNoChildren: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createNonContentModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const partitionFilter = `parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)`;\n const modelHasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n\n const hasNoContent = `json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") = NULL AND json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") = NULL`;\n const instanceFilter = `(${partitionFilter}) AND NOT this.IsPrivate AND ${hasNoContent}${showEmptyModels ? \"\" : ` AND ${modelHasElements}`}`;\n\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: {\n schemaName: \"BisCore\",\n classNames: [\n \"GeometricModel3d\",\n ],\n arePolymorphic: true,\n },\n relatedInstances: [\n {\n relationshipPath: {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"InformationPartitionElement\",\n },\n },\n alias: \"partition\",\n isRequired: true,\n },\n ],\n instanceFilter,\n hasChildren: showEmptyModels ? \"Unknown\" : \"Always\",\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createContentModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const partitionFilter = `parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)`;\n const modelHasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n\n const hasContent = `json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") <> NULL OR json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") <> NULL`;\n const instanceFilter = `(${partitionFilter}) AND NOT this.IsPrivate AND (${hasContent})${showEmptyModels ? \"\" : ` AND ${modelHasElements}`}`;\n\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: {\n schemaName: \"BisCore\",\n classNames: [\"GeometricModel3d\"],\n arePolymorphic: true,\n },\n relatedInstances: [\n {\n relationshipPath: {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"InformationPartitionElement\",\n },\n },\n alias: \"partition\",\n isRequired: true,\n },\n ],\n instanceFilter,\n hasChildren: showEmptyModels ? \"Unknown\" : \"Always\",\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createElementModelSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const hasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n const instanceFilter = `NOT this.IsPrivate${showEmptyModels ? \"\" : ` AND ${hasElements}`}`;\n\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Backward\",\n },\n ],\n instanceFilter,\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createModelCategoriesSpecification({ elementClassSpecification }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelContainsElements\",\n },\n direction: \"Forward\",\n targetClass: elementClassSpecification,\n },\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"GeometricElement3dIsInCategory\",\n },\n direction: \"Forward\",\n },\n ],\n ],\n instanceFilter: `NOT this.IsPrivate`,\n suppressSimilarAncestorsCheck: true,\n hideIfNoChildren: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createCategoryElementsSpecification({ elementClassSpecification, groupElements }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"GeometricElement3dIsInCategory\",\n },\n direction: \"Backward\",\n targetClass: elementClassSpecification,\n },\n ],\n instanceFilter: `this.Model.Id = parent.parent.ECInstanceId ANDALSO this.Parent = NULL`,\n groupByClass: groupElements,\n groupByLabel: false,\n };\n}\n\nfunction createEementElementsSpecification({ elementClassSpecification, groupElements }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ElementOwnsChildElements\",\n },\n direction: \"Forward\",\n targetClass: elementClassSpecification,\n },\n ],\n groupByClass: groupElements,\n groupByLabel: false,\n };\n}\n\nfunction createModelSubModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const hasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n const instanceFilter = `NOT this.IsPrivate${showEmptyModels ? \"\" : ` AND ${hasElements}`}`;\n\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelOwnsSubModel\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"GeometricModel3d\",\n },\n },\n ],\n instanceFilter,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\n/** @internal */\nexport function addModelsTreeNodeItemIcons(item: Partial<DelayLoadedTreeNodeItem>, node: Partial<Node>) {\n item.icon = node.key && NodeKey.isClassGroupingNodeKey(node.key)\n ? node.extendedData?.groupIcon\n : node.extendedData?.icon;\n}\n"]}
1
+ {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/Utils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,oEAAqD;AAOrD,gBAAgB;AAChB,MAAa,0BAA0B;IAErC,YAAoB,UAAsC;QAAtC,eAAU,GAAV,UAAU,CAA4B;QADlD,SAAI,GAAG,IAAI,KAAK,EAAc,CAAC;IAEvC,CAAC;IAEO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAE9D,KAAK,CAAA,CAAE,aAAa;QACzB,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE;YAC1B,MAAM,EAAE,CAAC;SACV;QAED,IAAI,MAAM,CAAC;QACX,OAAO,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,EAA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,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC;AAC9B,CAAC;AAJD,gEAIC","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 { NodeKey } from \"@itwin/presentation-common\";\n\nimport type { Id64String } from \"@itwin/core-bentley\";\nimport type { ChildNodeSpecification, Node, Ruleset, SingleSchemaClassSpecification } from \"@itwin/presentation-common\";\nimport type { DelayLoadedTreeNodeItem } from \"@itwin/components-react\";\nimport type { ModelsTreeHierarchyConfiguration } from \"./ModelsTree\";\n\n/** @internal */\nexport class CachingElementIdsContainer {\n private _ids = new Array<Id64String>();\n constructor(private _generator: AsyncGenerator<Id64String>) {\n }\n\n private async next() { return (await this._generator.next()).value; }\n\n public async* getElementIds() {\n for (const id of this._ids) {\n yield id;\n }\n\n let nextId;\n while (nextId = await this.next()) {\n this._ids.push(nextId);\n yield nextId;\n }\n }\n}\n\n/** @internal */\nexport type CreateRulesetProps = Omit<ModelsTreeHierarchyConfiguration, \"enableElementsClassGrouping\"> & {\n enableElementsClassGrouping?: boolean;\n};\n\n/** @internal */\nexport function createRuleset(props: CreateRulesetProps): Ruleset {\n const context: SpecificationsContext = {\n elementClassSpecification: props.elementClassSpecification ?? { schemaName: \"BisCore\", className: \"GeometricElement3d\" },\n groupElements: !!props.enableElementsClassGrouping,\n showEmptyModels: !!props.showEmptyModels,\n };\n\n return {\n id: \"tree-widget-react/ModelsTree\",\n requiredSchemas: [\n {\n name: \"BisCore\",\n },\n ],\n rules: [\n {\n ruleType: \"RootNodes\",\n autoExpand: true,\n specifications: [\n createRootSubjectSpecification(),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: \"\\\"icon-imodel-hollow-2\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createRelatedHierarchySubjectSpecification(),\n createRelatedNonHierarchySubjectSpecification(),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: \"\\\"icon-folder\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createNonContentModelsSpecification(context),\n createContentModelsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"ISubModeledElement\", \"BisCore\")`,\n specifications: [\n createElementModelSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricModel3d\", \"BisCore\")`,\n specifications: [\n createModelCategoriesSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isCategory: \"true\",\n modelId: \"ParentNode.InstanceId\",\n icon: \"\\\"icon-layers\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"SpatialCategory\", \"BisCore\")`,\n specifications: [\n createCategoryElementsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n modelId: \"this.Model.Id\",\n categoryId: \"this.Category.Id\",\n icon: \"\\\"icon-item\\\"\",\n groupIcon: \"\\\"icon-ec-class\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricElement3d\", \"BisCore\")`,\n specifications: [\n createEementElementsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n modelId: \"this.Model.Id\",\n categoryId: \"this.Category.Id\",\n icon: \"\\\"icon-item\\\"\",\n groupIcon: \"\\\"icon-ec-class\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"SpatialCategory\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n {\n ruleType: \"Content\",\n condition: `ContentDisplayType = \"AssemblyElementsRequest\"`,\n specifications: [\n {\n specType: \"SelectedNodeInstances\",\n },\n {\n specType: \"ContentRelatedInstances\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ElementOwnsChildElements\",\n },\n direction: \"Forward\",\n count: \"*\",\n },\n ],\n },\n ],\n },\n ],\n };\n}\n\n/** @internal */\nexport type CreateSearchRulesetProps = Omit<ModelsTreeHierarchyConfiguration, \"enableElementsClassGrouping\">;\n\n/** @internal */\nexport function createSearchRuleset(props: CreateSearchRulesetProps): Ruleset {\n const context: SpecificationsContext = {\n elementClassSpecification: props.elementClassSpecification ?? { schemaName: \"BisCore\", className: \"GeometricElement3d\" },\n groupElements: false,\n showEmptyModels: !!props.showEmptyModels,\n };\n\n return {\n id: \"tree-widget-react/ModelsTreeSearch\",\n rules: [\n {\n ruleType: \"RootNodes\",\n specifications: [\n createRootSubjectSpecification(),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: \"\\\"icon-imodel-hollow-2\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createRelatedHierarchySubjectSpecification(),\n {\n ...createRelatedNonHierarchySubjectSpecification(),\n hideExpression: `NOT ThisNode.HasChildren ANDALSO NOT ThisNode.ChildrenArtifacts.AnyMatches(x => x.isContentModel)`,\n hideIfNoChildren: undefined,\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: \"\\\"icon-folder\\\"\",\n },\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n {\n ...createNonContentModelsSpecification(context),\n hasChildren: \"Unknown\",\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n {\n ...createContentModelsSpecification(context),\n hasChildren: \"Unknown\",\n },\n ],\n customizationRules: [\n {\n ruleType: \"NodeArtifacts\",\n items: {\n isContentModel: \"true\",\n },\n },\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricModel3d\", \"BisCore\")`,\n specifications: [\n createModelSubModelsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n ],\n };\n}\n\ninterface SpecificationsContext {\n elementClassSpecification: SingleSchemaClassSpecification;\n groupElements: boolean;\n showEmptyModels: boolean;\n}\n\nfunction createRootSubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: [\n {\n schemaName: \"BisCore\",\n classNames: [\n \"Subject\",\n ],\n },\n ],\n instanceFilter: `this.Parent = NULL`,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createRelatedHierarchySubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"SubjectOwnsSubjects\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n },\n ],\n instanceFilter: `json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") <> NULL OR ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") = \"Hierarchy\"`,\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createRelatedNonHierarchySubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"SubjectOwnsSubjects\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n },\n ],\n instanceFilter: `json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") = NULL AND ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") <> \"Hierarchy\"`,\n hideIfNoChildren: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createNonContentModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const partitionFilter = `parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)`;\n const modelHasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n\n const hasNoContent = `json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") = NULL AND json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") = NULL`;\n const instanceFilter = `(${partitionFilter}) AND NOT this.IsPrivate AND ${hasNoContent}${showEmptyModels ? \"\" : ` AND ${modelHasElements}`}`;\n\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: {\n schemaName: \"BisCore\",\n classNames: [\n \"GeometricModel3d\",\n ],\n arePolymorphic: true,\n },\n relatedInstances: [\n {\n relationshipPath: {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"InformationPartitionElement\",\n },\n },\n alias: \"partition\",\n isRequired: true,\n },\n ],\n instanceFilter,\n hasChildren: showEmptyModels ? \"Unknown\" : \"Always\",\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createContentModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const partitionFilter = `parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)`;\n const modelHasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n\n const hasContent = `json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") <> NULL OR json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") <> NULL`;\n const instanceFilter = `(${partitionFilter}) AND NOT this.IsPrivate AND (${hasContent})${showEmptyModels ? \"\" : ` AND ${modelHasElements}`}`;\n\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: {\n schemaName: \"BisCore\",\n classNames: [\"GeometricModel3d\"],\n arePolymorphic: true,\n },\n relatedInstances: [\n {\n relationshipPath: {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"InformationPartitionElement\",\n },\n },\n alias: \"partition\",\n isRequired: true,\n },\n ],\n instanceFilter,\n hasChildren: showEmptyModels ? \"Unknown\" : \"Always\",\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createElementModelSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const hasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n const instanceFilter = `NOT this.IsPrivate${showEmptyModels ? \"\" : ` AND ${hasElements}`}`;\n\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Backward\",\n },\n ],\n instanceFilter,\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createModelCategoriesSpecification({ elementClassSpecification }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelContainsElements\",\n },\n direction: \"Forward\",\n targetClass: elementClassSpecification,\n },\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"GeometricElement3dIsInCategory\",\n },\n direction: \"Forward\",\n },\n ],\n ],\n instanceFilter: `NOT this.IsPrivate`,\n suppressSimilarAncestorsCheck: true,\n hideIfNoChildren: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createCategoryElementsSpecification({ elementClassSpecification, groupElements }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"GeometricElement3dIsInCategory\",\n },\n direction: \"Backward\",\n targetClass: elementClassSpecification,\n },\n ],\n instanceFilter: `this.Model.Id = parent.parent.ECInstanceId ANDALSO this.Parent = NULL`,\n groupByClass: groupElements,\n groupByLabel: false,\n };\n}\n\nfunction createEementElementsSpecification({ elementClassSpecification, groupElements }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ElementOwnsChildElements\",\n },\n direction: \"Forward\",\n targetClass: elementClassSpecification,\n },\n ],\n groupByClass: groupElements,\n groupByLabel: false,\n };\n}\n\nfunction createModelSubModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const hasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n const instanceFilter = `NOT this.IsPrivate${showEmptyModels ? \"\" : ` AND ${hasElements}`}`;\n\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelOwnsSubModel\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"GeometricModel3d\",\n },\n },\n ],\n instanceFilter,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\n/** @internal */\nexport function addModelsTreeNodeItemIcons(item: Partial<DelayLoadedTreeNodeItem>, node: Partial<Node>) {\n item.icon = node.key && NodeKey.isClassGroupingNodeKey(node.key)\n ? node.extendedData?.groupIcon\n : node.extendedData?.icon;\n}\n"]}
@@ -29,7 +29,7 @@ export const IModelContentTree = (props) => {
29
29
  });
30
30
  const eventHandler = useTreeEventsHandler(useMemo(() => ({ nodeLoader, modelSource: nodeLoader.modelSource }), [nodeLoader]));
31
31
  const treeModel = useTreeModel(nodeLoader.modelSource);
32
- return (_jsx("div", { className: "tree-widget-tree-container", children: _jsx(ControlledTree, { width: width, height: height, nodeLoader: nodeLoader, selectionMode: selectionMode ?? SelectionMode.None, eventsHandler: eventHandler, model: treeModel, iconsEnabled: true, treeRenderer: (treeProps) => _jsx(TreeRenderer, { ...treeProps, contextMenuItems: contextMenuItems, nodeLabelRenderer: props.nodeLabelRenderer, density: props.density }) }) }));
32
+ return (_jsx("div", { className: "tree-widget-tree-container", children: _jsx(ControlledTree, { width: width, height: height, nodeLoader: nodeLoader, selectionMode: selectionMode ?? SelectionMode.None, eventsHandler: eventHandler, model: treeModel, treeRenderer: (treeProps) => _jsx(TreeRenderer, { ...treeProps, contextMenuItems: contextMenuItems, nodeLabelRenderer: props.nodeLabelRenderer, density: props.density }) }) }));
33
33
  };
34
34
  const customizeTreeNodeItem = combineTreeNodeItemCustomizations([
35
35
  addCustomTreeNodeItemLabelRenderer,
@@ -1 +1 @@
1
- {"version":3,"file":"IModelContentTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/imodel-content-tree/IModelContentTree.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5G,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,kCAAkC,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AAKxG;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAY,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC,yDAAyD;AAQzI;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAA6B,EAAE,EAAE;IACjE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC;IAEzE,MAAM,EAAE,UAAU,EAAE,GAAG,6BAA6B,CAAC;QACnD,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,sBAAsB;QAC/B,UAAU,EAAE,EAAE;QACd,mCAAmC,EAAE,IAAI;QACzC,qBAAqB;KACtB,CAAC,CAAC;IACH,MAAM,YAAY,GAAG,oBAAoB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAE9H,MAAM,SAAS,GAAG,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAEvD,OAAO,CACL,cAAK,SAAS,EAAC,4BAA4B,YACzC,KAAC,cAAc,IACb,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,aAAa,EAAE,aAAa,IAAI,aAAa,CAAC,IAAI,EAClD,aAAa,EAAE,YAAY,EAC3B,KAAK,EAAE,SAAS,EAChB,YAAY,EAAE,IAAI,EAClB,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAC1B,KAAC,YAAY,OACP,SAAS,EACb,gBAAgB,EAAE,gBAAgB,EAClC,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,EAC1C,OAAO,EAAE,KAAK,CAAC,OAAO,GACtB,GAEJ,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,iCAAiC,CAAC;IAC9D,kCAAkC;CACnC,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 { useMemo } from \"react\";\nimport { ControlledTree, SelectionMode, useTreeEventsHandler, useTreeModel } from \"@itwin/components-react\";\nimport { usePresentationTreeNodeLoader } from \"@itwin/presentation-components\";\nimport { TreeRenderer } from \"../common/TreeRenderer\";\nimport { addCustomTreeNodeItemLabelRenderer, combineTreeNodeItemCustomizations } from \"../common/Utils\";\n\nimport type { Ruleset } from \"@itwin/presentation-common\";\nimport type { BaseTreeProps } from \"../common/Types\";\n\n/**\n * Presentation rules used by IModelContentTree\n * @internal\n */\nexport const RULESET_IMODEL_CONTENT: Ruleset = require(\"./IModelContent.json\"); // eslint-disable-line @typescript-eslint/no-var-requires\n\n/**\n * Props for [[IModelContentTree]].\n * @public\n */\nexport type IModelContentTreeProps = BaseTreeProps;\n\n/**\n * A tree that shows all iModel content starting from the root Subject, then the hierarchy of child\n * Subjects, their Models and Elements contained in those Models.\n * @public\n */\nexport const IModelContentTree = (props: IModelContentTreeProps) => {\n const { iModel, width, height, selectionMode, contextMenuItems } = props;\n\n const { nodeLoader } = usePresentationTreeNodeLoader({\n imodel: iModel,\n ruleset: RULESET_IMODEL_CONTENT,\n pagingSize: 20,\n appendChildrenCountForGroupingNodes: true,\n customizeTreeNodeItem,\n });\n const eventHandler = useTreeEventsHandler(useMemo(() => ({ nodeLoader, modelSource: nodeLoader.modelSource }), [nodeLoader]));\n\n const treeModel = useTreeModel(nodeLoader.modelSource);\n\n return (\n <div className=\"tree-widget-tree-container\">\n <ControlledTree\n width={width}\n height={height}\n nodeLoader={nodeLoader}\n selectionMode={selectionMode ?? SelectionMode.None}\n eventsHandler={eventHandler}\n model={treeModel}\n iconsEnabled={true}\n treeRenderer={(treeProps) =>\n <TreeRenderer\n {...treeProps}\n contextMenuItems={contextMenuItems}\n nodeLabelRenderer={props.nodeLabelRenderer}\n density={props.density}\n />\n }\n />\n </div>\n );\n};\n\nconst customizeTreeNodeItem = combineTreeNodeItemCustomizations([\n addCustomTreeNodeItemLabelRenderer,\n]);\n"]}
1
+ {"version":3,"file":"IModelContentTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/imodel-content-tree/IModelContentTree.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5G,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;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GACtB,GAEJ,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,iCAAiC,CAAC;IAC9D,kCAAkC;CACnC,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 { useMemo } from \"react\";\nimport { ControlledTree, SelectionMode, useTreeEventsHandler, useTreeModel } from \"@itwin/components-react\";\nimport { usePresentationTreeNodeLoader } from \"@itwin/presentation-components\";\nimport { TreeRenderer } from \"../common/TreeRenderer\";\nimport { addCustomTreeNodeItemLabelRenderer, combineTreeNodeItemCustomizations } from \"../common/Utils\";\n\nimport type { Ruleset } from \"@itwin/presentation-common\";\nimport type { BaseTreeProps } from \"../common/Types\";\n\n/**\n * Presentation rules used by IModelContentTree\n * @internal\n */\nexport const RULESET_IMODEL_CONTENT: Ruleset = require(\"./IModelContent.json\"); // eslint-disable-line @typescript-eslint/no-var-requires\n\n/**\n * Props for [[IModelContentTree]].\n * @public\n */\nexport type IModelContentTreeProps = BaseTreeProps;\n\n/**\n * A tree that shows all iModel content starting from the root Subject, then the hierarchy of child\n * Subjects, their Models and Elements contained in those Models.\n * @public\n */\nexport const IModelContentTree = (props: IModelContentTreeProps) => {\n const { iModel, width, height, selectionMode, contextMenuItems } = props;\n\n const { nodeLoader } = usePresentationTreeNodeLoader({\n imodel: iModel,\n ruleset: RULESET_IMODEL_CONTENT,\n pagingSize: 20,\n appendChildrenCountForGroupingNodes: true,\n customizeTreeNodeItem,\n });\n const eventHandler = useTreeEventsHandler(useMemo(() => ({ nodeLoader, modelSource: nodeLoader.modelSource }), [nodeLoader]));\n\n const treeModel = useTreeModel(nodeLoader.modelSource);\n\n return (\n <div className=\"tree-widget-tree-container\">\n <ControlledTree\n width={width}\n height={height}\n nodeLoader={nodeLoader}\n selectionMode={selectionMode ?? SelectionMode.None}\n eventsHandler={eventHandler}\n model={treeModel}\n treeRenderer={(treeProps) =>\n <TreeRenderer\n {...treeProps}\n contextMenuItems={contextMenuItems}\n nodeLabelRenderer={props.nodeLabelRenderer}\n density={props.density}\n />\n }\n />\n </div>\n );\n};\n\nconst customizeTreeNodeItem = combineTreeNodeItemCustomizations([\n addCustomTreeNodeItemLabelRenderer,\n]);\n"]}
@@ -5,7 +5,7 @@ import { ModelsVisibilityHandler } from "./ModelsVisibilityHandler";
5
5
  import type { SingleSchemaClassSpecification } from "@itwin/presentation-common";
6
6
  import type { Viewport } from "@itwin/core-frontend";
7
7
  import type { BaseFilterableTreeProps } from "../common/Types";
8
- import type { ModelsTreeSelectionPredicate } from "./ModelsVisibilityHandler";
8
+ import type { ModelsTreeSelectionPredicate, ModelsVisibilityHandlerProps } from "./ModelsVisibilityHandler";
9
9
  /**
10
10
  * Props for configuring the hierarchy in [[ModelsTree]].
11
11
  * @public
@@ -46,7 +46,7 @@ export interface ModelsTreeProps extends BaseFilterableTreeProps {
46
46
  /**
47
47
  * Custom visibility handler.
48
48
  */
49
- modelsVisibilityHandler?: ModelsVisibilityHandler;
49
+ modelsVisibilityHandler?: ModelsVisibilityHandler | ((props: ModelsVisibilityHandlerProps) => ModelsVisibilityHandler);
50
50
  }
51
51
  /**
52
52
  * A tree component that shows a subject - model - category - element
@@ -94,8 +94,20 @@ function useModelsTreeNodeLoader(props) {
94
94
  }
95
95
  function useVisibilityHandler(rulesetId, iModel, activeView, visibilityHandler, filteredDataProvider, hierarchyAutoUpdateEnabled) {
96
96
  const subjectModelIdsCache = useMemo(() => new SubjectModelIdsCache(iModel), [iModel]);
97
- const defaultVisibilityHandler = useDisposable(useCallback(() => new ModelsVisibilityHandler({ rulesetId, viewport: activeView, hierarchyAutoUpdateEnabled, subjectModelIdsCache }), [rulesetId, activeView, subjectModelIdsCache, hierarchyAutoUpdateEnabled]));
98
- const handler = visibilityHandler ?? defaultVisibilityHandler;
97
+ const disposableVisibilityHandler = useDisposable(useCallback(() => {
98
+ const visibilityHandlerProps = {
99
+ rulesetId,
100
+ viewport: activeView,
101
+ hierarchyAutoUpdateEnabled,
102
+ subjectModelIdsCache,
103
+ };
104
+ return typeof visibilityHandler === "function"
105
+ ? visibilityHandler(visibilityHandlerProps)
106
+ : new ModelsVisibilityHandler(visibilityHandlerProps);
107
+ }, [visibilityHandler, rulesetId, activeView, hierarchyAutoUpdateEnabled, subjectModelIdsCache]));
108
+ const handler = typeof visibilityHandler === "function" || visibilityHandler === undefined
109
+ ? disposableVisibilityHandler
110
+ : visibilityHandler;
99
111
  useEffect(() => {
100
112
  handler && handler.setFilteredDataProvider(filteredDataProvider);
101
113
  }, [handler, filteredDataProvider]);
@@ -1 +1 @@
1
- {"version":3,"file":"ModelsTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/ModelsTree.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAE/F,OAAO,4BAA4B,CAAC;AACpC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,0BAA0B,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC3G,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,kCAAkC,EAAE,uBAAuB,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AACjI,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACnI,OAAO,EAAE,uBAAuB,EA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,GAAG,CAAC,YAAmF,EAAyD,EAAE;IAC5K,MAAM,gBAAgB,GAAG,YAAqD,CAAC;IAC/E,OAAO,gBAAgB,CAAC,iBAAiB,KAAK,SAAS,IAAI,gBAAgB,CAAC,cAAc,KAAK,SAAS,IAAI,gBAAgB,CAAC,qBAAqB,KAAK,SAAS,CAAC;AACnK,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAAC,YAAmF,EAAqD,EAAE;IACzK,OAAO,sBAAsB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;AACzE,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 \"../VisibilityTreeBase.scss\";\nimport classNames from \"classnames\";\nimport { useCallback, useEffect, useMemo } from \"react\";\nimport { ControlledTree, SelectionMode, useTreeModel } from \"@itwin/components-react\";\nimport { useDisposable } from \"@itwin/core-react\";\nimport { isPresentationTreeNodeItem, usePresentationTreeNodeLoader } from \"@itwin/presentation-components\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { ClassGroupingOption } from \"../common/Types\";\nimport { addCustomTreeNodeItemLabelRenderer, addTreeNodeItemCheckbox, combineTreeNodeItemCustomizations } from \"../common/Utils\";\nimport { VisibilityTreeEventHandler } from \"../VisibilityTreeEventHandler\";\nimport { createVisibilityTreeRenderer, useVisibilityTreeFiltering, VisibilityTreeNoFilteredData } from \"../VisibilityTreeRenderer\";\nimport { ModelsVisibilityHandler, SubjectModelIdsCache } from \"./ModelsVisibilityHandler\";\nimport { addModelsTreeNodeItemIcons, createRuleset, createSearchRuleset } from \"./Utils\";\n\nimport type { SingleSchemaClassSpecification } from \"@itwin/presentation-common\";\nimport type { IModelConnection, Viewport } from \"@itwin/core-frontend\";\nimport type { IFilteredPresentationTreeDataProvider, IPresentationTreeDataProvider } from \"@itwin/presentation-components\";\nimport type { BaseFilterableTreeProps } from \"../common/Types\";\nimport type { ModelsTreeSelectionPredicate } from \"./ModelsVisibilityHandler\";\n\nconst PAGING_SIZE = 20;\n\n/**\n * Props for configuring the hierarchy in [[ModelsTree]].\n * @public\n */\nexport interface ModelsTreeHierarchyConfiguration {\n /** Should the tree group displayed element nodes by class. Defaults to `ClassGroupingOption.No`. */\n enableElementsClassGrouping?: ClassGroupingOption;\n /**\n * Defines the `bis.GeometricElement3d` sub-class that should be used to load element nodes.\n * Defaults to `bis.GeometricElement3d`. It's expected for the given class to derive from it.\n */\n elementClassSpecification?: SingleSchemaClassSpecification;\n /** Should the tree show models without elements. */\n showEmptyModels?: boolean;\n}\n\n/**\n * Props for [[ModelsTree]] component.\n * @public\n */\nexport interface ModelsTreeProps extends BaseFilterableTreeProps {\n /**\n * Predicate which indicates whether node can be selected or no\n */\n selectionPredicate?: ModelsTreeSelectionPredicate;\n /**\n * Active view used to determine and control visibility\n */\n activeView: Viewport;\n /**\n * Configuration options for the hierarchy loaded in the component.\n */\n hierarchyConfig?: ModelsTreeHierarchyConfiguration;\n /**\n * Auto-update the hierarchy when data in the iModel changes.\n * @alpha\n */\n enableHierarchyAutoUpdate?: boolean;\n /**\n * Custom visibility handler.\n */\n modelsVisibilityHandler?: ModelsVisibilityHandler;\n}\n\n/**\n * A tree component that shows a subject - model - category - element\n * hierarchy along with checkboxes that represent and allow changing\n * the display of those instances.\n * @public\n */\nexport function ModelsTree(props: ModelsTreeProps) {\n const { nodeLoader, onItemsRendered } = useModelsTreeNodeLoader(props);\n const { filteredNodeLoader, isFiltering, nodeHighlightingProps } = useVisibilityTreeFiltering(nodeLoader, props.filterInfo, props.onFilterApplied);\n const filterApplied = filteredNodeLoader !== nodeLoader;\n\n const { activeView, modelsVisibilityHandler, selectionPredicate } = props;\n\n const visibilityHandler = useVisibilityHandler(\n nodeLoader.dataProvider.rulesetId,\n props.iModel,\n activeView,\n modelsVisibilityHandler,\n getFilteredDataProvider(filteredNodeLoader.dataProvider),\n props.enableHierarchyAutoUpdate);\n const eventHandler = useDisposable(useCallback(() => new VisibilityTreeEventHandler({\n nodeLoader: filteredNodeLoader,\n visibilityHandler,\n selectionPredicate: (node) => !selectionPredicate || !isPresentationTreeNodeItem(node) ? true : selectionPredicate(node.key, ModelsVisibilityHandler.getNodeType(node)),\n }), [filteredNodeLoader, visibilityHandler, selectionPredicate]));\n\n const treeModel = useTreeModel(filteredNodeLoader.modelSource);\n const treeRenderer = createVisibilityTreeRenderer({\n contextMenuItems: props.contextMenuItems,\n nodeLabelRenderer: props.nodeLabelRenderer,\n density: props.density,\n nodeRendererProps: {\n iconsEnabled: true,\n descriptionEnabled: false,\n levelOffset: 10,\n disableRootNodeCollapse: true,\n },\n });\n\n const overlay = isFiltering ? <div className=\"filteredTreeOverlay\" /> : undefined;\n\n // istanbul ignore next\n const noFilteredDataRenderer = useCallback(() => {\n return <VisibilityTreeNoFilteredData\n title={TreeWidget.translate(\"modelTree.noModelFound\")}\n message={TreeWidget.translate(\"modelTree.noMatchingModelNames\")}\n />;\n }, []);\n\n return (\n <div className={classNames(\"tree-widget-visibility-tree-base\", \"tree-widget-tree-container\")}>\n <ControlledTree\n nodeLoader={filteredNodeLoader}\n model={treeModel}\n selectionMode={props.selectionMode || SelectionMode.None}\n eventsHandler={eventHandler}\n treeRenderer={treeRenderer}\n nodeHighlightingProps={nodeHighlightingProps}\n noDataRenderer={filterApplied ? noFilteredDataRenderer : undefined}\n onItemsRendered={onItemsRendered}\n width={props.width}\n height={props.height}\n />\n {overlay}\n </div>\n );\n}\n\nconst customizeTreeNodeItem = combineTreeNodeItemCustomizations([\n addCustomTreeNodeItemLabelRenderer,\n addTreeNodeItemCheckbox,\n addModelsTreeNodeItemIcons,\n]);\n\nfunction useModelsTreeNodeLoader(props: ModelsTreeProps) {\n const rulesets = {\n general: useMemo(() => createRuleset({\n enableElementsClassGrouping: !!props.hierarchyConfig?.enableElementsClassGrouping,\n elementClassSpecification: props.hierarchyConfig?.elementClassSpecification,\n showEmptyModels: props.hierarchyConfig?.showEmptyModels,\n }), [props.hierarchyConfig?.enableElementsClassGrouping, props.hierarchyConfig?.elementClassSpecification, props.hierarchyConfig?.showEmptyModels]),\n search: useMemo(() => createSearchRuleset({\n elementClassSpecification: props.hierarchyConfig?.elementClassSpecification,\n showEmptyModels: props.hierarchyConfig?.showEmptyModels,\n }), [props.hierarchyConfig?.elementClassSpecification, props.hierarchyConfig?.showEmptyModels]),\n };\n\n const { nodeLoader, onItemsRendered } = usePresentationTreeNodeLoader({\n imodel: props.iModel,\n ruleset: rulesets.general,\n appendChildrenCountForGroupingNodes: (props.hierarchyConfig?.enableElementsClassGrouping === ClassGroupingOption.YesWithCounts),\n pagingSize: PAGING_SIZE,\n enableHierarchyAutoUpdate: props.enableHierarchyAutoUpdate,\n customizeTreeNodeItem,\n });\n const { nodeLoader: searchNodeLoader, onItemsRendered: onSearchItemsRendered } = usePresentationTreeNodeLoader({\n imodel: props.iModel,\n ruleset: rulesets.search,\n pagingSize: PAGING_SIZE,\n enableHierarchyAutoUpdate: props.enableHierarchyAutoUpdate,\n customizeTreeNodeItem,\n });\n\n const activeNodeLoader = props.filterInfo?.filter ? searchNodeLoader : nodeLoader;\n const activeItemsRenderedCallback = props.filterInfo?.filter ? onSearchItemsRendered : onItemsRendered;\n\n return {\n nodeLoader: activeNodeLoader,\n onItemsRendered: activeItemsRenderedCallback,\n };\n}\n\nfunction useVisibilityHandler(\n rulesetId: string,\n iModel: IModelConnection,\n activeView: Viewport,\n visibilityHandler?: ModelsVisibilityHandler,\n filteredDataProvider?: IFilteredPresentationTreeDataProvider,\n hierarchyAutoUpdateEnabled?: boolean,\n) {\n const subjectModelIdsCache = useMemo(() => new SubjectModelIdsCache(iModel), [iModel]);\n\n const defaultVisibilityHandler = useDisposable(useCallback(\n () =>\n new ModelsVisibilityHandler({ rulesetId, viewport: activeView, hierarchyAutoUpdateEnabled, subjectModelIdsCache }),\n [rulesetId, activeView, subjectModelIdsCache, hierarchyAutoUpdateEnabled])\n );\n\n const handler = visibilityHandler ?? defaultVisibilityHandler;\n\n useEffect(() => {\n handler && handler.setFilteredDataProvider(filteredDataProvider);\n }, [handler, filteredDataProvider]);\n\n return handler;\n}\n\nconst isFilteredDataProvider = (dataProvider: IPresentationTreeDataProvider | IFilteredPresentationTreeDataProvider): dataProvider is IFilteredPresentationTreeDataProvider => {\n const filteredProvider = dataProvider as IFilteredPresentationTreeDataProvider;\n return filteredProvider.nodeMatchesFilter !== undefined && filteredProvider.getActiveMatch !== undefined && filteredProvider.countFilteringResults !== undefined;\n};\n\nconst getFilteredDataProvider = (dataProvider: IPresentationTreeDataProvider | IFilteredPresentationTreeDataProvider): IFilteredPresentationTreeDataProvider | undefined => {\n return isFilteredDataProvider(dataProvider) ? dataProvider : undefined;\n};\n"]}
1
+ {"version":3,"file":"ModelsTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/ModelsTree.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAE/F,OAAO,4BAA4B,CAAC;AACpC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,0BAA0B,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC3G,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,kCAAkC,EAAE,uBAAuB,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AACjI,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,4B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IAEF,MAAM,OAAO,GAAG,OAAO,iBAAiB,KAAK,UAAU,IAAI,iBAAiB,KAAK,SAAS;QACxF,CAAC,CAAC,2BAA2B;QAC7B,CAAC,CAAC,iBAAiB,CAAC;IAEtB,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,IAAI,OAAO,CAAC,uBAAuB,CAAC,oBAAoB,CAAC,CAAC;IACnE,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAEpC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,sBAAsB,GAAG,CAAC,YAAmF,EAAyD,EAAE;IAC5K,MAAM,gBAAgB,GAAG,YAAqD,CAAC;IAC/E,OAAO,gBAAgB,CAAC,iBAAiB,KAAK,SAAS,IAAI,gBAAgB,CAAC,cAAc,KAAK,SAAS,IAAI,gBAAgB,CAAC,qBAAqB,KAAK,SAAS,CAAC;AACnK,CAAC,CAAC;AAEF,MAAM,uBAAuB,GAAG,CAAC,YAAmF,EAAqD,EAAE;IACzK,OAAO,sBAAsB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;AACzE,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 \"../VisibilityTreeBase.scss\";\nimport classNames from \"classnames\";\nimport { useCallback, useEffect, useMemo } from \"react\";\nimport { ControlledTree, SelectionMode, useTreeModel } from \"@itwin/components-react\";\nimport { useDisposable } from \"@itwin/core-react\";\nimport { isPresentationTreeNodeItem, usePresentationTreeNodeLoader } from \"@itwin/presentation-components\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { ClassGroupingOption } from \"../common/Types\";\nimport { addCustomTreeNodeItemLabelRenderer, addTreeNodeItemCheckbox, combineTreeNodeItemCustomizations } from \"../common/Utils\";\nimport { VisibilityTreeEventHandler } from \"../VisibilityTreeEventHandler\";\nimport { createVisibilityTreeRenderer, useVisibilityTreeFiltering, VisibilityTreeNoFilteredData } from \"../VisibilityTreeRenderer\";\nimport { ModelsVisibilityHandler, SubjectModelIdsCache } from \"./ModelsVisibilityHandler\";\nimport { addModelsTreeNodeItemIcons, createRuleset, createSearchRuleset } from \"./Utils\";\n\nimport type { SingleSchemaClassSpecification } from \"@itwin/presentation-common\";\nimport type { IModelConnection, Viewport } from \"@itwin/core-frontend\";\nimport type { IFilteredPresentationTreeDataProvider, IPresentationTreeDataProvider } from \"@itwin/presentation-components\";\nimport type { BaseFilterableTreeProps } from \"../common/Types\";\nimport type { ModelsTreeSelectionPredicate, ModelsVisibilityHandlerProps } from \"./ModelsVisibilityHandler\";\n\nconst PAGING_SIZE = 20;\n\n/**\n * Props for configuring the hierarchy in [[ModelsTree]].\n * @public\n */\nexport interface ModelsTreeHierarchyConfiguration {\n /** Should the tree group displayed element nodes by class. Defaults to `ClassGroupingOption.No`. */\n enableElementsClassGrouping?: ClassGroupingOption;\n /**\n * Defines the `bis.GeometricElement3d` sub-class that should be used to load element nodes.\n * Defaults to `bis.GeometricElement3d`. It's expected for the given class to derive from it.\n */\n elementClassSpecification?: SingleSchemaClassSpecification;\n /** Should the tree show models without elements. */\n showEmptyModels?: boolean;\n}\n\n/**\n * Props for [[ModelsTree]] component.\n * @public\n */\nexport interface ModelsTreeProps extends BaseFilterableTreeProps {\n /**\n * Predicate which indicates whether node can be selected or no\n */\n selectionPredicate?: ModelsTreeSelectionPredicate;\n /**\n * Active view used to determine and control visibility\n */\n activeView: Viewport;\n /**\n * Configuration options for the hierarchy loaded in the component.\n */\n hierarchyConfig?: ModelsTreeHierarchyConfiguration;\n /**\n * Auto-update the hierarchy when data in the iModel changes.\n * @alpha\n */\n enableHierarchyAutoUpdate?: boolean;\n /**\n * Custom visibility handler.\n */\n modelsVisibilityHandler?: ModelsVisibilityHandler | ((props: ModelsVisibilityHandlerProps) => ModelsVisibilityHandler);\n}\n\n/**\n * A tree component that shows a subject - model - category - element\n * hierarchy along with checkboxes that represent and allow changing\n * the display of those instances.\n * @public\n */\nexport function ModelsTree(props: ModelsTreeProps) {\n const { nodeLoader, onItemsRendered } = useModelsTreeNodeLoader(props);\n const { filteredNodeLoader, isFiltering, nodeHighlightingProps } = useVisibilityTreeFiltering(nodeLoader, props.filterInfo, props.onFilterApplied);\n const filterApplied = filteredNodeLoader !== nodeLoader;\n\n const { activeView, modelsVisibilityHandler, selectionPredicate } = props;\n\n const visibilityHandler = useVisibilityHandler(\n nodeLoader.dataProvider.rulesetId,\n props.iModel,\n activeView,\n modelsVisibilityHandler,\n getFilteredDataProvider(filteredNodeLoader.dataProvider),\n props.enableHierarchyAutoUpdate);\n const eventHandler = useDisposable(useCallback(() => new VisibilityTreeEventHandler({\n nodeLoader: filteredNodeLoader,\n visibilityHandler,\n selectionPredicate: (node) => !selectionPredicate || !isPresentationTreeNodeItem(node) ? true : selectionPredicate(node.key, ModelsVisibilityHandler.getNodeType(node)),\n }), [filteredNodeLoader, visibilityHandler, selectionPredicate]));\n\n const treeModel = useTreeModel(filteredNodeLoader.modelSource);\n const treeRenderer = createVisibilityTreeRenderer({\n contextMenuItems: props.contextMenuItems,\n nodeLabelRenderer: props.nodeLabelRenderer,\n density: props.density,\n nodeRendererProps: {\n iconsEnabled: true,\n descriptionEnabled: false,\n levelOffset: 10,\n disableRootNodeCollapse: true,\n },\n });\n\n const overlay = isFiltering ? <div className=\"filteredTreeOverlay\" /> : undefined;\n\n // istanbul ignore next\n const noFilteredDataRenderer = useCallback(() => {\n return <VisibilityTreeNoFilteredData\n title={TreeWidget.translate(\"modelTree.noModelFound\")}\n message={TreeWidget.translate(\"modelTree.noMatchingModelNames\")}\n />;\n }, []);\n\n return (\n <div className={classNames(\"tree-widget-visibility-tree-base\", \"tree-widget-tree-container\")}>\n <ControlledTree\n nodeLoader={filteredNodeLoader}\n model={treeModel}\n selectionMode={props.selectionMode || SelectionMode.None}\n eventsHandler={eventHandler}\n treeRenderer={treeRenderer}\n nodeHighlightingProps={nodeHighlightingProps}\n noDataRenderer={filterApplied ? noFilteredDataRenderer : undefined}\n onItemsRendered={onItemsRendered}\n width={props.width}\n height={props.height}\n />\n {overlay}\n </div>\n );\n}\n\nconst customizeTreeNodeItem = combineTreeNodeItemCustomizations([\n addCustomTreeNodeItemLabelRenderer,\n addTreeNodeItemCheckbox,\n addModelsTreeNodeItemIcons,\n]);\n\nfunction useModelsTreeNodeLoader(props: ModelsTreeProps) {\n const rulesets = {\n general: useMemo(() => createRuleset({\n enableElementsClassGrouping: !!props.hierarchyConfig?.enableElementsClassGrouping,\n elementClassSpecification: props.hierarchyConfig?.elementClassSpecification,\n showEmptyModels: props.hierarchyConfig?.showEmptyModels,\n }), [props.hierarchyConfig?.enableElementsClassGrouping, props.hierarchyConfig?.elementClassSpecification, props.hierarchyConfig?.showEmptyModels]),\n search: useMemo(() => createSearchRuleset({\n elementClassSpecification: props.hierarchyConfig?.elementClassSpecification,\n showEmptyModels: props.hierarchyConfig?.showEmptyModels,\n }), [props.hierarchyConfig?.elementClassSpecification, props.hierarchyConfig?.showEmptyModels]),\n };\n\n const { nodeLoader, onItemsRendered } = usePresentationTreeNodeLoader({\n imodel: props.iModel,\n ruleset: rulesets.general,\n appendChildrenCountForGroupingNodes: (props.hierarchyConfig?.enableElementsClassGrouping === ClassGroupingOption.YesWithCounts),\n pagingSize: PAGING_SIZE,\n enableHierarchyAutoUpdate: props.enableHierarchyAutoUpdate,\n customizeTreeNodeItem,\n });\n const { nodeLoader: searchNodeLoader, onItemsRendered: onSearchItemsRendered } = usePresentationTreeNodeLoader({\n imodel: props.iModel,\n ruleset: rulesets.search,\n pagingSize: PAGING_SIZE,\n enableHierarchyAutoUpdate: props.enableHierarchyAutoUpdate,\n customizeTreeNodeItem,\n });\n\n const activeNodeLoader = props.filterInfo?.filter ? searchNodeLoader : nodeLoader;\n const activeItemsRenderedCallback = props.filterInfo?.filter ? onSearchItemsRendered : onItemsRendered;\n\n return {\n nodeLoader: activeNodeLoader,\n onItemsRendered: activeItemsRenderedCallback,\n };\n}\n\nfunction useVisibilityHandler(\n rulesetId: string,\n iModel: IModelConnection,\n activeView: Viewport,\n visibilityHandler?: ModelsVisibilityHandler | ((props: ModelsVisibilityHandlerProps) => ModelsVisibilityHandler),\n filteredDataProvider?: IFilteredPresentationTreeDataProvider,\n hierarchyAutoUpdateEnabled?: boolean,\n) {\n const subjectModelIdsCache = useMemo(() => new SubjectModelIdsCache(iModel), [iModel]);\n\n const disposableVisibilityHandler = useDisposable(useCallback(\n () => {\n const visibilityHandlerProps: ModelsVisibilityHandlerProps = {\n rulesetId,\n viewport: activeView,\n hierarchyAutoUpdateEnabled,\n subjectModelIdsCache,\n };\n\n return typeof visibilityHandler === \"function\"\n ? visibilityHandler(visibilityHandlerProps)\n : new ModelsVisibilityHandler(visibilityHandlerProps);\n },\n [visibilityHandler, rulesetId, activeView, hierarchyAutoUpdateEnabled, subjectModelIdsCache])\n );\n\n const handler = typeof visibilityHandler === \"function\" || visibilityHandler === undefined\n ? disposableVisibilityHandler\n : visibilityHandler;\n\n useEffect(() => {\n handler && handler.setFilteredDataProvider(filteredDataProvider);\n }, [handler, filteredDataProvider]);\n\n return handler;\n}\n\nconst isFilteredDataProvider = (dataProvider: IPresentationTreeDataProvider | IFilteredPresentationTreeDataProvider): dataProvider is IFilteredPresentationTreeDataProvider => {\n const filteredProvider = dataProvider as IFilteredPresentationTreeDataProvider;\n return filteredProvider.nodeMatchesFilter !== undefined && filteredProvider.getActiveMatch !== undefined && filteredProvider.countFilteringResults !== undefined;\n};\n\nconst getFilteredDataProvider = (dataProvider: IPresentationTreeDataProvider | IFilteredPresentationTreeDataProvider): IFilteredPresentationTreeDataProvider | undefined => {\n return isFilteredDataProvider(dataProvider) ? dataProvider : undefined;\n};\n"]}
@@ -239,6 +239,7 @@ export function createSearchRuleset(props) {
239
239
  {
240
240
  ...createRelatedNonHierarchySubjectSpecification(),
241
241
  hideExpression: `NOT ThisNode.HasChildren ANDALSO NOT ThisNode.ChildrenArtifacts.AnyMatches(x => x.isContentModel)`,
242
+ hideIfNoChildren: undefined,
242
243
  },
243
244
  ],
244
245
  customizationRules: [
@@ -268,7 +269,10 @@ export function createSearchRuleset(props) {
268
269
  ruleType: "ChildNodes",
269
270
  condition: `ParentNode.IsOfClass("Subject", "BisCore")`,
270
271
  specifications: [
271
- createNonContentModelsSpecification(context),
272
+ {
273
+ ...createNonContentModelsSpecification(context),
274
+ hasChildren: "Unknown",
275
+ },
272
276
  ],
273
277
  customizationRules: [
274
278
  {
@@ -284,7 +288,10 @@ export function createSearchRuleset(props) {
284
288
  ruleType: "ChildNodes",
285
289
  condition: `ParentNode.IsOfClass("Subject", "BisCore")`,
286
290
  specifications: [
287
- createContentModelsSpecification(context),
291
+ {
292
+ ...createContentModelsSpecification(context),
293
+ hasChildren: "Unknown",
294
+ },
288
295
  ],
289
296
  customizationRules: [
290
297
  {
@@ -1 +1 @@
1
- {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/Utils.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAOrD,gBAAgB;AAChB,MAAM,OAAO,0BAA0B;IAErC,YAAoB,UAAsC;QAAtC,eAAU,GAAV,UAAU,CAA4B;QADlD,SAAI,GAAG,IAAI,KAAK,EAAc,CAAC;IAEvC,CAAC;IAEO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAE9D,KAAK,CAAA,CAAE,aAAa;QACzB,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE;YAC1B,MAAM,EAAE,CAAC;SACV;QAED,IAAI,MAAM,CAAC;QACX,OAAO,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE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E,sBAAsB;QAChC,iBAAiB,EAAE;YACjB;gBACE,YAAY,EAAE;oBACZ,UAAU,EAAE,SAAS;oBACrB,SAAS,EAAE,0BAA0B;iBACtC;gBACD,SAAS,EAAE,SAAS;gBACpB,WAAW,EAAE,yBAAyB;aACvC;SACF;QACD,YAAY,EAAE,aAAa;QAC3B,YAAY,EAAE,KAAK;KACpB,CAAC;AACJ,CAAC;AAED,SAAS,iCAAiC,CAAC,EAAE,yBAAyB,EAAE,eAAe,EAAyB;IAC9G,MAAM,WAAW,GAAG,wEAAwE,yBAAyB,CAAC,UAAU,IAAI,yBAAyB,CAAC,SAAS,IAAI,CAAC;IAC5K,MAAM,cAAc,GAAG,qBAAqB,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,WAAW,EAAE,EAAE,CAAC;IAE3F,OAAO;QACL,QAAQ,EAAE,sBAAsB;QAChC,iBAAiB,EAAE;YACjB;gBACE,YAAY,EAAE;oBACZ,UAAU,EAAE,SAAS;oBACrB,SAAS,EAAE,mBAAmB;iBAC/B;gBACD,SAAS,EAAE,SAAS;gBACpB,WAAW,EAAE;oBACX,UAAU,EAAE,SAAS;oBACrB,SAAS,EAAE,kBAAkB;iBAC9B;aACF;SACF;QACD,cAAc;QACd,YAAY,EAAE,KAAK;QACnB,YAAY,EAAE,KAAK;KACpB,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,0BAA0B,CAAC,IAAsC,EAAE,IAAmB;IACpG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,sBAAsB,CAAC,IAAI,CAAC,GAAG,CAAC;QAC9D,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS;QAC9B,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC;AAC9B,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 { NodeKey } from \"@itwin/presentation-common\";\n\nimport type { Id64String } from \"@itwin/core-bentley\";\nimport type { ChildNodeSpecification, Node, Ruleset, SingleSchemaClassSpecification } from \"@itwin/presentation-common\";\nimport type { DelayLoadedTreeNodeItem } from \"@itwin/components-react\";\nimport type { ModelsTreeHierarchyConfiguration } from \"./ModelsTree\";\n\n/** @internal */\nexport class CachingElementIdsContainer {\n private _ids = new Array<Id64String>();\n constructor(private _generator: AsyncGenerator<Id64String>) {\n }\n\n private async next() { return (await this._generator.next()).value; }\n\n public async* getElementIds() {\n for (const id of this._ids) {\n yield id;\n }\n\n let nextId;\n while (nextId = await this.next()) {\n this._ids.push(nextId);\n yield nextId;\n }\n }\n}\n\n/** @internal */\nexport type CreateRulesetProps = Omit<ModelsTreeHierarchyConfiguration, \"enableElementsClassGrouping\"> & {\n enableElementsClassGrouping?: boolean;\n};\n\n/** @internal */\nexport function createRuleset(props: CreateRulesetProps): Ruleset {\n const context: SpecificationsContext = {\n elementClassSpecification: props.elementClassSpecification ?? { schemaName: \"BisCore\", className: \"GeometricElement3d\" },\n groupElements: !!props.enableElementsClassGrouping,\n showEmptyModels: !!props.showEmptyModels,\n };\n\n return {\n id: \"tree-widget-react/ModelsTree\",\n requiredSchemas: [\n {\n name: \"BisCore\",\n },\n ],\n rules: [\n {\n ruleType: \"RootNodes\",\n autoExpand: true,\n specifications: [\n createRootSubjectSpecification(),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: \"\\\"icon-imodel-hollow-2\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createRelatedHierarchySubjectSpecification(),\n createRelatedNonHierarchySubjectSpecification(),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: \"\\\"icon-folder\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createNonContentModelsSpecification(context),\n createContentModelsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"ISubModeledElement\", \"BisCore\")`,\n specifications: [\n createElementModelSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricModel3d\", \"BisCore\")`,\n specifications: [\n createModelCategoriesSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isCategory: \"true\",\n modelId: \"ParentNode.InstanceId\",\n icon: \"\\\"icon-layers\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"SpatialCategory\", \"BisCore\")`,\n specifications: [\n createCategoryElementsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n modelId: \"this.Model.Id\",\n categoryId: \"this.Category.Id\",\n icon: \"\\\"icon-item\\\"\",\n groupIcon: \"\\\"icon-ec-class\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricElement3d\", \"BisCore\")`,\n specifications: [\n createEementElementsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n modelId: \"this.Model.Id\",\n categoryId: \"this.Category.Id\",\n icon: \"\\\"icon-item\\\"\",\n groupIcon: \"\\\"icon-ec-class\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"SpatialCategory\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n {\n ruleType: \"Content\",\n condition: `ContentDisplayType = \"AssemblyElementsRequest\"`,\n specifications: [\n {\n specType: \"SelectedNodeInstances\",\n },\n {\n specType: \"ContentRelatedInstances\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ElementOwnsChildElements\",\n },\n direction: \"Forward\",\n count: \"*\",\n },\n ],\n },\n ],\n },\n ],\n };\n}\n\n/** @internal */\nexport type CreateSearchRulesetProps = Omit<ModelsTreeHierarchyConfiguration, \"enableElementsClassGrouping\">;\n\n/** @internal */\nexport function createSearchRuleset(props: CreateSearchRulesetProps): Ruleset {\n const context: SpecificationsContext = {\n elementClassSpecification: props.elementClassSpecification ?? { schemaName: \"BisCore\", className: \"GeometricElement3d\" },\n groupElements: false,\n showEmptyModels: !!props.showEmptyModels,\n };\n\n return {\n id: \"tree-widget-react/ModelsTreeSearch\",\n rules: [\n {\n ruleType: \"RootNodes\",\n specifications: [\n createRootSubjectSpecification(),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: \"\\\"icon-imodel-hollow-2\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createRelatedHierarchySubjectSpecification(),\n {\n ...createRelatedNonHierarchySubjectSpecification(),\n hideExpression: `NOT ThisNode.HasChildren ANDALSO NOT ThisNode.ChildrenArtifacts.AnyMatches(x => x.isContentModel)`,\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: \"\\\"icon-folder\\\"\",\n },\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createNonContentModelsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createContentModelsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"NodeArtifacts\",\n items: {\n isContentModel: \"true\",\n },\n },\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricModel3d\", \"BisCore\")`,\n specifications: [\n createModelSubModelsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n ],\n };\n}\n\ninterface SpecificationsContext {\n elementClassSpecification: SingleSchemaClassSpecification;\n groupElements: boolean;\n showEmptyModels: boolean;\n}\n\nfunction createRootSubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: [\n {\n schemaName: \"BisCore\",\n classNames: [\n \"Subject\",\n ],\n },\n ],\n instanceFilter: `this.Parent = NULL`,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createRelatedHierarchySubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"SubjectOwnsSubjects\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n },\n ],\n instanceFilter: `json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") <> NULL OR ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") = \"Hierarchy\"`,\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createRelatedNonHierarchySubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"SubjectOwnsSubjects\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n },\n ],\n instanceFilter: `json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") = NULL AND ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") <> \"Hierarchy\"`,\n hideIfNoChildren: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createNonContentModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const partitionFilter = `parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)`;\n const modelHasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n\n const hasNoContent = `json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") = NULL AND json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") = NULL`;\n const instanceFilter = `(${partitionFilter}) AND NOT this.IsPrivate AND ${hasNoContent}${showEmptyModels ? \"\" : ` AND ${modelHasElements}`}`;\n\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: {\n schemaName: \"BisCore\",\n classNames: [\n \"GeometricModel3d\",\n ],\n arePolymorphic: true,\n },\n relatedInstances: [\n {\n relationshipPath: {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"InformationPartitionElement\",\n },\n },\n alias: \"partition\",\n isRequired: true,\n },\n ],\n instanceFilter,\n hasChildren: showEmptyModels ? \"Unknown\" : \"Always\",\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createContentModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const partitionFilter = `parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)`;\n const modelHasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n\n const hasContent = `json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") <> NULL OR json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") <> NULL`;\n const instanceFilter = `(${partitionFilter}) AND NOT this.IsPrivate AND (${hasContent})${showEmptyModels ? \"\" : ` AND ${modelHasElements}`}`;\n\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: {\n schemaName: \"BisCore\",\n classNames: [\"GeometricModel3d\"],\n arePolymorphic: true,\n },\n relatedInstances: [\n {\n relationshipPath: {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"InformationPartitionElement\",\n },\n },\n alias: \"partition\",\n isRequired: true,\n },\n ],\n instanceFilter,\n hasChildren: showEmptyModels ? \"Unknown\" : \"Always\",\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createElementModelSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const hasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n const instanceFilter = `NOT this.IsPrivate${showEmptyModels ? \"\" : ` AND ${hasElements}`}`;\n\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Backward\",\n },\n ],\n instanceFilter,\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createModelCategoriesSpecification({ elementClassSpecification }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelContainsElements\",\n },\n direction: \"Forward\",\n targetClass: elementClassSpecification,\n },\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"GeometricElement3dIsInCategory\",\n },\n direction: \"Forward\",\n },\n ],\n ],\n instanceFilter: `NOT this.IsPrivate`,\n suppressSimilarAncestorsCheck: true,\n hideIfNoChildren: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createCategoryElementsSpecification({ elementClassSpecification, groupElements }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"GeometricElement3dIsInCategory\",\n },\n direction: \"Backward\",\n targetClass: elementClassSpecification,\n },\n ],\n instanceFilter: `this.Model.Id = parent.parent.ECInstanceId ANDALSO this.Parent = NULL`,\n groupByClass: groupElements,\n groupByLabel: false,\n };\n}\n\nfunction createEementElementsSpecification({ elementClassSpecification, groupElements }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ElementOwnsChildElements\",\n },\n direction: \"Forward\",\n targetClass: elementClassSpecification,\n },\n ],\n groupByClass: groupElements,\n groupByLabel: false,\n };\n}\n\nfunction createModelSubModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const hasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n const instanceFilter = `NOT this.IsPrivate${showEmptyModels ? \"\" : ` AND ${hasElements}`}`;\n\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelOwnsSubModel\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"GeometricModel3d\",\n },\n },\n ],\n instanceFilter,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\n/** @internal */\nexport function addModelsTreeNodeItemIcons(item: Partial<DelayLoadedTreeNodeItem>, node: Partial<Node>) {\n item.icon = node.key && NodeKey.isClassGroupingNodeKey(node.key)\n ? node.extendedData?.groupIcon\n : node.extendedData?.icon;\n}\n"]}
1
+ {"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/Utils.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAE/F,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAOrD,gBAAgB;AAChB,MAAM,OAAO,0BAA0B;IAErC,YAAoB,UAAsC;QAAtC,eAAU,GAAV,UAAU,CAA4B;QADlD,SAAI,GAAG,IAAI,KAAK,EAAc,CAAC;IAEvC,CAAC;IAEO,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAE9D,KAAK,CAAA,CAAE,aAAa;QACzB,KAAK,MAAM,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE;YAC1B,MAAM,EAAE,CAAC;SACV;QAED,IAAI,MAAM,CAAC;QACX,OAAO,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,EAAE;YACjC,IAA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C9B,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 { NodeKey } from \"@itwin/presentation-common\";\n\nimport type { Id64String } from \"@itwin/core-bentley\";\nimport type { ChildNodeSpecification, Node, Ruleset, SingleSchemaClassSpecification } from \"@itwin/presentation-common\";\nimport type { DelayLoadedTreeNodeItem } from \"@itwin/components-react\";\nimport type { ModelsTreeHierarchyConfiguration } from \"./ModelsTree\";\n\n/** @internal */\nexport class CachingElementIdsContainer {\n private _ids = new Array<Id64String>();\n constructor(private _generator: AsyncGenerator<Id64String>) {\n }\n\n private async next() { return (await this._generator.next()).value; }\n\n public async* getElementIds() {\n for (const id of this._ids) {\n yield id;\n }\n\n let nextId;\n while (nextId = await this.next()) {\n this._ids.push(nextId);\n yield nextId;\n }\n }\n}\n\n/** @internal */\nexport type CreateRulesetProps = Omit<ModelsTreeHierarchyConfiguration, \"enableElementsClassGrouping\"> & {\n enableElementsClassGrouping?: boolean;\n};\n\n/** @internal */\nexport function createRuleset(props: CreateRulesetProps): Ruleset {\n const context: SpecificationsContext = {\n elementClassSpecification: props.elementClassSpecification ?? { schemaName: \"BisCore\", className: \"GeometricElement3d\" },\n groupElements: !!props.enableElementsClassGrouping,\n showEmptyModels: !!props.showEmptyModels,\n };\n\n return {\n id: \"tree-widget-react/ModelsTree\",\n requiredSchemas: [\n {\n name: \"BisCore\",\n },\n ],\n rules: [\n {\n ruleType: \"RootNodes\",\n autoExpand: true,\n specifications: [\n createRootSubjectSpecification(),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: \"\\\"icon-imodel-hollow-2\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createRelatedHierarchySubjectSpecification(),\n createRelatedNonHierarchySubjectSpecification(),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: \"\\\"icon-folder\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createNonContentModelsSpecification(context),\n createContentModelsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"ISubModeledElement\", \"BisCore\")`,\n specifications: [\n createElementModelSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricModel3d\", \"BisCore\")`,\n specifications: [\n createModelCategoriesSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isCategory: \"true\",\n modelId: \"ParentNode.InstanceId\",\n icon: \"\\\"icon-layers\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"SpatialCategory\", \"BisCore\")`,\n specifications: [\n createCategoryElementsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n modelId: \"this.Model.Id\",\n categoryId: \"this.Category.Id\",\n icon: \"\\\"icon-item\\\"\",\n groupIcon: \"\\\"icon-ec-class\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricElement3d\", \"BisCore\")`,\n specifications: [\n createEementElementsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n modelId: \"this.Model.Id\",\n categoryId: \"this.Category.Id\",\n icon: \"\\\"icon-item\\\"\",\n groupIcon: \"\\\"icon-ec-class\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"SpatialCategory\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n {\n ruleType: \"Content\",\n condition: `ContentDisplayType = \"AssemblyElementsRequest\"`,\n specifications: [\n {\n specType: \"SelectedNodeInstances\",\n },\n {\n specType: \"ContentRelatedInstances\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ElementOwnsChildElements\",\n },\n direction: \"Forward\",\n count: \"*\",\n },\n ],\n },\n ],\n },\n ],\n };\n}\n\n/** @internal */\nexport type CreateSearchRulesetProps = Omit<ModelsTreeHierarchyConfiguration, \"enableElementsClassGrouping\">;\n\n/** @internal */\nexport function createSearchRuleset(props: CreateSearchRulesetProps): Ruleset {\n const context: SpecificationsContext = {\n elementClassSpecification: props.elementClassSpecification ?? { schemaName: \"BisCore\", className: \"GeometricElement3d\" },\n groupElements: false,\n showEmptyModels: !!props.showEmptyModels,\n };\n\n return {\n id: \"tree-widget-react/ModelsTreeSearch\",\n rules: [\n {\n ruleType: \"RootNodes\",\n specifications: [\n createRootSubjectSpecification(),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: \"\\\"icon-imodel-hollow-2\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n createRelatedHierarchySubjectSpecification(),\n {\n ...createRelatedNonHierarchySubjectSpecification(),\n hideExpression: `NOT ThisNode.HasChildren ANDALSO NOT ThisNode.ChildrenArtifacts.AnyMatches(x => x.isContentModel)`,\n hideIfNoChildren: undefined,\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isSubject: \"true\",\n icon: \"\\\"icon-folder\\\"\",\n },\n },\n {\n ruleType: \"Grouping\",\n class: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n groups: [\n {\n specType: \"SameLabelInstance\",\n applicationStage: \"PostProcess\",\n },\n ],\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n {\n ...createNonContentModelsSpecification(context),\n hasChildren: \"Unknown\",\n },\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"Subject\", \"BisCore\")`,\n specifications: [\n {\n ...createContentModelsSpecification(context),\n hasChildren: \"Unknown\",\n },\n ],\n customizationRules: [\n {\n ruleType: \"NodeArtifacts\",\n items: {\n isContentModel: \"true\",\n },\n },\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n {\n ruleType: \"ChildNodes\",\n condition: `ParentNode.IsOfClass(\"GeometricModel3d\", \"BisCore\")`,\n specifications: [\n createModelSubModelsSpecification(context),\n ],\n customizationRules: [\n {\n ruleType: \"ExtendedData\",\n items: {\n isModel: \"true\",\n icon: \"\\\"icon-model\\\"\",\n },\n },\n ],\n },\n ],\n };\n}\n\ninterface SpecificationsContext {\n elementClassSpecification: SingleSchemaClassSpecification;\n groupElements: boolean;\n showEmptyModels: boolean;\n}\n\nfunction createRootSubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: [\n {\n schemaName: \"BisCore\",\n classNames: [\n \"Subject\",\n ],\n },\n ],\n instanceFilter: `this.Parent = NULL`,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createRelatedHierarchySubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"SubjectOwnsSubjects\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n },\n ],\n instanceFilter: `json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") <> NULL OR ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") = \"Hierarchy\"`,\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createRelatedNonHierarchySubjectSpecification(): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"SubjectOwnsSubjects\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"Subject\",\n },\n },\n ],\n instanceFilter: `json_extract(this.JsonProperties, \"$.Subject.Job.Bridge\") = NULL AND ifnull(json_extract(this.JsonProperties, \"$.Subject.Model.Type\"), \"\") <> \"Hierarchy\"`,\n hideIfNoChildren: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createNonContentModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const partitionFilter = `parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)`;\n const modelHasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n\n const hasNoContent = `json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") = NULL AND json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") = NULL`;\n const instanceFilter = `(${partitionFilter}) AND NOT this.IsPrivate AND ${hasNoContent}${showEmptyModels ? \"\" : ` AND ${modelHasElements}`}`;\n\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: {\n schemaName: \"BisCore\",\n classNames: [\n \"GeometricModel3d\",\n ],\n arePolymorphic: true,\n },\n relatedInstances: [\n {\n relationshipPath: {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"InformationPartitionElement\",\n },\n },\n alias: \"partition\",\n isRequired: true,\n },\n ],\n instanceFilter,\n hasChildren: showEmptyModels ? \"Unknown\" : \"Always\",\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createContentModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const partitionFilter = `parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)`;\n const modelHasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n\n const hasContent = `json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") <> NULL OR json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") <> NULL`;\n const instanceFilter = `(${partitionFilter}) AND NOT this.IsPrivate AND (${hasContent})${showEmptyModels ? \"\" : ` AND ${modelHasElements}`}`;\n\n return {\n specType: \"InstanceNodesOfSpecificClasses\",\n classes: {\n schemaName: \"BisCore\",\n classNames: [\"GeometricModel3d\"],\n arePolymorphic: true,\n },\n relatedInstances: [\n {\n relationshipPath: {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"InformationPartitionElement\",\n },\n },\n alias: \"partition\",\n isRequired: true,\n },\n ],\n instanceFilter,\n hasChildren: showEmptyModels ? \"Unknown\" : \"Always\",\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createElementModelSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const hasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n const instanceFilter = `NOT this.IsPrivate${showEmptyModels ? \"\" : ` AND ${hasElements}`}`;\n\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelModelsElement\",\n },\n direction: \"Backward\",\n },\n ],\n instanceFilter,\n hideNodesInHierarchy: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createModelCategoriesSpecification({ elementClassSpecification }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelContainsElements\",\n },\n direction: \"Forward\",\n targetClass: elementClassSpecification,\n },\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"GeometricElement3dIsInCategory\",\n },\n direction: \"Forward\",\n },\n ],\n ],\n instanceFilter: `NOT this.IsPrivate`,\n suppressSimilarAncestorsCheck: true,\n hideIfNoChildren: true,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\nfunction createCategoryElementsSpecification({ elementClassSpecification, groupElements }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"GeometricElement3dIsInCategory\",\n },\n direction: \"Backward\",\n targetClass: elementClassSpecification,\n },\n ],\n instanceFilter: `this.Model.Id = parent.parent.ECInstanceId ANDALSO this.Parent = NULL`,\n groupByClass: groupElements,\n groupByLabel: false,\n };\n}\n\nfunction createEementElementsSpecification({ elementClassSpecification, groupElements }: SpecificationsContext): ChildNodeSpecification {\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ElementOwnsChildElements\",\n },\n direction: \"Forward\",\n targetClass: elementClassSpecification,\n },\n ],\n groupByClass: groupElements,\n groupByLabel: false,\n };\n}\n\nfunction createModelSubModelsSpecification({ elementClassSpecification, showEmptyModels }: SpecificationsContext): ChildNodeSpecification {\n const hasElements = `this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"${elementClassSpecification.schemaName}:${elementClassSpecification.className}\")`;\n const instanceFilter = `NOT this.IsPrivate${showEmptyModels ? \"\" : ` AND ${hasElements}`}`;\n\n return {\n specType: \"RelatedInstanceNodes\",\n relationshipPaths: [\n {\n relationship: {\n schemaName: \"BisCore\",\n className: \"ModelOwnsSubModel\",\n },\n direction: \"Forward\",\n targetClass: {\n schemaName: \"BisCore\",\n className: \"GeometricModel3d\",\n },\n },\n ],\n instanceFilter,\n groupByClass: false,\n groupByLabel: false,\n };\n}\n\n/** @internal */\nexport function addModelsTreeNodeItemIcons(item: Partial<DelayLoadedTreeNodeItem>, node: Partial<Node>) {\n item.icon = node.key && NodeKey.isClassGroupingNodeKey(node.key)\n ? node.extendedData?.groupIcon\n : node.extendedData?.icon;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/tree-widget-react",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
4
4
  "description": "Tree Widget React",
5
5
  "keywords": [
6
6
  "Bentley",
@@ -32,10 +32,10 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@itwin/appui-abstract": "^4.0.0",
35
- "@itwin/appui-layout-react": "^4.3.0",
36
- "@itwin/appui-react": "^4.3.0",
35
+ "@itwin/appui-layout-react": "^4.5.0",
36
+ "@itwin/appui-react": "^4.5.0",
37
37
  "@itwin/build-tools": "^4.0.0",
38
- "@itwin/components-react": "^4.3.0",
38
+ "@itwin/components-react": "^4.5.0",
39
39
  "@itwin/core-backend": "^4.0.0",
40
40
  "@itwin/core-bentley": "^4.0.0",
41
41
  "@itwin/core-common": "^4.0.0",
@@ -45,14 +45,14 @@
45
45
  "@itwin/core-markup": "^4.0.0",
46
46
  "@itwin/core-orbitgt": "^4.0.0",
47
47
  "@itwin/core-quantity": "^4.0.0",
48
- "@itwin/core-react": "^4.3.0",
48
+ "@itwin/core-react": "^4.5.0",
49
49
  "@itwin/core-telemetry": "^4.0.0",
50
50
  "@itwin/ecschema-metadata": "^4.0.0",
51
51
  "@itwin/eslint-plugin": "^4.0.0-dev.38",
52
- "@itwin/imodel-components-react": "^4.3.0",
52
+ "@itwin/imodel-components-react": "^4.5.0",
53
53
  "@itwin/presentation-backend": "^4.0.0",
54
54
  "@itwin/presentation-common": "^4.0.0",
55
- "@itwin/presentation-components": "^4.0.0",
55
+ "@itwin/presentation-components": "^4.1.0",
56
56
  "@itwin/presentation-frontend": "^4.0.0",
57
57
  "@itwin/presentation-testing": "^4.0.0",
58
58
  "@itwin/webgl-compatibility": "^4.0.0",
@@ -84,10 +84,12 @@
84
84
  "eslint": "^8.41.0",
85
85
  "eslint-plugin-unused-imports": "^2.0.0",
86
86
  "eslint-plugin-react": "^7.32.2",
87
+ "ignore-styles": "^5.0.1",
87
88
  "jsdom": "^22.1.0",
88
89
  "jsdom-global": "3.0.2",
89
90
  "mocha": "^10.2.0",
90
91
  "nyc": "15.1.0",
92
+ "raf": "^3.4.0",
91
93
  "react": "^17.0.0",
92
94
  "react-dom": "^17.0.0",
93
95
  "react-redux": "^7.2.2",
@@ -95,6 +97,7 @@
95
97
  "rimraf": "^3.0.2",
96
98
  "sinon": "^15.1.0",
97
99
  "sinon-chai": "^3.7.0",
100
+ "source-map-support": "^0.5.6",
98
101
  "typemoq": "^2.1.0",
99
102
  "typescript": "~5.0.0",
100
103
  "xmlhttprequest": "^1.8.0"