@itwin/appui-react 3.1.0-dev.1 → 3.1.0-dev.14
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/lib/cjs/appui-react/backstage/Backstage.d.ts +0 -2
- package/lib/cjs/appui-react/backstage/Backstage.d.ts.map +1 -1
- package/lib/cjs/appui-react/backstage/Backstage.js +0 -1
- package/lib/cjs/appui-react/backstage/Backstage.js.map +1 -1
- package/lib/cjs/appui-react/configurableui/ConfigurableUiContent.d.ts.map +1 -1
- package/lib/cjs/appui-react/configurableui/ConfigurableUiContent.js +2 -0
- package/lib/cjs/appui-react/configurableui/ConfigurableUiContent.js.map +1 -1
- package/lib/cjs/appui-react/configurableui/ConfigurableUiManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/configurableui/ConfigurableUiManager.js +6 -1
- package/lib/cjs/appui-react/configurableui/ConfigurableUiManager.js.map +1 -1
- package/lib/cjs/appui-react/content/ContentControl.d.ts +6 -0
- package/lib/cjs/appui-react/content/ContentControl.d.ts.map +1 -1
- package/lib/cjs/appui-react/content/ContentControl.js +11 -1
- package/lib/cjs/appui-react/content/ContentControl.js.map +1 -1
- package/lib/cjs/appui-react/content/ContentLayout.d.ts +8 -0
- package/lib/cjs/appui-react/content/ContentLayout.d.ts.map +1 -1
- package/lib/cjs/appui-react/content/ContentLayout.js +43 -36
- package/lib/cjs/appui-react/content/ContentLayout.js.map +1 -1
- package/lib/cjs/appui-react/content/ContentLayout.scss +27 -27
- package/lib/cjs/appui-react/content/ContentViewManager.d.ts +7 -0
- package/lib/cjs/appui-react/content/ContentViewManager.d.ts.map +1 -1
- package/lib/cjs/appui-react/content/ContentViewManager.js +46 -22
- package/lib/cjs/appui-react/content/ContentViewManager.js.map +1 -1
- package/lib/cjs/appui-react/content/FloatingViewportContent.css +9 -0
- package/lib/cjs/appui-react/content/FloatingViewportContent.d.ts +25 -0
- package/lib/cjs/appui-react/content/FloatingViewportContent.d.ts.map +1 -0
- package/lib/cjs/appui-react/content/FloatingViewportContent.js +73 -0
- package/lib/cjs/appui-react/content/FloatingViewportContent.js.map +1 -0
- package/lib/cjs/appui-react/content/IModelViewport.d.ts.map +1 -1
- package/lib/cjs/appui-react/content/IModelViewport.js +1 -1
- package/lib/cjs/appui-react/content/IModelViewport.js.map +1 -1
- package/lib/cjs/appui-react/content/ViewportContentControl.d.ts +9 -0
- package/lib/cjs/appui-react/content/ViewportContentControl.d.ts.map +1 -1
- package/lib/cjs/appui-react/content/ViewportContentControl.js +24 -1
- package/lib/cjs/appui-react/content/ViewportContentControl.js.map +1 -1
- package/lib/cjs/appui-react/dialog/ContentDialog.d.ts +24 -0
- package/lib/cjs/appui-react/dialog/ContentDialog.d.ts.map +1 -0
- package/lib/cjs/appui-react/dialog/ContentDialog.js +72 -0
- package/lib/cjs/appui-react/dialog/ContentDialog.js.map +1 -0
- package/lib/cjs/appui-react/dialog/ContentDialog.scss +25 -0
- package/lib/cjs/appui-react/dialog/ContentDialogManager.d.ts +65 -0
- package/lib/cjs/appui-react/dialog/ContentDialogManager.d.ts.map +1 -0
- package/lib/cjs/appui-react/dialog/ContentDialogManager.js +148 -0
- package/lib/cjs/appui-react/dialog/ContentDialogManager.js.map +1 -0
- package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts +4 -0
- package/lib/cjs/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js +33 -6
- package/lib/cjs/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/cjs/appui-react/popup/CardPopup.scss +3 -1
- package/lib/cjs/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
- package/lib/cjs/appui-react/widget-panels/Frontstage.js +10 -5
- package/lib/cjs/appui-react/widget-panels/Frontstage.js.map +1 -1
- package/lib/cjs/appui-react.d.ts +3 -0
- package/lib/cjs/appui-react.d.ts.map +1 -1
- package/lib/cjs/appui-react.js +3 -0
- package/lib/cjs/appui-react.js.map +1 -1
- package/lib/esm/appui-react/backstage/Backstage.d.ts +0 -2
- package/lib/esm/appui-react/backstage/Backstage.d.ts.map +1 -1
- package/lib/esm/appui-react/backstage/Backstage.js +0 -1
- package/lib/esm/appui-react/backstage/Backstage.js.map +1 -1
- package/lib/esm/appui-react/configurableui/ConfigurableUiContent.d.ts.map +1 -1
- package/lib/esm/appui-react/configurableui/ConfigurableUiContent.js +2 -0
- package/lib/esm/appui-react/configurableui/ConfigurableUiContent.js.map +1 -1
- package/lib/esm/appui-react/configurableui/ConfigurableUiManager.d.ts.map +1 -1
- package/lib/esm/appui-react/configurableui/ConfigurableUiManager.js +6 -1
- package/lib/esm/appui-react/configurableui/ConfigurableUiManager.js.map +1 -1
- package/lib/esm/appui-react/content/ContentControl.d.ts +6 -0
- package/lib/esm/appui-react/content/ContentControl.d.ts.map +1 -1
- package/lib/esm/appui-react/content/ContentControl.js +10 -1
- package/lib/esm/appui-react/content/ContentControl.js.map +1 -1
- package/lib/esm/appui-react/content/ContentLayout.d.ts +8 -0
- package/lib/esm/appui-react/content/ContentLayout.d.ts.map +1 -1
- package/lib/esm/appui-react/content/ContentLayout.js +41 -35
- package/lib/esm/appui-react/content/ContentLayout.js.map +1 -1
- package/lib/esm/appui-react/content/ContentLayout.scss +27 -27
- package/lib/esm/appui-react/content/ContentViewManager.d.ts +7 -0
- package/lib/esm/appui-react/content/ContentViewManager.d.ts.map +1 -1
- package/lib/esm/appui-react/content/ContentViewManager.js +46 -22
- package/lib/esm/appui-react/content/ContentViewManager.js.map +1 -1
- package/lib/esm/appui-react/content/FloatingViewportContent.css +9 -0
- package/lib/esm/appui-react/content/FloatingViewportContent.d.ts +25 -0
- package/lib/esm/appui-react/content/FloatingViewportContent.d.ts.map +1 -0
- package/lib/esm/appui-react/content/FloatingViewportContent.js +69 -0
- package/lib/esm/appui-react/content/FloatingViewportContent.js.map +1 -0
- package/lib/esm/appui-react/content/IModelViewport.d.ts.map +1 -1
- package/lib/esm/appui-react/content/IModelViewport.js +1 -1
- package/lib/esm/appui-react/content/IModelViewport.js.map +1 -1
- package/lib/esm/appui-react/content/ViewportContentControl.d.ts +9 -0
- package/lib/esm/appui-react/content/ViewportContentControl.d.ts.map +1 -1
- package/lib/esm/appui-react/content/ViewportContentControl.js +23 -1
- package/lib/esm/appui-react/content/ViewportContentControl.js.map +1 -1
- package/lib/esm/appui-react/dialog/ContentDialog.d.ts +24 -0
- package/lib/esm/appui-react/dialog/ContentDialog.d.ts.map +1 -0
- package/lib/esm/appui-react/dialog/ContentDialog.js +67 -0
- package/lib/esm/appui-react/dialog/ContentDialog.js.map +1 -0
- package/lib/esm/appui-react/dialog/ContentDialog.scss +25 -0
- package/lib/esm/appui-react/dialog/ContentDialogManager.d.ts +65 -0
- package/lib/esm/appui-react/dialog/ContentDialogManager.d.ts.map +1 -0
- package/lib/esm/appui-react/dialog/ContentDialogManager.js +142 -0
- package/lib/esm/appui-react/dialog/ContentDialogManager.js.map +1 -0
- package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts +4 -0
- package/lib/esm/appui-react/frontstage/FrontstageDef.d.ts.map +1 -1
- package/lib/esm/appui-react/frontstage/FrontstageDef.js +33 -6
- package/lib/esm/appui-react/frontstage/FrontstageDef.js.map +1 -1
- package/lib/esm/appui-react/popup/CardPopup.scss +3 -1
- package/lib/esm/appui-react/widget-panels/Frontstage.d.ts.map +1 -1
- package/lib/esm/appui-react/widget-panels/Frontstage.js +10 -5
- package/lib/esm/appui-react/widget-panels/Frontstage.js.map +1 -1
- package/lib/esm/appui-react.d.ts +3 -0
- package/lib/esm/appui-react.d.ts.map +1 -1
- package/lib/esm/appui-react.js +3 -0
- package/lib/esm/appui-react.js.map +1 -1
- package/package.json +33 -33
|
@@ -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,MAA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,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"]}
|
|
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,oC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AC,CAAC;YACxE,CAAC,EACD,cAAc,EAAE,IAAI,CAAC,eAAe,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"]}
|
|
@@ -50,4 +50,13 @@ export declare class ViewportContentControl extends ContentControl implements Su
|
|
|
50
50
|
/** Get the React.Element for a ViewSelector change. */
|
|
51
51
|
getReactElementForViewSelectorChange(_iModel: IModelConnection, _viewDefinitionId: Id64String, _viewState: ViewState, _name: string): React.ReactNode;
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* @beta
|
|
55
|
+
*/
|
|
56
|
+
export declare class FloatingViewportContentControl extends ViewportContentControl {
|
|
57
|
+
constructor(uniqueId: string, name: string, node: React.ReactNode);
|
|
58
|
+
/** The React node associated with this control. */
|
|
59
|
+
get reactNode(): React.ReactNode;
|
|
60
|
+
set reactNode(r: React.ReactNode);
|
|
61
|
+
}
|
|
53
62
|
//# sourceMappingURL=ViewportContentControl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewportContentControl.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/content/ViewportContentControl.ts"],"names":[],"mappings":"AAIA;;GAEG;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACwB,gBAAgB,EAAyB,cAAc,EAAoC,SAAS,EAClI,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"ViewportContentControl.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/content/ViewportContentControl.ts"],"names":[],"mappings":"AAIA;;GAEG;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EACwB,gBAAgB,EAAyB,cAAc,EAAoC,SAAS,EAClI,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAM5G,OAAO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AAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS;IAMjE,mDAAmD;IACnD,IAAoB,SAAS,IAAI,KAAK,CAAC,SAAS,CAE/C;IAED,IAAoB,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,SAAS,EAO/C;CACF"}
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* @module ContentView
|
|
7
7
|
*/
|
|
8
8
|
import { DrawingViewState, IModelApp, OrthographicViewState, SheetViewState, SpatialViewState, } from "@itwin/core-frontend";
|
|
9
|
-
import { ConfigurableUiControlType } from "../configurableui/ConfigurableUiControl";
|
|
9
|
+
import { ConfigurableCreateInfo, ConfigurableUiControlType } from "../configurableui/ConfigurableUiControl";
|
|
10
|
+
import { FrontstageManager } from "../frontstage/FrontstageManager";
|
|
10
11
|
import { CubeNavigationAidControl } from "../navigationaids/CubeNavigationAidControl";
|
|
11
12
|
import { DrawingNavigationAidControl } from "../navigationaids/DrawingNavigationAidControl";
|
|
12
13
|
import { SheetNavigationAidControl } from "../navigationaids/SheetNavigationAid";
|
|
@@ -103,4 +104,25 @@ export class ViewportContentControl extends ContentControl {
|
|
|
103
104
|
// istanbul ignore next
|
|
104
105
|
getReactElementForViewSelectorChange(_iModel, _viewDefinitionId, _viewState, _name) { return null; }
|
|
105
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* @beta
|
|
109
|
+
*/
|
|
110
|
+
export class FloatingViewportContentControl extends ViewportContentControl {
|
|
111
|
+
constructor(uniqueId, name, node) {
|
|
112
|
+
super(new ConfigurableCreateInfo(name, uniqueId, name), undefined);
|
|
113
|
+
this._reactNode = node;
|
|
114
|
+
this.setIsReady();
|
|
115
|
+
}
|
|
116
|
+
/** The React node associated with this control. */
|
|
117
|
+
get reactNode() {
|
|
118
|
+
return this._reactNode;
|
|
119
|
+
}
|
|
120
|
+
set reactNode(r) {
|
|
121
|
+
this._reactNode = r;
|
|
122
|
+
const activeFrontstageDef = FrontstageManager.activeFrontstageDef;
|
|
123
|
+
// istanbul ignore else
|
|
124
|
+
if (this.viewport && activeFrontstageDef)
|
|
125
|
+
activeFrontstageDef.setActiveViewFromViewport(this.viewport);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
106
128
|
//# sourceMappingURL=ViewportContentControl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewportContentControl.js","sourceRoot":"","sources":["../../../../src/appui-react/content/ViewportContentControl.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EACL,gBAAgB,EAAE,SAAS,EAAoB,qBAAqB,EAAkB,cAAc,EAAE,gBAAgB,GACvH,MAAM,sBAAsB,CAAC;AAC9B,OAAO,
|
|
1
|
+
{"version":3,"file":"ViewportContentControl.js","sourceRoot":"","sources":["../../../../src/appui-react/content/ViewportContentControl.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAGH,OAAO,EACL,gBAAgB,EAAE,SAAS,EAAoB,qBAAqB,EAAkB,cAAc,EAAE,gBAAgB,GACvH,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAC5G,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AACtF,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAC5F,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,cAAc,EAA8B,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,OAAO,sBAAuB,SAAQ,cAAc;IAKxD;;;OAGG;IACH,YAAY,IAA4B,EAAE,OAAY;QACpD,KAAK,CAA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B,EAAE,IAAY,EAAE,IAAqB;QAC/D,KAAK,CAAC,IAAI,sBAAsB,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC;QACnE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAED,mDAAmD;IACnD,IAAoB,SAAS;QAC3B,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,IAAoB,SAAS,CAAC,CAAkB;QAC9C,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,mBAAmB,CAAC;QAElE,uBAAuB;QACvB,IAAI,IAAI,CAAC,QAAQ,IAAI,mBAAmB;YACtC,mBAAmB,CAAC,yBAAyB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACjE,CAAC;CACF","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 { Id64String } from \"@itwin/core-bentley\";\r\nimport {\r\n DrawingViewState, IModelApp, IModelConnection, OrthographicViewState, ScreenViewport, SheetViewState, SpatialViewState, ViewState,\r\n} from \"@itwin/core-frontend\";\r\nimport { ConfigurableCreateInfo, ConfigurableUiControlType } from \"../configurableui/ConfigurableUiControl\";\r\nimport { FrontstageManager } from \"../frontstage/FrontstageManager\";\r\nimport { CubeNavigationAidControl } from \"../navigationaids/CubeNavigationAidControl\";\r\nimport { DrawingNavigationAidControl } from \"../navigationaids/DrawingNavigationAidControl\";\r\nimport { SheetNavigationAidControl } from \"../navigationaids/SheetNavigationAid\";\r\nimport { ViewUtilities } from \"../utils/ViewUtilities\";\r\nimport { ContentControl, SupportsViewSelectorChange } from \"./ContentControl\";\r\nimport { ContentViewManager } from \"./ContentViewManager\";\r\n\r\n/**\r\n * The base class for frontstage Viewport content controls that connects to a `ScreenViewport`\r\n * that is managed by the `ViewManager`.\r\n * @public\r\n */\r\nexport class ViewportContentControl extends ContentControl implements SupportsViewSelectorChange {\r\n private _viewport: ScreenViewport | undefined;\r\n private _isReady: Promise<void>;\r\n private _viewportReadyCallback?: () => void;\r\n\r\n /** Creates an instance of ViewportContentControl.\r\n * @param info An object that the subclass must pass to this base class.\r\n * @param options Options provided via the applicationData in a [[ContentProps]].\r\n */\r\n constructor(info: ConfigurableCreateInfo, options: any) {\r\n super(info, options);\r\n\r\n this._isReady = new Promise<void>((onSuccess: () => void, _onFailure: () => void): void => {\r\n this._viewportReadyCallback = onSuccess;\r\n });\r\n }\r\n\r\n /** Gets the type of ConfigurableUiControl, which is 'Viewport' in this case */\r\n public override getType(): ConfigurableUiControlType { return ConfigurableUiControlType.Viewport; }\r\n\r\n /** Returns true if this control is a Viewport control. */\r\n public override get isViewport(): boolean { return true; }\r\n\r\n /** The underlying ScreenViewport */\r\n public override get viewport(): ScreenViewport | undefined { return this._viewport; }\r\n public override set viewport(v: ScreenViewport | undefined) {\r\n this._viewport = v;\r\n this.setIsReady();\r\n }\r\n\r\n /** Returns a promise that resolves when the control is ready for usage.\r\n */\r\n public setIsReady(): void {\r\n // istanbul ignore else\r\n if (this._viewportReadyCallback) {\r\n this._viewportReadyCallback();\r\n }\r\n }\r\n\r\n /** Returns a promise that resolves when the control is ready for usage.\r\n */\r\n public override get isReady(): Promise<void> { return this._isReady; }\r\n\r\n /** Called when this ContentControl is activated */\r\n public override onActivated(): void {\r\n super.onActivated();\r\n }\r\n\r\n /** Get the NavigationAidControl associated with this ContentControl */\r\n public override get navigationAidControl(): string {\r\n let navigationAidId = \"\";\r\n\r\n // istanbul ignore else\r\n if (this.viewport) {\r\n navigationAidId = this._getNavigationAid(this.viewport.view.classFullName);\r\n }\r\n\r\n return navigationAidId;\r\n }\r\n\r\n /**\r\n * Fetches appropriate NavigationAid based on the class of the current viewport.\r\n * @param classFullName The full name of the current viewport class.\r\n * @returns The ID of the navigation aid to be displayed.\r\n */\r\n private _getNavigationAid = (classFullName: string) => {\r\n const className = ViewUtilities.getBisBaseClass(classFullName);\r\n let navigationAidId = \"\";\r\n\r\n switch (className) {\r\n case SheetViewState.className:\r\n navigationAidId = SheetNavigationAidControl.navigationAidId;\r\n break;\r\n case DrawingViewState.className:\r\n navigationAidId = DrawingNavigationAidControl.navigationAidId;\r\n break;\r\n case SpatialViewState.className:\r\n case OrthographicViewState.className:\r\n navigationAidId = CubeNavigationAidControl.navigationAidId;\r\n break;\r\n }\r\n\r\n return navigationAidId;\r\n };\r\n\r\n /** Returns true if this control supports processing ViewSelector changes. */\r\n public get supportsViewSelectorChange(): boolean { return true; }\r\n\r\n /** Process a ViewSelector change. */\r\n // istanbul ignore next\r\n public async processViewSelectorChange(iModel: IModelConnection, viewDefinitionId: Id64String, viewState: ViewState, name: string): Promise<void> {\r\n if (this.viewport) {\r\n if (IModelApp.viewManager && this.viewport === IModelApp.viewManager.selectedView)\r\n this.viewport.changeView(viewState);\r\n } else {\r\n this.reactNode = this.getReactElementForViewSelectorChange(iModel, viewDefinitionId, viewState, name);\r\n }\r\n ContentViewManager.refreshActiveContent(this.reactNode);\r\n }\r\n\r\n /** Get the React.Element for a ViewSelector change. */\r\n // istanbul ignore next\r\n public getReactElementForViewSelectorChange(_iModel: IModelConnection, _viewDefinitionId: Id64String, _viewState: ViewState, _name: string): React.ReactNode { return null; }\r\n}\r\n\r\n/**\r\n * @beta\r\n */\r\nexport class FloatingViewportContentControl extends ViewportContentControl {\r\n constructor(uniqueId: string, name: string, node: React.ReactNode) {\r\n super(new ConfigurableCreateInfo(name, uniqueId, name), undefined);\r\n this._reactNode = node;\r\n this.setIsReady();\r\n }\r\n\r\n /** The React node associated with this control. */\r\n public override get reactNode(): React.ReactNode {\r\n return this._reactNode;\r\n }\r\n\r\n public override set reactNode(r: React.ReactNode) {\r\n this._reactNode = r;\r\n const activeFrontstageDef = FrontstageManager.activeFrontstageDef;\r\n\r\n // istanbul ignore else\r\n if (this.viewport && activeFrontstageDef)\r\n activeFrontstageDef.setActiveViewFromViewport(this.viewport);\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Dialog
|
|
3
|
+
*/
|
|
4
|
+
import "./ContentDialog.scss";
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { DialogProps } from "@itwin/core-react";
|
|
7
|
+
/**
|
|
8
|
+
*@internal
|
|
9
|
+
*/
|
|
10
|
+
export declare function useActiveContentControlId(): string | undefined;
|
|
11
|
+
/** Properties for the [[ContentDialog]] component
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export interface ContentDialogProps extends DialogProps {
|
|
15
|
+
dialogId: string;
|
|
16
|
+
movable?: boolean;
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
/** Content Dialog React component uses the Dialog component with a modal={false} prop.
|
|
20
|
+
* It controls the z-index to keep the focused dialog above content but below widgets.
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export declare function ContentDialog(props: ContentDialogProps): JSX.Element;
|
|
24
|
+
//# sourceMappingURL=ContentDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentDialog.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/dialog/ContentDialog.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAU,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAQxD;;GAEG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,GAAG,SAAS,CA8B9D;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,eAiCtD"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module Dialog
|
|
7
|
+
*/
|
|
8
|
+
import "./ContentDialog.scss";
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
import { Dialog } from "@itwin/core-react";
|
|
11
|
+
import { ContentDialogManager } from "./ContentDialogManager";
|
|
12
|
+
import { ContentViewManager } from "../content/ContentViewManager";
|
|
13
|
+
import { SyncUiEventDispatcher, SyncUiEventId } from "../syncui/SyncUiEventDispatcher";
|
|
14
|
+
import classnames from "classnames";
|
|
15
|
+
// istanbul ignore next
|
|
16
|
+
/**
|
|
17
|
+
*@internal
|
|
18
|
+
*/
|
|
19
|
+
export function useActiveContentControlId() {
|
|
20
|
+
var _a;
|
|
21
|
+
const [activeContentId, setActiveContentId] = React.useState((_a = ContentViewManager.getActiveContentControl()) === null || _a === void 0 ? void 0 : _a.uniqueId);
|
|
22
|
+
React.useEffect(() => {
|
|
23
|
+
const onActiveContentChanged = (_args) => {
|
|
24
|
+
var _a;
|
|
25
|
+
setActiveContentId((_a = ContentViewManager.getActiveContentControl()) === null || _a === void 0 ? void 0 : _a.uniqueId);
|
|
26
|
+
};
|
|
27
|
+
// IModelApp.viewManager.onSelectedViewportChanged will often fire before UI components have mounted
|
|
28
|
+
// so use ContentViewManager.onActiveContentChangedEvent which will always trigger once all stage components
|
|
29
|
+
// are loaded and when the IModelApp.viewManager.selectedView changes.
|
|
30
|
+
ContentViewManager.onActiveContentChangedEvent.addListener(onActiveContentChanged);
|
|
31
|
+
return () => {
|
|
32
|
+
ContentViewManager.onActiveContentChangedEvent.removeListener(onActiveContentChanged);
|
|
33
|
+
};
|
|
34
|
+
}, []);
|
|
35
|
+
React.useEffect(() => {
|
|
36
|
+
const syncIdsOfInterest = [SyncUiEventId.ActiveContentChanged, SyncUiEventId.ContentControlActivated, SyncUiEventId.FrontstageReady];
|
|
37
|
+
const handleSyncUiEvent = (args) => {
|
|
38
|
+
var _a;
|
|
39
|
+
// istanbul ignore else
|
|
40
|
+
if (syncIdsOfInterest.some((value) => args.eventIds.has(value))) {
|
|
41
|
+
setActiveContentId((_a = ContentViewManager.getActiveContentControl()) === null || _a === void 0 ? void 0 : _a.uniqueId);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return SyncUiEventDispatcher.onSyncUiEvent.addListener(handleSyncUiEvent);
|
|
45
|
+
}, []);
|
|
46
|
+
return activeContentId;
|
|
47
|
+
}
|
|
48
|
+
/** Content Dialog React component uses the Dialog component with a modal={false} prop.
|
|
49
|
+
* It controls the z-index to keep the focused dialog above content but below widgets.
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export function ContentDialog(props) {
|
|
53
|
+
const { className, children, dialogId, style, modal, modelessId, onModelessPointerDown, ...otherProps } = props; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
54
|
+
const activeContentControlId = useActiveContentControlId();
|
|
55
|
+
// istanbul ignore next
|
|
56
|
+
const dialogClassName = React.useMemo(() => classnames(activeContentControlId === dialogId ? "active-content-dialog" : "inactive-content-dialog", className), [activeContentControlId, className, dialogId]);
|
|
57
|
+
const [zIndex, setZIndex] = React.useState(ContentDialogManager.getDialogZIndex(dialogId));
|
|
58
|
+
const updateZIndex = React.useCallback(() => {
|
|
59
|
+
const newZ = ContentDialogManager.getDialogZIndex(dialogId);
|
|
60
|
+
// istanbul ignore else
|
|
61
|
+
if (newZ !== zIndex) {
|
|
62
|
+
setZIndex(newZ);
|
|
63
|
+
}
|
|
64
|
+
}, [dialogId, zIndex]);
|
|
65
|
+
return (React.createElement(Dialog, { className: dialogClassName, "data-item-type": "content-dialog", "data-item-id": dialogId, resizable: true, movable: true, trapFocus: false, modal: false, ...otherProps, modelessId: dialogId, onModelessPointerDown: (event) => ContentDialogManager.handlePointerDownEvent(event, dialogId, updateZIndex), style: { zIndex, ...style } }, children));
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=ContentDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentDialog.js","sourceRoot":"","sources":["../../../../src/appui-react/dialog/ContentDialog.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAe,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAiC,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAClG,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAEvF,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,uBAAuB;AACvB;;GAEG;AACH,MAAM,UAAU,yBAAyB;;IACvC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAA,kBAAkB,CAAC,uBAAuB,EAAE,0CAAE,QAAQ,CAAC,CAAC;IAErH,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,sBAAsB,GAAG,CAAC,KAAoC,EAAE,EAAE;;YACtE,kBAAkB,CAAC,MAAA,kBAAkB,CAAC,uBAAuB,EAAE,0CAAE,QAAQ,CAAC,CAAC;QAC7E,CAAC,CAAC;QAEF,oGAAoG;QACpG,4GAA4G;QAC5G,sEAAsE;QACtE,kBAAkB,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E,SAAS,CAAC,EAC1J,CAAC,sBAAsB,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEjD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,oBAAoB,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3F,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE;QAC1C,MAAM,IAAI,GAAG,oBAAoB,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAC5D,uBAAuB;QACvB,IAAI,IAAI,KAAK,MAAM,EAAE;YACnB,SAAS,CAAC,IAAI,CAAC,CAAC;SACjB;IACH,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IAEvB,OAAO,CACL,oBAAC,MAAM,IACL,SAAS,EAAE,eAAe,oBACX,gBAAgB,kBACjB,QAAQ,EACtB,SAAS,EAAE,IAAI,EACf,OAAO,EAAE,IAAI,EACb,SAAS,EAAE,KAAK,EAChB,KAAK,EAAE,KAAK,KACR,UAAU,EACd,UAAU,EAAE,QAAQ,EACpB,qBAAqB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,sBAAsB,CAAC,KAAK,EAAE,QAAQ,EAAE,YAAY,CAAC,EAC5G,KAAK,EAAE,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,IAE1B,QAAQ,CACD,CACX,CAAC;AACJ,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 Dialog\r\n */\r\n\r\nimport \"./ContentDialog.scss\";\r\nimport * as React from \"react\";\r\nimport { Dialog, DialogProps } from \"@itwin/core-react\";\r\nimport { ContentDialogManager } from \"./ContentDialogManager\";\r\nimport { ActiveContentChangedEventArgs, ContentViewManager } from \"../content/ContentViewManager\";\r\nimport { SyncUiEventDispatcher, SyncUiEventId } from \"../syncui/SyncUiEventDispatcher\";\r\nimport { UiSyncEventArgs } from \"@itwin/appui-abstract\";\r\nimport classnames from \"classnames\";\r\n\r\n// istanbul ignore next\r\n/**\r\n *@internal\r\n */\r\nexport function useActiveContentControlId(): string | undefined {\r\n const [activeContentId, setActiveContentId] = React.useState(ContentViewManager.getActiveContentControl()?.uniqueId);\r\n\r\n React.useEffect(() => {\r\n const onActiveContentChanged = (_args: ActiveContentChangedEventArgs) => {\r\n setActiveContentId(ContentViewManager.getActiveContentControl()?.uniqueId);\r\n };\r\n\r\n // IModelApp.viewManager.onSelectedViewportChanged will often fire before UI components have mounted\r\n // so use ContentViewManager.onActiveContentChangedEvent which will always trigger once all stage components\r\n // are loaded and when the IModelApp.viewManager.selectedView changes.\r\n ContentViewManager.onActiveContentChangedEvent.addListener(onActiveContentChanged);\r\n return () => {\r\n ContentViewManager.onActiveContentChangedEvent.removeListener(onActiveContentChanged);\r\n };\r\n }, []);\r\n\r\n React.useEffect(() => {\r\n const syncIdsOfInterest = [SyncUiEventId.ActiveContentChanged, SyncUiEventId.ContentControlActivated, SyncUiEventId.FrontstageReady];\r\n const handleSyncUiEvent = (args: UiSyncEventArgs): void => {\r\n // istanbul ignore else\r\n if (syncIdsOfInterest.some((value: string): boolean => args.eventIds.has(value))) {\r\n setActiveContentId(ContentViewManager.getActiveContentControl()?.uniqueId);\r\n }\r\n };\r\n\r\n return SyncUiEventDispatcher.onSyncUiEvent.addListener(handleSyncUiEvent);\r\n }, []);\r\n\r\n return activeContentId;\r\n}\r\n\r\n/** Properties for the [[ContentDialog]] component\r\n * @public\r\n */\r\nexport interface ContentDialogProps extends DialogProps {\r\n dialogId: string;\r\n movable?: boolean;\r\n children: React.ReactNode;\r\n}\r\n\r\n/** Content Dialog React component uses the Dialog component with a modal={false} prop.\r\n * It controls the z-index to keep the focused dialog above content but below widgets.\r\n * @public\r\n */\r\nexport function ContentDialog(props: ContentDialogProps) {\r\n const { className, children, dialogId, style, modal, modelessId, onModelessPointerDown, ...otherProps } = props; // eslint-disable-line @typescript-eslint/no-unused-vars\r\n const activeContentControlId = useActiveContentControlId();\r\n // istanbul ignore next\r\n const dialogClassName = React.useMemo(() => classnames(activeContentControlId === dialogId ? \"active-content-dialog\" : \"inactive-content-dialog\", className),\r\n [activeContentControlId, className, dialogId]);\r\n\r\n const [zIndex, setZIndex] = React.useState(ContentDialogManager.getDialogZIndex(dialogId));\r\n const updateZIndex = React.useCallback(() => {\r\n const newZ = ContentDialogManager.getDialogZIndex(dialogId);\r\n // istanbul ignore else\r\n if (newZ !== zIndex) {\r\n setZIndex(newZ);\r\n }\r\n }, [dialogId, zIndex]);\r\n\r\n return (\r\n <Dialog\r\n className={dialogClassName}\r\n data-item-type=\"content-dialog\"\r\n data-item-id={dialogId}\r\n resizable={true}\r\n movable={true}\r\n trapFocus={false}\r\n modal={false}\r\n {...otherProps}\r\n modelessId={dialogId}\r\n onModelessPointerDown={(event) => ContentDialogManager.handlePointerDownEvent(event, dialogId, updateZIndex)}\r\n style={{ zIndex, ...style }}\r\n >\r\n {children}\r\n </Dialog >\r\n );\r\n}\r\n\r\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
@import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
|
|
6
|
+
|
|
7
|
+
.core-dialog.active-content-dialog {
|
|
8
|
+
.core-dialog-area {
|
|
9
|
+
> .core-dialog-head {
|
|
10
|
+
color: $buic-text-color-highlight;
|
|
11
|
+
background-color: $buic-background-titlebar;
|
|
12
|
+
> .core-dialog-title {
|
|
13
|
+
font-weight: 800;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.core-dialog.inactive-content-dialog {
|
|
19
|
+
.core-dialog-area {
|
|
20
|
+
> .core-dialog-head {
|
|
21
|
+
background-color: $buic-background-titlebar-outoffocus;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Dialog
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { CommonProps } from "@itwin/core-react";
|
|
6
|
+
import { DialogChangedEvent, DialogManagerBase } from "./DialogManagerBase";
|
|
7
|
+
/** Content Dialog Changed Event class.
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export declare class ContentDialogChangedEvent extends DialogChangedEvent {
|
|
11
|
+
}
|
|
12
|
+
/** @internal */
|
|
13
|
+
interface ContentDialogInfo {
|
|
14
|
+
reactNode: React.ReactNode;
|
|
15
|
+
zIndex: number;
|
|
16
|
+
parentDocument: Document;
|
|
17
|
+
}
|
|
18
|
+
/** Content Dialog Manager class displays and manages multiple modeless dialogs
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export declare class ContentDialogManager {
|
|
22
|
+
/** Content Dialog Changed Event */
|
|
23
|
+
static readonly onContentDialogChangedEvent: ContentDialogChangedEvent;
|
|
24
|
+
/** @internal */
|
|
25
|
+
static readonly dialogManager: DialogManagerBase;
|
|
26
|
+
/** Get the array of modeless dialogs */
|
|
27
|
+
static get dialogs(): import("./DialogManagerBase").DialogInfo[];
|
|
28
|
+
private static _dialogMap;
|
|
29
|
+
private static _idArray;
|
|
30
|
+
private static _topZIndex;
|
|
31
|
+
/** Initialize the modeless dialog manager */
|
|
32
|
+
static initialize(): void;
|
|
33
|
+
private static getDialogZIndexDefault;
|
|
34
|
+
/** Open a modeless dialog
|
|
35
|
+
* @param dialog The Dialog to open
|
|
36
|
+
* @param id The id of the Dialog to open
|
|
37
|
+
*/
|
|
38
|
+
static openDialog(dialog: React.ReactNode, id: string, parentDocument?: Document): void;
|
|
39
|
+
/** Close a modeless dialog
|
|
40
|
+
* @param id The id of the Dialog to close.
|
|
41
|
+
*/
|
|
42
|
+
static closeDialog(id: string): void;
|
|
43
|
+
/** @internal */
|
|
44
|
+
static closeAll(): void;
|
|
45
|
+
/** Update the dialogs */
|
|
46
|
+
static update(): void;
|
|
47
|
+
/** Get the active modeless dialog */
|
|
48
|
+
static get activeDialog(): React.ReactNode | undefined;
|
|
49
|
+
/** Get the count of modeless dialogs */
|
|
50
|
+
static get dialogCount(): number;
|
|
51
|
+
/** Handle a pointer down event on a modeless dialog */
|
|
52
|
+
static handlePointerDownEvent(_event: React.PointerEvent, id: string, updateFunc: () => void): void;
|
|
53
|
+
/** Get the z-index for a modeless dialog */
|
|
54
|
+
static getDialogZIndex(id: string): number;
|
|
55
|
+
static getDialogInfo(id: string): ContentDialogInfo | undefined;
|
|
56
|
+
}
|
|
57
|
+
/** ContentDialogRenderer React component renders modeless dialogs.
|
|
58
|
+
* @public
|
|
59
|
+
*/
|
|
60
|
+
export declare class ContentDialogRenderer extends React.PureComponent<CommonProps> {
|
|
61
|
+
constructor(props: CommonProps);
|
|
62
|
+
render(): React.ReactNode;
|
|
63
|
+
}
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=ContentDialogManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentDialogManager.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/dialog/ContentDialogManager.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAA0B,MAAM,mBAAmB,CAAC;AAExE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAsB,MAAM,qBAAqB,CAAC;AAKhG;;GAEG;AACH,qBAAa,yBAA0B,SAAQ,kBAAkB;CAAI;A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K,CAAC,aAAa,CAAC,WAAW,CAAC;gBAE7D,KAAK,EAAE,WAAW;IAId,MAAM,IAAI,KAAK,CAAC,SAAS;CAK1C"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module Dialog
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { Logger } from "@itwin/core-bentley";
|
|
10
|
+
import { getCssVariableAsNumber } from "@itwin/core-react";
|
|
11
|
+
import { UiFramework } from "../UiFramework";
|
|
12
|
+
import { DialogChangedEvent, DialogManagerBase, DialogRendererBase } from "./DialogManagerBase";
|
|
13
|
+
import { IModelApp, NotifyMessageDetails, OutputMessagePriority, OutputMessageType } from "@itwin/core-frontend";
|
|
14
|
+
// cSpell:ignore ZINDEX modeless
|
|
15
|
+
/** Content Dialog Changed Event class.
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export class ContentDialogChangedEvent extends DialogChangedEvent {
|
|
19
|
+
}
|
|
20
|
+
/** Used if the 'dialog' z-index CSS variable cannot be read */
|
|
21
|
+
const CONTENT_DIALOG_ZINDEX_DEFAULT = 2000;
|
|
22
|
+
/** Content Dialog Manager class displays and manages multiple modeless dialogs
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export class ContentDialogManager {
|
|
26
|
+
/** Get the array of modeless dialogs */
|
|
27
|
+
static get dialogs() { return ContentDialogManager.dialogManager.dialogs; }
|
|
28
|
+
/** Initialize the modeless dialog manager */
|
|
29
|
+
static initialize() {
|
|
30
|
+
ContentDialogManager._topZIndex = ContentDialogManager.getDialogZIndexDefault();
|
|
31
|
+
}
|
|
32
|
+
static getDialogZIndexDefault() {
|
|
33
|
+
const variable = "--uicore-z-index-view-content-dialog";
|
|
34
|
+
const value = getCssVariableAsNumber(variable);
|
|
35
|
+
// istanbul ignore next
|
|
36
|
+
if (!isNaN(value))
|
|
37
|
+
return value;
|
|
38
|
+
Logger.logError(UiFramework.loggerCategory(this), `'${variable}' CSS variable not found`);
|
|
39
|
+
return CONTENT_DIALOG_ZINDEX_DEFAULT;
|
|
40
|
+
}
|
|
41
|
+
/** Open a modeless dialog
|
|
42
|
+
* @param dialog The Dialog to open
|
|
43
|
+
* @param id The id of the Dialog to open
|
|
44
|
+
*/
|
|
45
|
+
static openDialog(dialog, id, parentDocument = document) {
|
|
46
|
+
const dialogInfo = ContentDialogManager._dialogMap.get(id);
|
|
47
|
+
if (dialogInfo) {
|
|
48
|
+
const message = `Dialog with id of '${id}' already opened`;
|
|
49
|
+
Logger.logInfo(UiFramework.loggerCategory(this), `openDialog: ${message}`);
|
|
50
|
+
IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, message, undefined, OutputMessageType.Toast));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
ContentDialogManager._dialogMap.set(id, { reactNode: dialog, zIndex: ++ContentDialogManager._topZIndex, parentDocument });
|
|
54
|
+
ContentDialogManager._idArray.push(id);
|
|
55
|
+
ContentDialogManager.dialogManager.openDialog(dialog, id, parentDocument);
|
|
56
|
+
}
|
|
57
|
+
/** Close a modeless dialog
|
|
58
|
+
* @param id The id of the Dialog to close.
|
|
59
|
+
*/
|
|
60
|
+
static closeDialog(id) {
|
|
61
|
+
const dialogInfo = ContentDialogManager._dialogMap.get(id);
|
|
62
|
+
if (dialogInfo) {
|
|
63
|
+
ContentDialogManager.dialogManager.removeDialog(dialogInfo.reactNode);
|
|
64
|
+
ContentDialogManager._dialogMap.delete(id);
|
|
65
|
+
const index = ContentDialogManager._idArray.indexOf(id);
|
|
66
|
+
// istanbul ignore else
|
|
67
|
+
if (index >= 0)
|
|
68
|
+
ContentDialogManager._idArray.splice(index, 1);
|
|
69
|
+
if (ContentDialogManager.activeDialog === undefined)
|
|
70
|
+
ContentDialogManager._topZIndex = ContentDialogManager.getDialogZIndexDefault();
|
|
71
|
+
this.update();
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
Logger.logError(UiFramework.loggerCategory(this), `closeDialog: Could not find dialog with id of '${id}'`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** @internal */
|
|
78
|
+
static closeAll() {
|
|
79
|
+
ContentDialogManager.dialogManager.closeAll();
|
|
80
|
+
}
|
|
81
|
+
/** Update the dialogs */
|
|
82
|
+
static update() {
|
|
83
|
+
ContentDialogManager.dialogManager.update();
|
|
84
|
+
}
|
|
85
|
+
/** Get the active modeless dialog */
|
|
86
|
+
static get activeDialog() {
|
|
87
|
+
if (ContentDialogManager._idArray.length > 0) {
|
|
88
|
+
const id = ContentDialogManager._idArray[ContentDialogManager._idArray.length - 1];
|
|
89
|
+
const dialogInfo = ContentDialogManager._dialogMap.get(id);
|
|
90
|
+
// istanbul ignore else
|
|
91
|
+
if (dialogInfo)
|
|
92
|
+
return dialogInfo.reactNode;
|
|
93
|
+
}
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
/** Get the count of modeless dialogs */
|
|
97
|
+
static get dialogCount() {
|
|
98
|
+
return ContentDialogManager.dialogManager.dialogCount;
|
|
99
|
+
}
|
|
100
|
+
/** Handle a pointer down event on a modeless dialog */
|
|
101
|
+
static handlePointerDownEvent(_event, id, updateFunc) {
|
|
102
|
+
const dialogInfo = ContentDialogManager._dialogMap.get(id);
|
|
103
|
+
if (dialogInfo && dialogInfo.reactNode !== ContentDialogManager.activeDialog) {
|
|
104
|
+
dialogInfo.zIndex = ++ContentDialogManager._topZIndex;
|
|
105
|
+
ContentDialogManager._idArray.splice(ContentDialogManager._idArray.indexOf(id), 1);
|
|
106
|
+
ContentDialogManager._idArray.push(id);
|
|
107
|
+
updateFunc();
|
|
108
|
+
this.update();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/** Get the z-index for a modeless dialog */
|
|
112
|
+
static getDialogZIndex(id) {
|
|
113
|
+
let zIndex = ContentDialogManager.getDialogZIndexDefault();
|
|
114
|
+
const dialogInfo = ContentDialogManager._dialogMap.get(id);
|
|
115
|
+
// istanbul ignore else
|
|
116
|
+
if (dialogInfo)
|
|
117
|
+
zIndex = dialogInfo.zIndex;
|
|
118
|
+
return zIndex;
|
|
119
|
+
}
|
|
120
|
+
static getDialogInfo(id) {
|
|
121
|
+
return ContentDialogManager._dialogMap.get(id);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/** Content Dialog Changed Event */
|
|
125
|
+
ContentDialogManager.onContentDialogChangedEvent = new ContentDialogChangedEvent();
|
|
126
|
+
/** @internal */
|
|
127
|
+
ContentDialogManager.dialogManager = new DialogManagerBase(ContentDialogManager.onContentDialogChangedEvent);
|
|
128
|
+
ContentDialogManager._dialogMap = new Map();
|
|
129
|
+
ContentDialogManager._idArray = new Array();
|
|
130
|
+
ContentDialogManager._topZIndex = CONTENT_DIALOG_ZINDEX_DEFAULT;
|
|
131
|
+
/** ContentDialogRenderer React component renders modeless dialogs.
|
|
132
|
+
* @public
|
|
133
|
+
*/
|
|
134
|
+
export class ContentDialogRenderer extends React.PureComponent {
|
|
135
|
+
constructor(props) {
|
|
136
|
+
super(props);
|
|
137
|
+
}
|
|
138
|
+
render() {
|
|
139
|
+
return (React.createElement(DialogRendererBase, { ...this.props, dialogManager: ContentDialogManager.dialogManager }));
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=ContentDialogManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentDialogManager.js","sourceRoot":"","sources":["../../../../src/appui-react/dialog/ContentDialogManager.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,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["/*---------------------------------------------------------------------------------------------\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 Dialog\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport { CommonProps, getCssVariableAsNumber } from \"@itwin/core-react\";\r\nimport { UiFramework } from \"../UiFramework\";\r\nimport { DialogChangedEvent, DialogManagerBase, DialogRendererBase } from \"./DialogManagerBase\";\r\nimport { IModelApp, NotifyMessageDetails, OutputMessagePriority, OutputMessageType } from \"@itwin/core-frontend\";\r\n\r\n// cSpell:ignore ZINDEX modeless\r\n\r\n/** Content Dialog Changed Event class.\r\n * @public\r\n */\r\nexport class ContentDialogChangedEvent extends DialogChangedEvent { }\r\n\r\n/** @internal */\r\ninterface ContentDialogInfo {\r\n reactNode: React.ReactNode;\r\n zIndex: number;\r\n parentDocument: Document;\r\n}\r\n\r\n/** Used if the 'dialog' z-index CSS variable cannot be read */\r\nconst CONTENT_DIALOG_ZINDEX_DEFAULT = 2000;\r\n\r\n/** Content Dialog Manager class displays and manages multiple modeless dialogs\r\n * @public\r\n */\r\nexport class ContentDialogManager {\r\n /** Content Dialog Changed Event */\r\n public static readonly onContentDialogChangedEvent = new ContentDialogChangedEvent();\r\n\r\n /** @internal */\r\n public static readonly dialogManager: DialogManagerBase = new DialogManagerBase(ContentDialogManager.onContentDialogChangedEvent);\r\n\r\n /** Get the array of modeless dialogs */\r\n public static get dialogs() { return ContentDialogManager.dialogManager.dialogs; }\r\n\r\n private static _dialogMap = new Map<string, ContentDialogInfo>();\r\n private static _idArray = new Array<string>();\r\n\r\n private static _topZIndex = CONTENT_DIALOG_ZINDEX_DEFAULT;\r\n\r\n /** Initialize the modeless dialog manager */\r\n public static initialize(): void {\r\n ContentDialogManager._topZIndex = ContentDialogManager.getDialogZIndexDefault();\r\n }\r\n\r\n private static getDialogZIndexDefault(): number {\r\n const variable = \"--uicore-z-index-view-content-dialog\";\r\n const value = getCssVariableAsNumber(variable);\r\n\r\n // istanbul ignore next\r\n if (!isNaN(value))\r\n return value;\r\n\r\n Logger.logError(UiFramework.loggerCategory(this), `'${variable}' CSS variable not found`);\r\n return CONTENT_DIALOG_ZINDEX_DEFAULT;\r\n }\r\n\r\n /** Open a modeless dialog\r\n * @param dialog The Dialog to open\r\n * @param id The id of the Dialog to open\r\n */\r\n public static openDialog(dialog: React.ReactNode, id: string, parentDocument = document): void {\r\n const dialogInfo = ContentDialogManager._dialogMap.get(id);\r\n if (dialogInfo) {\r\n const message = `Dialog with id of '${id}' already opened`;\r\n Logger.logInfo(UiFramework.loggerCategory(this), `openDialog: ${message}`);\r\n IModelApp.notifications.outputMessage(new NotifyMessageDetails(OutputMessagePriority.Info, message, undefined, OutputMessageType.Toast));\r\n return;\r\n }\r\n ContentDialogManager._dialogMap.set(id, { reactNode: dialog, zIndex: ++ContentDialogManager._topZIndex, parentDocument });\r\n ContentDialogManager._idArray.push(id);\r\n ContentDialogManager.dialogManager.openDialog(dialog, id, parentDocument);\r\n }\r\n\r\n /** Close a modeless dialog\r\n * @param id The id of the Dialog to close.\r\n */\r\n public static closeDialog(id: string): void {\r\n const dialogInfo = ContentDialogManager._dialogMap.get(id);\r\n if (dialogInfo) {\r\n ContentDialogManager.dialogManager.removeDialog(dialogInfo.reactNode);\r\n ContentDialogManager._dialogMap.delete(id);\r\n const index = ContentDialogManager._idArray.indexOf(id);\r\n // istanbul ignore else\r\n if (index >= 0)\r\n ContentDialogManager._idArray.splice(index, 1);\r\n\r\n if (ContentDialogManager.activeDialog === undefined)\r\n ContentDialogManager._topZIndex = ContentDialogManager.getDialogZIndexDefault();\r\n\r\n this.update();\r\n } else {\r\n Logger.logError(UiFramework.loggerCategory(this), `closeDialog: Could not find dialog with id of '${id}'`);\r\n }\r\n }\r\n\r\n /** @internal */\r\n public static closeAll(): void {\r\n ContentDialogManager.dialogManager.closeAll();\r\n }\r\n\r\n /** Update the dialogs */\r\n public static update(): void {\r\n ContentDialogManager.dialogManager.update();\r\n }\r\n\r\n /** Get the active modeless dialog */\r\n public static get activeDialog(): React.ReactNode | undefined {\r\n if (ContentDialogManager._idArray.length > 0) {\r\n const id = ContentDialogManager._idArray[ContentDialogManager._idArray.length - 1];\r\n const dialogInfo = ContentDialogManager._dialogMap.get(id);\r\n // istanbul ignore else\r\n if (dialogInfo)\r\n return dialogInfo.reactNode;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /** Get the count of modeless dialogs */\r\n public static get dialogCount(): number {\r\n return ContentDialogManager.dialogManager.dialogCount;\r\n }\r\n\r\n /** Handle a pointer down event on a modeless dialog */\r\n public static handlePointerDownEvent(_event: React.PointerEvent, id: string, updateFunc: () => void): void {\r\n const dialogInfo = ContentDialogManager._dialogMap.get(id);\r\n if (dialogInfo && dialogInfo.reactNode !== ContentDialogManager.activeDialog) {\r\n dialogInfo.zIndex = ++ContentDialogManager._topZIndex;\r\n\r\n ContentDialogManager._idArray.splice(ContentDialogManager._idArray.indexOf(id), 1);\r\n ContentDialogManager._idArray.push(id);\r\n\r\n updateFunc();\r\n this.update();\r\n }\r\n }\r\n\r\n /** Get the z-index for a modeless dialog */\r\n public static getDialogZIndex(id: string): number {\r\n let zIndex = ContentDialogManager.getDialogZIndexDefault();\r\n const dialogInfo = ContentDialogManager._dialogMap.get(id);\r\n // istanbul ignore else\r\n if (dialogInfo)\r\n zIndex = dialogInfo.zIndex;\r\n return zIndex;\r\n }\r\n\r\n public static getDialogInfo(id: string): ContentDialogInfo | undefined {\r\n return ContentDialogManager._dialogMap.get(id);\r\n }\r\n}\r\n\r\n/** ContentDialogRenderer React component renders modeless dialogs.\r\n * @public\r\n */\r\nexport class ContentDialogRenderer extends React.PureComponent<CommonProps> {\r\n\r\n constructor(props: CommonProps) {\r\n super(props);\r\n }\r\n\r\n public override render(): React.ReactNode {\r\n return (\r\n <DialogRendererBase {...this.props} dialogManager={ContentDialogManager.dialogManager} />\r\n );\r\n }\r\n}\r\n"]}
|
|
@@ -59,6 +59,7 @@ export declare class FrontstageDef {
|
|
|
59
59
|
private _timeTracker;
|
|
60
60
|
private _nineZoneState?;
|
|
61
61
|
private _contentGroupProvider?;
|
|
62
|
+
private _floatingContentControls?;
|
|
62
63
|
get id(): string;
|
|
63
64
|
get defaultTool(): ToolItemDef | undefined;
|
|
64
65
|
get defaultContentId(): string;
|
|
@@ -67,6 +68,7 @@ export declare class FrontstageDef {
|
|
|
67
68
|
get usage(): string;
|
|
68
69
|
get version(): number;
|
|
69
70
|
get contentGroupProvider(): ContentGroupProvider | undefined;
|
|
71
|
+
get floatingContentControls(): ContentControl[] | undefined;
|
|
70
72
|
get topLeft(): ZoneDef | undefined;
|
|
71
73
|
get topCenter(): ZoneDef | undefined;
|
|
72
74
|
get topRight(): ZoneDef | undefined;
|
|
@@ -147,6 +149,8 @@ export declare class FrontstageDef {
|
|
|
147
149
|
findWidgetDef(id: string): WidgetDef | undefined;
|
|
148
150
|
/** Gets the list of [[WidgetControl]]s */
|
|
149
151
|
private get _widgetControls();
|
|
152
|
+
addFloatingContentControl(contentControl?: ContentControl): void;
|
|
153
|
+
dropFloatingContentControl(contentControl?: ContentControl): void;
|
|
150
154
|
/** Gets the list of [[ContentControl]]s */
|
|
151
155
|
get contentControls(): ContentControl[];
|
|
152
156
|
/** Initializes a FrontstageDef from FrontstageProps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrontstageDef.d.ts","sourceRoot":"","sources":["../../../../src/appui-react/frontstage/FrontstageDef.tsx"],"names":[],"mappings":"AAKA;;GAEG;AAKH,OAAO,EAAa,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAuB,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzG,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAEL,oB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