@itwin/appui-react 3.0.1 → 3.0.2

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,14 @@
1
1
  # Change Log - @itwin/appui-react
2
2
 
3
- This log was last generated on Thu, 24 Feb 2022 15:26:55 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 10 Mar 2022 21:18:13 GMT and should not be manually modified.
4
+
5
+ ## 3.0.2
6
+ Thu, 10 Mar 2022 21:18:13 GMT
7
+
8
+ ### Updates
9
+
10
+ - Optimize ModelsTree search ruleset
11
+ - Make fix to displaying a custom view overlay.
4
12
 
5
13
  ## 3.0.1
6
14
  Thu, 24 Feb 2022 15:26:55 GMT
@@ -39,7 +39,7 @@ function ViewOverlayHost({ viewport, featureOptions, userSuppliedOverlay }) {
39
39
  });
40
40
  if (!displayViewOverlay)
41
41
  return null;
42
- return userSuppliedOverlay ? React.createElement(React.Fragment, null, "userSuppliedOverlay(viewport)") : React.createElement(DefaultViewOverlay_1.DefaultViewOverlay, { viewport: viewport, featureOptions: featureOptions });
42
+ return userSuppliedOverlay ? React.createElement(React.Fragment, null, userSuppliedOverlay(viewport)) : React.createElement(DefaultViewOverlay_1.DefaultViewOverlay, { viewport: viewport, featureOptions: featureOptions });
43
43
  }
44
44
  exports.ViewOverlayHost = ViewOverlayHost;
45
45
  /** iModel Viewport Control
@@ -1 +1 @@
1
- {"version":3,"file":"IModelViewport.js","sourceRoot":"","sources":["../../../../src/appui-react/content/IModelViewport.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAA+B;AAG/B,4EAA0E;AAC1E,4EAAkF;AAClF,kDAAiD;AAEjD,uEAAoE;AAEpE,mFAAgF;AAChF,0DAA6E;AAC7E,gDAA6C;AAC7C,6DAA0D;AAC1D,qEAAkE;AAClE,mGAAuG;AACvG,0DAAgD;AAChD,6CAA0C;AAG1C,kEAAkE;A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9B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,WAAW,EAAE,CAAC,CAAiB,EAAE,EAAE;;gBACjC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;gBAClB,6DAA6D;gBAC7D,IAAI,SAAS,KAAK,MAAM;oBACrB,MAAc,CAAC,QAAQ,GAAG,CAAC,CAAC;gBAC/B,IAAI,CAAC,qCAAiB,CAAC,SAAS;oBAC9B,MAAA,qCAAiB,CAAC,mBAAmB,0CAAE,yBAAyB,CAAC,CAAC,CAAC,CAAC;YACxE,CAAC,EACD,cAAc,EAAE,IAAI,CAAC,eAAe,GACpC,CAAC;IACL,CAAC;IAED,kFAAkF;IACxE,wBAAwB,CAAC,QAAsC;QACvE,MAAM,SAAS,GAAG,yBAAW,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;QAC9D,OAAO,oBAAC,yBAAY;;YAAG,SAAS;gBAAiB,CAAC;IACpD,CAAC;IAED,uDAAuD;IACvC,oCAAoC,CAAC,gBAAkC,EAAE,uBAAmC,EAAE,SAAoB,EAAE,KAAa;QAC/J,OAAO,IAAI,CAAC,6BAA6B,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;IACzE,CAAC;IAOD,uEAAuE;IACvE,IAAoB,oBAAoB;QACtC,IAAI,IAAI,CAAC,QAAQ;YACf,OAAO,KAAK,CAAC,oBAAoB,CAAC;;YAElC,OAAO,oEAAoC,CAAC,eAAe,CAAC;IAChE,CAAC;CACF;AA9HD,sDA8HC;AAED,6CAAqB,CAAC,eAAe,CAAC,qBAAqB,CAAC,EAAE,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ContentView\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { IModelConnection, ScreenViewport, ViewState } from \"@itwin/core-frontend\";\r\nimport { viewWithUnifiedSelection } from \"@itwin/presentation-components\";\r\nimport { ViewportComponent, ViewStateProp } from \"@itwin/imodel-components-react\";\r\nimport { FillCentered } from \"@itwin/core-react\";\r\n\r\nimport { FrontstageManager } from \"../frontstage/FrontstageManager\";\r\nimport { ConfigurableCreateInfo } from \"../configurableui/ConfigurableUiControl\";\r\nimport { ConfigurableUiManager } from \"../configurableui/ConfigurableUiManager\";\r\nimport { connectIModelConnectionAndViewState } from \"../redux/connectIModel\";\r\nimport { UiFramework } from \"../UiFramework\";\r\nimport { DefaultViewOverlay } from \"./DefaultViewOverlay\";\r\nimport { ViewportContentControl } from \"./ViewportContentControl\";\r\nimport { StandardRotationNavigationAidControl } from \"../navigationaids/StandardRotationNavigationAid\";\r\nimport { UiError } from \"@itwin/appui-abstract\";\r\nimport { useSelector } from \"react-redux\";\r\nimport { FrameworkState } from \"../redux/FrameworkState\";\r\n\r\n// create a HOC viewport component that supports unified selection\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst UnifiedSelectionViewport = viewWithUnifiedSelection(ViewportComponent);\r\n\r\n/** Viewport that is connected to the IModelConnection property in the Redux store. The application must set up the Redux store and include the FrameworkReducer.\r\n * @public\r\n */\r\nexport const IModelConnectedViewport = connectIModelConnectionAndViewState(null, null)(UnifiedSelectionViewport); // eslint-disable-line @typescript-eslint/naming-convention\r\n\r\n/** [[IModelViewportControl]] options. These options are set in the applicationData property of the [[ContentProps]].\r\n * @public\r\n */\r\nexport interface IModelViewportControlOptions {\r\n /** ViewState or a function to return a ViewState */\r\n viewState?: ViewStateProp;\r\n /** IModelConnection of data in Viewport */\r\n iModelConnection?: IModelConnection | (() => IModelConnection);\r\n /** Map of options that can be used to enable/disable features within the view */\r\n featureOptions?: { [key: string]: any };\r\n /** Optional background color which may be used if viewState and iModelConnection are undefined */\r\n bgColor?: string;\r\n /** Optional property to always use the supplied `viewState` property instead of using viewport.view when set */\r\n alwaysUseSuppliedViewState?: boolean;\r\n /** Optional property to supply custom view overlay. Uses when caller want to supply custom overlay component. */\r\n supplyViewOverlay?: (_viewport: ScreenViewport) => React.ReactNode;\r\n /** Optional property to defer reactNode initialization until first reactNode property in needed. Useful when subclassing the `IModelViewportControl`. */\r\n deferNodeInitialization?: boolean;\r\n}\r\n\r\ninterface ViewOverlayHostProps {\r\n viewport: ScreenViewport;\r\n featureOptions?: { [key: string]: any };\r\n userSuppliedOverlay?: (_viewport: ScreenViewport) => React.ReactNode;\r\n}\r\n/** View Overlay component -- exported for testing\r\n * @internal\r\n */\r\n// istanbul ignore next\r\nexport function ViewOverlayHost({viewport, featureOptions, userSuppliedOverlay}: ViewOverlayHostProps) {\r\n const displayViewOverlay = useSelector((state: FrameworkState) => {\r\n const frameworkState = (state as any)[UiFramework.frameworkStateKey];\r\n return frameworkState ? frameworkState.configurableUiState.viewOverlayDisplay : true;\r\n });\r\n if (!displayViewOverlay)\r\n return null;\r\n return userSuppliedOverlay ? <React.Fragment>userSuppliedOverlay(viewport)</React.Fragment> : <DefaultViewOverlay viewport={viewport} featureOptions={featureOptions} />;\r\n}\r\n/** iModel Viewport Control\r\n * @public\r\n */\r\n// istanbul ignore next\r\nexport class IModelViewportControl extends ViewportContentControl {\r\n public static get id() {\r\n return \"UiFramework.IModelViewportControl\";\r\n }\r\n protected _featureOptions: { [key: string]: boolean | string } = {};\r\n protected _viewState: ViewStateProp | undefined;\r\n protected _iModelConnection: IModelConnection | undefined;\r\n protected _alwaysUseSuppliedViewState: boolean;\r\n private _userSuppliedViewOverlay?: (_viewport: ScreenViewport) => React.ReactNode;\r\n\r\n constructor(info: ConfigurableCreateInfo, protected _options: IModelViewportControlOptions) {\r\n super(info, _options);\r\n\r\n if (_options.featureOptions)\r\n this._featureOptions = _options.featureOptions;\r\n this._alwaysUseSuppliedViewState = _options.alwaysUseSuppliedViewState ?? false;\r\n this._userSuppliedViewOverlay = _options.supplyViewOverlay;\r\n\r\n if (!_options.deferNodeInitialization)\r\n this.initializeReactNode();\r\n }\r\n\r\n protected initializeReactNode() {\r\n const options = this._options;\r\n\r\n if (options.viewState)\r\n this._viewState = options.viewState;\r\n\r\n const iModelConnection = (typeof options.iModelConnection === \"function\") ? options.iModelConnection() : options.iModelConnection;\r\n\r\n if (this._viewState && iModelConnection) {\r\n /** Passing _determineViewState as a function reference; it is not called here. */\r\n this._reactNode = this.getImodelViewportReactElement(iModelConnection, this._determineViewState);\r\n } else {\r\n if (UiFramework.getIModelConnection() && UiFramework.getDefaultViewState()) {\r\n this._reactNode = this.getImodelConnectedViewportReactElement();\r\n } else {\r\n this._reactNode = this.getNoContentReactElement(options);\r\n this.setIsReady();\r\n }\r\n }\r\n }\r\n\r\n protected override getReactNode(): React.ReactNode {\r\n if (!React.isValidElement(this._reactNode) && this._options.deferNodeInitialization)\r\n this.initializeReactNode();\r\n\r\n return this.getKeyedReactNode();\r\n }\r\n\r\n /**\r\n * This is passed as a function to the ViewportComponent as the `viewState` prop in getImodelViewportReactElement().\r\n * It is called by ViewportComponent on a mount to resolve the viewState.\r\n */\r\n private _determineViewState = (): ViewState => {\r\n let viewState: ViewState;\r\n\r\n if (this.viewport && !this._alwaysUseSuppliedViewState)\r\n viewState = this.viewport.view;\r\n else if (this._viewState) {\r\n if (typeof this._viewState === \"function\")\r\n viewState = this._viewState();\r\n else\r\n viewState = this._viewState;\r\n } else\r\n throw new UiError(UiFramework.loggerCategory(this), \"No ViewState could be determined\");\r\n\r\n return viewState!;\r\n };\r\n\r\n /** Get the React component that will contain the Viewport */\r\n protected getImodelConnectedViewportReactElement(): React.ReactNode {\r\n return <IModelConnectedViewport\r\n viewportRef={(v: ScreenViewport) => {\r\n this.viewport = v;\r\n // for convenience, if window defined bind viewport to window\r\n if (undefined !== window)\r\n (window as any).viewport = v;\r\n if (!FrontstageManager.isLoading)\r\n FrontstageManager.activeFrontstageDef?.setActiveViewFromViewport(v);\r\n }}\r\n getViewOverlay={this._getViewOverlay}\r\n />;\r\n }\r\n\r\n /** Get the React component that will contain the Viewport */\r\n protected getImodelViewportReactElement(iModelConnection: IModelConnection, viewState: ViewStateProp): React.ReactNode {\r\n return <UnifiedSelectionViewport\r\n viewState={viewState}\r\n imodel={iModelConnection}\r\n controlId={this.controlId}\r\n viewportRef={(v: ScreenViewport) => {\r\n this.viewport = v;\r\n // for convenience, if window defined bind viewport to window\r\n if (undefined !== window)\r\n (window as any).viewport = v;\r\n if (!FrontstageManager.isLoading)\r\n FrontstageManager.activeFrontstageDef?.setActiveViewFromViewport(v);\r\n }}\r\n getViewOverlay={this._getViewOverlay}\r\n />;\r\n }\r\n\r\n /** Get the React component that will be shown when no iModel data is available */\r\n protected getNoContentReactElement(_options: IModelViewportControlOptions): React.ReactNode {\r\n const noContent = UiFramework.translate(\"general.no-content\");\r\n return <FillCentered> {noContent} </FillCentered>;\r\n }\r\n\r\n /** Get the React.Element for a ViewSelector change. */\r\n public override getReactElementForViewSelectorChange(iModelConnection: IModelConnection, _unusedViewDefinitionId: Id64String, viewState: ViewState, _name: string): React.ReactNode {\r\n return this.getImodelViewportReactElement(iModelConnection, viewState);\r\n }\r\n\r\n /** Get the default ViewOverlay unless parameter is set to not use it. May be override in an application specific sub-class */\r\n protected _getViewOverlay = (vp: ScreenViewport): React.ReactNode => {\r\n return <ViewOverlayHost viewport={vp} featureOptions={this._featureOptions} userSuppliedOverlay={this._userSuppliedViewOverlay} data-testid=\"ViewOverlay\"/>;\r\n };\r\n\r\n /** Get the NavigationAidControl associated with this ContentControl */\r\n public override get navigationAidControl(): string {\r\n if (this.viewport)\r\n return super.navigationAidControl;\r\n else\r\n return StandardRotationNavigationAidControl.navigationAidId;\r\n }\r\n}\r\n\r\nConfigurableUiManager.registerControl(IModelViewportControl.id, IModelViewportControl);\r\n"]}
1
+ {"version":3,"file":"IModelViewport.js","sourceRoot":"","sources":["../../../../src/appui-react/content/IModelViewport.t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,CAAC;IAChE,CAAC;CACF;AA9HD,sDA8HC;AAED,6CAAqB,CAAC,eAAe,CAAC,qBAAqB,CAAC,EAAE,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ContentView\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { IModelConnection, ScreenViewport, ViewState } from \"@itwin/core-frontend\";\r\nimport { viewWithUnifiedSelection } from \"@itwin/presentation-components\";\r\nimport { ViewportComponent, ViewStateProp } from \"@itwin/imodel-components-react\";\r\nimport { FillCentered } from \"@itwin/core-react\";\r\n\r\nimport { FrontstageManager } from \"../frontstage/FrontstageManager\";\r\nimport { ConfigurableCreateInfo } from \"../configurableui/ConfigurableUiControl\";\r\nimport { ConfigurableUiManager } from \"../configurableui/ConfigurableUiManager\";\r\nimport { connectIModelConnectionAndViewState } from \"../redux/connectIModel\";\r\nimport { UiFramework } from \"../UiFramework\";\r\nimport { DefaultViewOverlay } from \"./DefaultViewOverlay\";\r\nimport { ViewportContentControl } from \"./ViewportContentControl\";\r\nimport { StandardRotationNavigationAidControl } from \"../navigationaids/StandardRotationNavigationAid\";\r\nimport { UiError } from \"@itwin/appui-abstract\";\r\nimport { useSelector } from \"react-redux\";\r\nimport { FrameworkState } from \"../redux/FrameworkState\";\r\n\r\n// create a HOC viewport component that supports unified selection\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst UnifiedSelectionViewport = viewWithUnifiedSelection(ViewportComponent);\r\n\r\n/** Viewport that is connected to the IModelConnection property in the Redux store. The application must set up the Redux store and include the FrameworkReducer.\r\n * @public\r\n */\r\nexport const IModelConnectedViewport = connectIModelConnectionAndViewState(null, null)(UnifiedSelectionViewport); // eslint-disable-line @typescript-eslint/naming-convention\r\n\r\n/** [[IModelViewportControl]] options. These options are set in the applicationData property of the [[ContentProps]].\r\n * @public\r\n */\r\nexport interface IModelViewportControlOptions {\r\n /** ViewState or a function to return a ViewState */\r\n viewState?: ViewStateProp;\r\n /** IModelConnection of data in Viewport */\r\n iModelConnection?: IModelConnection | (() => IModelConnection);\r\n /** Map of options that can be used to enable/disable features within the view */\r\n featureOptions?: { [key: string]: any };\r\n /** Optional background color which may be used if viewState and iModelConnection are undefined */\r\n bgColor?: string;\r\n /** Optional property to always use the supplied `viewState` property instead of using viewport.view when set */\r\n alwaysUseSuppliedViewState?: boolean;\r\n /** Optional property to supply custom view overlay. Uses when caller want to supply custom overlay component. */\r\n supplyViewOverlay?: (_viewport: ScreenViewport) => React.ReactNode;\r\n /** Optional property to defer reactNode initialization until first reactNode property in needed. Useful when subclassing the `IModelViewportControl`. */\r\n deferNodeInitialization?: boolean;\r\n}\r\n\r\ninterface ViewOverlayHostProps {\r\n viewport: ScreenViewport;\r\n featureOptions?: { [key: string]: any };\r\n userSuppliedOverlay?: (_viewport: ScreenViewport) => React.ReactNode;\r\n}\r\n/** View Overlay component -- exported for testing\r\n * @internal\r\n */\r\n// istanbul ignore next\r\nexport function ViewOverlayHost({viewport, featureOptions, userSuppliedOverlay}: ViewOverlayHostProps) {\r\n const displayViewOverlay = useSelector((state: FrameworkState) => {\r\n const frameworkState = (state as any)[UiFramework.frameworkStateKey];\r\n return frameworkState ? frameworkState.configurableUiState.viewOverlayDisplay : true;\r\n });\r\n if (!displayViewOverlay)\r\n return null;\r\n return userSuppliedOverlay ? <React.Fragment>{userSuppliedOverlay(viewport)}</React.Fragment> : <DefaultViewOverlay viewport={viewport} featureOptions={featureOptions} />;\r\n}\r\n/** iModel Viewport Control\r\n * @public\r\n */\r\n// istanbul ignore next\r\nexport class IModelViewportControl extends ViewportContentControl {\r\n public static get id() {\r\n return \"UiFramework.IModelViewportControl\";\r\n }\r\n protected _featureOptions: { [key: string]: boolean | string } = {};\r\n protected _viewState: ViewStateProp | undefined;\r\n protected _iModelConnection: IModelConnection | undefined;\r\n protected _alwaysUseSuppliedViewState: boolean;\r\n private _userSuppliedViewOverlay?: (_viewport: ScreenViewport) => React.ReactNode;\r\n\r\n constructor(info: ConfigurableCreateInfo, protected _options: IModelViewportControlOptions) {\r\n super(info, _options);\r\n\r\n if (_options.featureOptions)\r\n this._featureOptions = _options.featureOptions;\r\n this._alwaysUseSuppliedViewState = _options.alwaysUseSuppliedViewState ?? false;\r\n this._userSuppliedViewOverlay = _options.supplyViewOverlay;\r\n\r\n if (!_options.deferNodeInitialization)\r\n this.initializeReactNode();\r\n }\r\n\r\n protected initializeReactNode() {\r\n const options = this._options;\r\n\r\n if (options.viewState)\r\n this._viewState = options.viewState;\r\n\r\n const iModelConnection = (typeof options.iModelConnection === \"function\") ? options.iModelConnection() : options.iModelConnection;\r\n\r\n if (this._viewState && iModelConnection) {\r\n /** Passing _determineViewState as a function reference; it is not called here. */\r\n this._reactNode = this.getImodelViewportReactElement(iModelConnection, this._determineViewState);\r\n } else {\r\n if (UiFramework.getIModelConnection() && UiFramework.getDefaultViewState()) {\r\n this._reactNode = this.getImodelConnectedViewportReactElement();\r\n } else {\r\n this._reactNode = this.getNoContentReactElement(options);\r\n this.setIsReady();\r\n }\r\n }\r\n }\r\n\r\n protected override getReactNode(): React.ReactNode {\r\n if (!React.isValidElement(this._reactNode) && this._options.deferNodeInitialization)\r\n this.initializeReactNode();\r\n\r\n return this.getKeyedReactNode();\r\n }\r\n\r\n /**\r\n * This is passed as a function to the ViewportComponent as the `viewState` prop in getImodelViewportReactElement().\r\n * It is called by ViewportComponent on a mount to resolve the viewState.\r\n */\r\n private _determineViewState = (): ViewState => {\r\n let viewState: ViewState;\r\n\r\n if (this.viewport && !this._alwaysUseSuppliedViewState)\r\n viewState = this.viewport.view;\r\n else if (this._viewState) {\r\n if (typeof this._viewState === \"function\")\r\n viewState = this._viewState();\r\n else\r\n viewState = this._viewState;\r\n } else\r\n throw new UiError(UiFramework.loggerCategory(this), \"No ViewState could be determined\");\r\n\r\n return viewState!;\r\n };\r\n\r\n /** Get the React component that will contain the Viewport */\r\n protected getImodelConnectedViewportReactElement(): React.ReactNode {\r\n return <IModelConnectedViewport\r\n viewportRef={(v: ScreenViewport) => {\r\n this.viewport = v;\r\n // for convenience, if window defined bind viewport to window\r\n if (undefined !== window)\r\n (window as any).viewport = v;\r\n if (!FrontstageManager.isLoading)\r\n FrontstageManager.activeFrontstageDef?.setActiveViewFromViewport(v);\r\n }}\r\n getViewOverlay={this._getViewOverlay}\r\n />;\r\n }\r\n\r\n /** Get the React component that will contain the Viewport */\r\n protected getImodelViewportReactElement(iModelConnection: IModelConnection, viewState: ViewStateProp): React.ReactNode {\r\n return <UnifiedSelectionViewport\r\n viewState={viewState}\r\n imodel={iModelConnection}\r\n controlId={this.controlId}\r\n viewportRef={(v: ScreenViewport) => {\r\n this.viewport = v;\r\n // for convenience, if window defined bind viewport to window\r\n if (undefined !== window)\r\n (window as any).viewport = v;\r\n if (!FrontstageManager.isLoading)\r\n FrontstageManager.activeFrontstageDef?.setActiveViewFromViewport(v);\r\n }}\r\n getViewOverlay={this._getViewOverlay}\r\n />;\r\n }\r\n\r\n /** Get the React component that will be shown when no iModel data is available */\r\n protected getNoContentReactElement(_options: IModelViewportControlOptions): React.ReactNode {\r\n const noContent = UiFramework.translate(\"general.no-content\");\r\n return <FillCentered> {noContent} </FillCentered>;\r\n }\r\n\r\n /** Get the React.Element for a ViewSelector change. */\r\n public override getReactElementForViewSelectorChange(iModelConnection: IModelConnection, _unusedViewDefinitionId: Id64String, viewState: ViewState, _name: string): React.ReactNode {\r\n return this.getImodelViewportReactElement(iModelConnection, viewState);\r\n }\r\n\r\n /** Get the default ViewOverlay unless parameter is set to not use it. May be override in an application specific sub-class */\r\n protected _getViewOverlay = (vp: ScreenViewport): React.ReactNode => {\r\n return <ViewOverlayHost viewport={vp} featureOptions={this._featureOptions} userSuppliedOverlay={this._userSuppliedViewOverlay} data-testid=\"ViewOverlay\"/>;\r\n };\r\n\r\n /** Get the NavigationAidControl associated with this ContentControl */\r\n public override get navigationAidControl(): string {\r\n if (this.viewport)\r\n return super.navigationAidControl;\r\n else\r\n return StandardRotationNavigationAidControl.navigationAidId;\r\n }\r\n}\r\n\r\nConfigurableUiManager.registerControl(IModelViewportControl.id, IModelViewportControl);\r\n"]}
@@ -127,7 +127,7 @@
127
127
  "isRequired": true
128
128
  }
129
129
  ],
130
- "instanceFilter": "(parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)) AND NOT this.IsPrivate AND json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") = NULL AND json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") = NULL AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"BisCore:GeometricElement3d\")",
130
+ "instanceFilter": "(parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)) AND NOT this.IsPrivate AND json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") = NULL AND json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") = NULL AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"BisCore:Element\")",
131
131
  "groupByClass": false,
132
132
  "groupByLabel": false
133
133
  }
@@ -171,7 +171,7 @@
171
171
  "isRequired": true
172
172
  }
173
173
  ],
174
- "instanceFilter": "(parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)) AND NOT this.IsPrivate AND (json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") <> NULL OR json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") <> NULL) AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"BisCore:GeometricElement3d\")",
174
+ "instanceFilter": "(parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)) AND NOT this.IsPrivate AND (json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") <> NULL OR json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") <> NULL) AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"BisCore:Element\")",
175
175
  "hideNodesInHierarchy": true,
176
176
  "groupByClass": false,
177
177
  "groupByLabel": false
@@ -211,7 +211,7 @@
211
211
  }
212
212
  }
213
213
  ],
214
- "instanceFilter": "NOT this.IsPrivate AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"BisCore:GeometricElement3d\")",
214
+ "instanceFilter": "NOT this.IsPrivate AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"BisCore:Element\")",
215
215
  "groupByClass": false,
216
216
  "groupByLabel": false
217
217
  }
@@ -36,7 +36,7 @@ export function ViewOverlayHost({ viewport, featureOptions, userSuppliedOverlay
36
36
  });
37
37
  if (!displayViewOverlay)
38
38
  return null;
39
- return userSuppliedOverlay ? React.createElement(React.Fragment, null, "userSuppliedOverlay(viewport)") : React.createElement(DefaultViewOverlay, { viewport: viewport, featureOptions: featureOptions });
39
+ return userSuppliedOverlay ? React.createElement(React.Fragment, null, userSuppliedOverlay(viewport)) : React.createElement(DefaultViewOverlay, { viewport: viewport, featureOptions: featureOptions });
40
40
  }
41
41
  /** iModel Viewport Control
42
42
  * @public
@@ -1 +1 @@
1
- {"version":3,"file":"IModelViewport.js","sourceRoot":"","sources":["../../../../src/appui-react/content/IModelViewport.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,wBAAwB,EAAE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IAED,uDAAuD;IACvC,oCAAoC,CAAC,gBAAkC,EAAE,uBAAmC,EAAE,SAAoB,EAAE,KAAa;QAC/J,OAAO,IAAI,CAAC,6BAA6B,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;IACzE,CAAC;IAOD,uEAAuE;IACvE,IAAoB,oBAAoB;QACtC,IAAI,IAAI,CAAC,QAAQ;YACf,OAAO,KAAK,CAAC,oBAAoB,CAAC;;YAElC,OAAO,oCAAoC,CAAC,eAAe,CAAC;IAChE,CAAC;CACF;AAED,qBAAqB,CAAC,eAAe,CAAC,qBAAqB,CAAC,EAAE,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ContentView\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { IModelConnection, ScreenViewport, ViewState } from \"@itwin/core-frontend\";\r\nimport { viewWithUnifiedSelection } from \"@itwin/presentation-components\";\r\nimport { ViewportComponent, ViewStateProp } from \"@itwin/imodel-components-react\";\r\nimport { FillCentered } from \"@itwin/core-react\";\r\n\r\nimport { FrontstageManager } from \"../frontstage/FrontstageManager\";\r\nimport { ConfigurableCreateInfo } from \"../configurableui/ConfigurableUiControl\";\r\nimport { ConfigurableUiManager } from \"../configurableui/ConfigurableUiManager\";\r\nimport { connectIModelConnectionAndViewState } from \"../redux/connectIModel\";\r\nimport { UiFramework } from \"../UiFramework\";\r\nimport { DefaultViewOverlay } from \"./DefaultViewOverlay\";\r\nimport { ViewportContentControl } from \"./ViewportContentControl\";\r\nimport { StandardRotationNavigationAidControl } from \"../navigationaids/StandardRotationNavigationAid\";\r\nimport { UiError } from \"@itwin/appui-abstract\";\r\nimport { useSelector } from \"react-redux\";\r\nimport { FrameworkState } from \"../redux/FrameworkState\";\r\n\r\n// create a HOC viewport component that supports unified selection\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst UnifiedSelectionViewport = viewWithUnifiedSelection(ViewportComponent);\r\n\r\n/** Viewport that is connected to the IModelConnection property in the Redux store. The application must set up the Redux store and include the FrameworkReducer.\r\n * @public\r\n */\r\nexport const IModelConnectedViewport = connectIModelConnectionAndViewState(null, null)(UnifiedSelectionViewport); // eslint-disable-line @typescript-eslint/naming-convention\r\n\r\n/** [[IModelViewportControl]] options. These options are set in the applicationData property of the [[ContentProps]].\r\n * @public\r\n */\r\nexport interface IModelViewportControlOptions {\r\n /** ViewState or a function to return a ViewState */\r\n viewState?: ViewStateProp;\r\n /** IModelConnection of data in Viewport */\r\n iModelConnection?: IModelConnection | (() => IModelConnection);\r\n /** Map of options that can be used to enable/disable features within the view */\r\n featureOptions?: { [key: string]: any };\r\n /** Optional background color which may be used if viewState and iModelConnection are undefined */\r\n bgColor?: string;\r\n /** Optional property to always use the supplied `viewState` property instead of using viewport.view when set */\r\n alwaysUseSuppliedViewState?: boolean;\r\n /** Optional property to supply custom view overlay. Uses when caller want to supply custom overlay component. */\r\n supplyViewOverlay?: (_viewport: ScreenViewport) => React.ReactNode;\r\n /** Optional property to defer reactNode initialization until first reactNode property in needed. Useful when subclassing the `IModelViewportControl`. */\r\n deferNodeInitialization?: boolean;\r\n}\r\n\r\ninterface ViewOverlayHostProps {\r\n viewport: ScreenViewport;\r\n featureOptions?: { [key: string]: any };\r\n userSuppliedOverlay?: (_viewport: ScreenViewport) => React.ReactNode;\r\n}\r\n/** View Overlay component -- exported for testing\r\n * @internal\r\n */\r\n// istanbul ignore next\r\nexport function ViewOverlayHost({viewport, featureOptions, userSuppliedOverlay}: ViewOverlayHostProps) {\r\n const displayViewOverlay = useSelector((state: FrameworkState) => {\r\n const frameworkState = (state as any)[UiFramework.frameworkStateKey];\r\n return frameworkState ? frameworkState.configurableUiState.viewOverlayDisplay : true;\r\n });\r\n if (!displayViewOverlay)\r\n return null;\r\n return userSuppliedOverlay ? <React.Fragment>userSuppliedOverlay(viewport)</React.Fragment> : <DefaultViewOverlay viewport={viewport} featureOptions={featureOptions} />;\r\n}\r\n/** iModel Viewport Control\r\n * @public\r\n */\r\n// istanbul ignore next\r\nexport class IModelViewportControl extends ViewportContentControl {\r\n public static get id() {\r\n return \"UiFramework.IModelViewportControl\";\r\n }\r\n protected _featureOptions: { [key: string]: boolean | string } = {};\r\n protected _viewState: ViewStateProp | undefined;\r\n protected _iModelConnection: IModelConnection | undefined;\r\n protected _alwaysUseSuppliedViewState: boolean;\r\n private _userSuppliedViewOverlay?: (_viewport: ScreenViewport) => React.ReactNode;\r\n\r\n constructor(info: ConfigurableCreateInfo, protected _options: IModelViewportControlOptions) {\r\n super(info, _options);\r\n\r\n if (_options.featureOptions)\r\n this._featureOptions = _options.featureOptions;\r\n this._alwaysUseSuppliedViewState = _options.alwaysUseSuppliedViewState ?? false;\r\n this._userSuppliedViewOverlay = _options.supplyViewOverlay;\r\n\r\n if (!_options.deferNodeInitialization)\r\n this.initializeReactNode();\r\n }\r\n\r\n protected initializeReactNode() {\r\n const options = this._options;\r\n\r\n if (options.viewState)\r\n this._viewState = options.viewState;\r\n\r\n const iModelConnection = (typeof options.iModelConnection === \"function\") ? options.iModelConnection() : options.iModelConnection;\r\n\r\n if (this._viewState && iModelConnection) {\r\n /** Passing _determineViewState as a function reference; it is not called here. */\r\n this._reactNode = this.getImodelViewportReactElement(iModelConnection, this._determineViewState);\r\n } else {\r\n if (UiFramework.getIModelConnection() && UiFramework.getDefaultViewState()) {\r\n this._reactNode = this.getImodelConnectedViewportReactElement();\r\n } else {\r\n this._reactNode = this.getNoContentReactElement(options);\r\n this.setIsReady();\r\n }\r\n }\r\n }\r\n\r\n protected override getReactNode(): React.ReactNode {\r\n if (!React.isValidElement(this._reactNode) && this._options.deferNodeInitialization)\r\n this.initializeReactNode();\r\n\r\n return this.getKeyedReactNode();\r\n }\r\n\r\n /**\r\n * This is passed as a function to the ViewportComponent as the `viewState` prop in getImodelViewportReactElement().\r\n * It is called by ViewportComponent on a mount to resolve the viewState.\r\n */\r\n private _determineViewState = (): ViewState => {\r\n let viewState: ViewState;\r\n\r\n if (this.viewport && !this._alwaysUseSuppliedViewState)\r\n viewState = this.viewport.view;\r\n else if (this._viewState) {\r\n if (typeof this._viewState === \"function\")\r\n viewState = this._viewState();\r\n else\r\n viewState = this._viewState;\r\n } else\r\n throw new UiError(UiFramework.loggerCategory(this), \"No ViewState could be determined\");\r\n\r\n return viewState!;\r\n };\r\n\r\n /** Get the React component that will contain the Viewport */\r\n protected getImodelConnectedViewportReactElement(): React.ReactNode {\r\n return <IModelConnectedViewport\r\n viewportRef={(v: ScreenViewport) => {\r\n this.viewport = v;\r\n // for convenience, if window defined bind viewport to window\r\n if (undefined !== window)\r\n (window as any).viewport = v;\r\n if (!FrontstageManager.isLoading)\r\n FrontstageManager.activeFrontstageDef?.setActiveViewFromViewport(v);\r\n }}\r\n getViewOverlay={this._getViewOverlay}\r\n />;\r\n }\r\n\r\n /** Get the React component that will contain the Viewport */\r\n protected getImodelViewportReactElement(iModelConnection: IModelConnection, viewState: ViewStateProp): React.ReactNode {\r\n return <UnifiedSelectionViewport\r\n viewState={viewState}\r\n imodel={iModelConnection}\r\n controlId={this.controlId}\r\n viewportRef={(v: ScreenViewport) => {\r\n this.viewport = v;\r\n // for convenience, if window defined bind viewport to window\r\n if (undefined !== window)\r\n (window as any).viewport = v;\r\n if (!FrontstageManager.isLoading)\r\n FrontstageManager.activeFrontstageDef?.setActiveViewFromViewport(v);\r\n }}\r\n getViewOverlay={this._getViewOverlay}\r\n />;\r\n }\r\n\r\n /** Get the React component that will be shown when no iModel data is available */\r\n protected getNoContentReactElement(_options: IModelViewportControlOptions): React.ReactNode {\r\n const noContent = UiFramework.translate(\"general.no-content\");\r\n return <FillCentered> {noContent} </FillCentered>;\r\n }\r\n\r\n /** Get the React.Element for a ViewSelector change. */\r\n public override getReactElementForViewSelectorChange(iModelConnection: IModelConnection, _unusedViewDefinitionId: Id64String, viewState: ViewState, _name: string): React.ReactNode {\r\n return this.getImodelViewportReactElement(iModelConnection, viewState);\r\n }\r\n\r\n /** Get the default ViewOverlay unless parameter is set to not use it. May be override in an application specific sub-class */\r\n protected _getViewOverlay = (vp: ScreenViewport): React.ReactNode => {\r\n return <ViewOverlayHost viewport={vp} featureOptions={this._featureOptions} userSuppliedOverlay={this._userSuppliedViewOverlay} data-testid=\"ViewOverlay\"/>;\r\n };\r\n\r\n /** Get the NavigationAidControl associated with this ContentControl */\r\n public override get navigationAidControl(): string {\r\n if (this.viewport)\r\n return super.navigationAidControl;\r\n else\r\n return StandardRotationNavigationAidControl.navigationAidId;\r\n }\r\n}\r\n\r\nConfigurableUiManager.registerControl(IModelViewportControl.id, IModelViewportControl);\r\n"]}
1
+ {"version":3,"file":"IModelViewport.js","sourceRoot":"","sources":["../../../../src/appui-react/content/IModelViewport.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAiB,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,mCAAmC,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,oCAAoC,EAAE,MAAM,iDAAiD,CAAC;AACvG,OAAO,EAAE,OAA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e,GACpC,CAAC;IACL,CAAC;IAED,6DAA6D;IACnD,6BAA6B,CAAC,gBAAkC,EAAE,SAAwB;QAClG,OAAO,oBAAC,wBAAwB,IAC9B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,WAAW,EAAE,CAAC,CAAiB,EAAE,EAAE;;gBACjC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;gBAClB,6DAA6D;gBAC7D,IAAI,SAAS,KAAK,MAAM;oBACrB,MAAc,CAAC,QAAQ,GAAG,CAAC,CAAC;gBAC/B,IAAI,CAAC,iBAAiB,CAAC,SAAS;oBAC9B,MAAA,iBAAiB,CAAC,mBAAmB,0CAAE,yBAAyB,CAAC,CAAC,CAAC,CAAC;YACxE,CAAC,EACD,cAAc,EAAE,IAAI,CAAC,eAAe,GACpC,CAAC;IACL,CAAC;IAED,kFAAkF;IACxE,wBAAwB,CAAC,QAAsC;QACvE,MAAM,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;QAC9D,OAAO,oBAAC,YAAY;;YAAG,SAAS;gBAAiB,CAAC;IACpD,CAAC;IAED,uDAAuD;IACvC,oCAAoC,CAAC,gBAAkC,EAAE,uBAAmC,EAAE,SAAoB,EAAE,KAAa;QAC/J,OAAO,IAAI,CAAC,6BAA6B,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;IACzE,CAAC;IAOD,uEAAuE;IACvE,IAAoB,oBAAoB;QACtC,IAAI,IAAI,CAAC,QAAQ;YACf,OAAO,KAAK,CAAC,oBAAoB,CAAC;;YAElC,OAAO,oCAAoC,CAAC,eAAe,CAAC;IAChE,CAAC;CACF;AAED,qBAAqB,CAAC,eAAe,CAAC,qBAAqB,CAAC,EAAE,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module ContentView\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { Id64String } from \"@itwin/core-bentley\";\r\nimport { IModelConnection, ScreenViewport, ViewState } from \"@itwin/core-frontend\";\r\nimport { viewWithUnifiedSelection } from \"@itwin/presentation-components\";\r\nimport { ViewportComponent, ViewStateProp } from \"@itwin/imodel-components-react\";\r\nimport { FillCentered } from \"@itwin/core-react\";\r\n\r\nimport { FrontstageManager } from \"../frontstage/FrontstageManager\";\r\nimport { ConfigurableCreateInfo } from \"../configurableui/ConfigurableUiControl\";\r\nimport { ConfigurableUiManager } from \"../configurableui/ConfigurableUiManager\";\r\nimport { connectIModelConnectionAndViewState } from \"../redux/connectIModel\";\r\nimport { UiFramework } from \"../UiFramework\";\r\nimport { DefaultViewOverlay } from \"./DefaultViewOverlay\";\r\nimport { ViewportContentControl } from \"./ViewportContentControl\";\r\nimport { StandardRotationNavigationAidControl } from \"../navigationaids/StandardRotationNavigationAid\";\r\nimport { UiError } from \"@itwin/appui-abstract\";\r\nimport { useSelector } from \"react-redux\";\r\nimport { FrameworkState } from \"../redux/FrameworkState\";\r\n\r\n// create a HOC viewport component that supports unified selection\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nconst UnifiedSelectionViewport = viewWithUnifiedSelection(ViewportComponent);\r\n\r\n/** Viewport that is connected to the IModelConnection property in the Redux store. The application must set up the Redux store and include the FrameworkReducer.\r\n * @public\r\n */\r\nexport const IModelConnectedViewport = connectIModelConnectionAndViewState(null, null)(UnifiedSelectionViewport); // eslint-disable-line @typescript-eslint/naming-convention\r\n\r\n/** [[IModelViewportControl]] options. These options are set in the applicationData property of the [[ContentProps]].\r\n * @public\r\n */\r\nexport interface IModelViewportControlOptions {\r\n /** ViewState or a function to return a ViewState */\r\n viewState?: ViewStateProp;\r\n /** IModelConnection of data in Viewport */\r\n iModelConnection?: IModelConnection | (() => IModelConnection);\r\n /** Map of options that can be used to enable/disable features within the view */\r\n featureOptions?: { [key: string]: any };\r\n /** Optional background color which may be used if viewState and iModelConnection are undefined */\r\n bgColor?: string;\r\n /** Optional property to always use the supplied `viewState` property instead of using viewport.view when set */\r\n alwaysUseSuppliedViewState?: boolean;\r\n /** Optional property to supply custom view overlay. Uses when caller want to supply custom overlay component. */\r\n supplyViewOverlay?: (_viewport: ScreenViewport) => React.ReactNode;\r\n /** Optional property to defer reactNode initialization until first reactNode property in needed. Useful when subclassing the `IModelViewportControl`. */\r\n deferNodeInitialization?: boolean;\r\n}\r\n\r\ninterface ViewOverlayHostProps {\r\n viewport: ScreenViewport;\r\n featureOptions?: { [key: string]: any };\r\n userSuppliedOverlay?: (_viewport: ScreenViewport) => React.ReactNode;\r\n}\r\n/** View Overlay component -- exported for testing\r\n * @internal\r\n */\r\n// istanbul ignore next\r\nexport function ViewOverlayHost({viewport, featureOptions, userSuppliedOverlay}: ViewOverlayHostProps) {\r\n const displayViewOverlay = useSelector((state: FrameworkState) => {\r\n const frameworkState = (state as any)[UiFramework.frameworkStateKey];\r\n return frameworkState ? frameworkState.configurableUiState.viewOverlayDisplay : true;\r\n });\r\n if (!displayViewOverlay)\r\n return null;\r\n return userSuppliedOverlay ? <React.Fragment>{userSuppliedOverlay(viewport)}</React.Fragment> : <DefaultViewOverlay viewport={viewport} featureOptions={featureOptions} />;\r\n}\r\n/** iModel Viewport Control\r\n * @public\r\n */\r\n// istanbul ignore next\r\nexport class IModelViewportControl extends ViewportContentControl {\r\n public static get id() {\r\n return \"UiFramework.IModelViewportControl\";\r\n }\r\n protected _featureOptions: { [key: string]: boolean | string } = {};\r\n protected _viewState: ViewStateProp | undefined;\r\n protected _iModelConnection: IModelConnection | undefined;\r\n protected _alwaysUseSuppliedViewState: boolean;\r\n private _userSuppliedViewOverlay?: (_viewport: ScreenViewport) => React.ReactNode;\r\n\r\n constructor(info: ConfigurableCreateInfo, protected _options: IModelViewportControlOptions) {\r\n super(info, _options);\r\n\r\n if (_options.featureOptions)\r\n this._featureOptions = _options.featureOptions;\r\n this._alwaysUseSuppliedViewState = _options.alwaysUseSuppliedViewState ?? false;\r\n this._userSuppliedViewOverlay = _options.supplyViewOverlay;\r\n\r\n if (!_options.deferNodeInitialization)\r\n this.initializeReactNode();\r\n }\r\n\r\n protected initializeReactNode() {\r\n const options = this._options;\r\n\r\n if (options.viewState)\r\n this._viewState = options.viewState;\r\n\r\n const iModelConnection = (typeof options.iModelConnection === \"function\") ? options.iModelConnection() : options.iModelConnection;\r\n\r\n if (this._viewState && iModelConnection) {\r\n /** Passing _determineViewState as a function reference; it is not called here. */\r\n this._reactNode = this.getImodelViewportReactElement(iModelConnection, this._determineViewState);\r\n } else {\r\n if (UiFramework.getIModelConnection() && UiFramework.getDefaultViewState()) {\r\n this._reactNode = this.getImodelConnectedViewportReactElement();\r\n } else {\r\n this._reactNode = this.getNoContentReactElement(options);\r\n this.setIsReady();\r\n }\r\n }\r\n }\r\n\r\n protected override getReactNode(): React.ReactNode {\r\n if (!React.isValidElement(this._reactNode) && this._options.deferNodeInitialization)\r\n this.initializeReactNode();\r\n\r\n return this.getKeyedReactNode();\r\n }\r\n\r\n /**\r\n * This is passed as a function to the ViewportComponent as the `viewState` prop in getImodelViewportReactElement().\r\n * It is called by ViewportComponent on a mount to resolve the viewState.\r\n */\r\n private _determineViewState = (): ViewState => {\r\n let viewState: ViewState;\r\n\r\n if (this.viewport && !this._alwaysUseSuppliedViewState)\r\n viewState = this.viewport.view;\r\n else if (this._viewState) {\r\n if (typeof this._viewState === \"function\")\r\n viewState = this._viewState();\r\n else\r\n viewState = this._viewState;\r\n } else\r\n throw new UiError(UiFramework.loggerCategory(this), \"No ViewState could be determined\");\r\n\r\n return viewState!;\r\n };\r\n\r\n /** Get the React component that will contain the Viewport */\r\n protected getImodelConnectedViewportReactElement(): React.ReactNode {\r\n return <IModelConnectedViewport\r\n viewportRef={(v: ScreenViewport) => {\r\n this.viewport = v;\r\n // for convenience, if window defined bind viewport to window\r\n if (undefined !== window)\r\n (window as any).viewport = v;\r\n if (!FrontstageManager.isLoading)\r\n FrontstageManager.activeFrontstageDef?.setActiveViewFromViewport(v);\r\n }}\r\n getViewOverlay={this._getViewOverlay}\r\n />;\r\n }\r\n\r\n /** Get the React component that will contain the Viewport */\r\n protected getImodelViewportReactElement(iModelConnection: IModelConnection, viewState: ViewStateProp): React.ReactNode {\r\n return <UnifiedSelectionViewport\r\n viewState={viewState}\r\n imodel={iModelConnection}\r\n controlId={this.controlId}\r\n viewportRef={(v: ScreenViewport) => {\r\n this.viewport = v;\r\n // for convenience, if window defined bind viewport to window\r\n if (undefined !== window)\r\n (window as any).viewport = v;\r\n if (!FrontstageManager.isLoading)\r\n FrontstageManager.activeFrontstageDef?.setActiveViewFromViewport(v);\r\n }}\r\n getViewOverlay={this._getViewOverlay}\r\n />;\r\n }\r\n\r\n /** Get the React component that will be shown when no iModel data is available */\r\n protected getNoContentReactElement(_options: IModelViewportControlOptions): React.ReactNode {\r\n const noContent = UiFramework.translate(\"general.no-content\");\r\n return <FillCentered> {noContent} </FillCentered>;\r\n }\r\n\r\n /** Get the React.Element for a ViewSelector change. */\r\n public override getReactElementForViewSelectorChange(iModelConnection: IModelConnection, _unusedViewDefinitionId: Id64String, viewState: ViewState, _name: string): React.ReactNode {\r\n return this.getImodelViewportReactElement(iModelConnection, viewState);\r\n }\r\n\r\n /** Get the default ViewOverlay unless parameter is set to not use it. May be override in an application specific sub-class */\r\n protected _getViewOverlay = (vp: ScreenViewport): React.ReactNode => {\r\n return <ViewOverlayHost viewport={vp} featureOptions={this._featureOptions} userSuppliedOverlay={this._userSuppliedViewOverlay} data-testid=\"ViewOverlay\"/>;\r\n };\r\n\r\n /** Get the NavigationAidControl associated with this ContentControl */\r\n public override get navigationAidControl(): string {\r\n if (this.viewport)\r\n return super.navigationAidControl;\r\n else\r\n return StandardRotationNavigationAidControl.navigationAidId;\r\n }\r\n}\r\n\r\nConfigurableUiManager.registerControl(IModelViewportControl.id, IModelViewportControl);\r\n"]}
@@ -127,7 +127,7 @@
127
127
  "isRequired": true
128
128
  }
129
129
  ],
130
- "instanceFilter": "(parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)) AND NOT this.IsPrivate AND json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") = NULL AND json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") = NULL AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"BisCore:GeometricElement3d\")",
130
+ "instanceFilter": "(parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)) AND NOT this.IsPrivate AND json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") = NULL AND json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") = NULL AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"BisCore:Element\")",
131
131
  "groupByClass": false,
132
132
  "groupByLabel": false
133
133
  }
@@ -171,7 +171,7 @@
171
171
  "isRequired": true
172
172
  }
173
173
  ],
174
- "instanceFilter": "(parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)) AND NOT this.IsPrivate AND (json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") <> NULL OR json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") <> NULL) AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"BisCore:GeometricElement3d\")",
174
+ "instanceFilter": "(parent.ECInstanceId = partition.Parent.Id OR json_extract(parent.JsonProperties, \"$.Subject.Model.TargetPartition\") = printf(\"0x%x\", partition.ECInstanceId)) AND NOT this.IsPrivate AND (json_extract(partition.JsonProperties, \"$.PhysicalPartition.Model.Content\") <> NULL OR json_extract(partition.JsonProperties, \"$.GraphicalPartition3d.Model.Content\") <> NULL) AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"BisCore:Element\")",
175
175
  "hideNodesInHierarchy": true,
176
176
  "groupByClass": false,
177
177
  "groupByLabel": false
@@ -211,7 +211,7 @@
211
211
  }
212
212
  }
213
213
  ],
214
- "instanceFilter": "NOT this.IsPrivate AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"BisCore:GeometricElement3d\")",
214
+ "instanceFilter": "NOT this.IsPrivate AND this.HasRelatedInstance(\"BisCore:ModelContainsElements\", \"Forward\", \"BisCore:Element\")",
215
215
  "groupByClass": false,
216
216
  "groupByLabel": false
217
217
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itwin/appui-react",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "UI framework",
5
5
  "main": "lib/cjs/appui-react.js",
6
6
  "module": "lib/esm/appui-react.js",
@@ -21,19 +21,19 @@
21
21
  "url": "http://www.bentley.com"
22
22
  },
23
23
  "peerDependencies": {
24
- "@itwin/appui-abstract": "^3.0.1",
25
- "@itwin/appui-layout-react": "^3.0.1",
26
- "@itwin/components-react": "^3.0.1",
27
- "@itwin/core-bentley": "^3.0.1",
28
- "@itwin/core-common": "^3.0.1",
29
- "@itwin/core-frontend": "^3.0.1",
30
- "@itwin/core-geometry": "^3.0.1",
31
- "@itwin/core-markup": "^3.0.1",
32
- "@itwin/core-quantity": "^3.0.1",
33
- "@itwin/core-react": "^3.0.1",
34
- "@itwin/imodel-components-react": "^3.0.1",
35
- "@itwin/presentation-common": "^3.0.1",
36
- "@itwin/presentation-frontend": "^3.0.1",
24
+ "@itwin/appui-abstract": "^3.0.2",
25
+ "@itwin/appui-layout-react": "^3.0.2",
26
+ "@itwin/components-react": "^3.0.2",
27
+ "@itwin/core-bentley": "^3.0.2",
28
+ "@itwin/core-common": "^3.0.2",
29
+ "@itwin/core-frontend": "^3.0.2",
30
+ "@itwin/core-geometry": "^3.0.2",
31
+ "@itwin/core-markup": "^3.0.2",
32
+ "@itwin/core-quantity": "^3.0.2",
33
+ "@itwin/core-react": "^3.0.2",
34
+ "@itwin/imodel-components-react": "^3.0.2",
35
+ "@itwin/presentation-common": "^3.0.2",
36
+ "@itwin/presentation-frontend": "^3.0.2",
37
37
  "react": "^17.0.0",
38
38
  "react-dom": "^17.0.0",
39
39
  "react-redux": "^7.2.2",
@@ -44,22 +44,22 @@
44
44
  "NOTE: All tools used by scripts in this package must be listed as devDependencies"
45
45
  ],
46
46
  "devDependencies": {
47
- "@itwin/appui-abstract": "3.0.1",
48
- "@itwin/appui-layout-react": "3.0.1",
49
- "@itwin/build-tools": "3.0.1",
50
- "@itwin/components-react": "3.0.1",
51
- "@itwin/core-bentley": "3.0.1",
52
- "@itwin/core-common": "3.0.1",
53
- "@itwin/core-frontend": "3.0.1",
54
- "@itwin/core-geometry": "3.0.1",
55
- "@itwin/core-markup": "3.0.1",
56
- "@itwin/core-quantity": "3.0.1",
57
- "@itwin/core-react": "3.0.1",
58
- "@itwin/eslint-plugin": "3.0.1",
59
- "@itwin/imodel-components-react": "3.0.1",
60
- "@itwin/presentation-common": "3.0.1",
61
- "@itwin/presentation-frontend": "3.0.1",
62
- "@itwin/presentation-testing": "3.0.1",
47
+ "@itwin/appui-abstract": "3.0.2",
48
+ "@itwin/appui-layout-react": "3.0.2",
49
+ "@itwin/build-tools": "3.0.2",
50
+ "@itwin/components-react": "3.0.2",
51
+ "@itwin/core-bentley": "3.0.2",
52
+ "@itwin/core-common": "3.0.2",
53
+ "@itwin/core-frontend": "3.0.2",
54
+ "@itwin/core-geometry": "3.0.2",
55
+ "@itwin/core-markup": "3.0.2",
56
+ "@itwin/core-quantity": "3.0.2",
57
+ "@itwin/core-react": "3.0.2",
58
+ "@itwin/eslint-plugin": "3.0.2",
59
+ "@itwin/imodel-components-react": "3.0.2",
60
+ "@itwin/presentation-common": "3.0.2",
61
+ "@itwin/presentation-frontend": "3.0.2",
62
+ "@itwin/presentation-testing": "3.0.2",
63
63
  "@testing-library/react": "^12.0.0",
64
64
  "@testing-library/react-hooks": "^7.0.2",
65
65
  "@types/chai": "^4.1.4",
@@ -114,8 +114,8 @@
114
114
  "dependencies": {
115
115
  "@bentley/icons-generic": "^1.0.15",
116
116
  "@bentley/icons-generic-webfont": "^1.0.15",
117
- "@itwin/core-telemetry": "3.0.1",
118
- "@itwin/presentation-components": "3.0.1",
117
+ "@itwin/core-telemetry": "3.0.2",
118
+ "@itwin/presentation-components": "3.0.2",
119
119
  "@itwin/itwinui-css": "^0.37.0",
120
120
  "@itwin/itwinui-react": "~1.28.0",
121
121
  "classnames": "^2.3.1",