import * as React from "react" ; import { BackstageAppButton , ConfigurableUiManager , ContentGroup , ContentGroupProvider , FrontstageProps , IModelViewportControl , StandardContentToolsProvider , StandardFrontstageProps , StandardFrontstageProvider , StandardNavigationToolsProvider , StandardStatusbarItemsProvider , UiFramework , } from "@itwin/appui-react" ; import { ContentLayoutProps , StageUsage , StandardContentLayouts } from "@itwin/appui-abstract" ; import { CustomContentUiProvider } from "../providers/CustomContentUiProvider" ; import { SampleContentControl } from "../content/SampleContentControl" ; export class CustomContentGroupProvider extends ContentGroupProvider { public async provideContentGroup ( _props ) { const twoHorizontalSplit = { ... StandardContentLayouts . twoHorizontalSplit , horizontalSplit : { ... StandardContentLayouts . twoHorizontalSplit . horizontalSplit ! , minSizeBottom : 100 , percentage : 0.80 , } } ; return new ContentGroup ( { id : "ui-item-provider-test:network-tracing-stage-content" , layout : twoHorizontalSplit , contents : [ { id : "primaryContent" , classId : IModelViewportControl . id , applicationData : { isPrimaryView : true , supports : [ "viewIdSelection" , "3dModels" , "2dModels" ] , viewState : UiFramework . getDefaultViewState , iModelConnection : UiFramework . getIModelConnection , } , } , { id : "ui-test:customContent" , classId : SampleContentControl , } , ] , } ) ; } } /**
 * This class is used to register a new frontstage that is called 'Custom' but it provides no real tools to do work,
 * it is simply used as a test defining a stage that provides custom content along with imodel content.
 */ export class CustomFrontstage { public static stageId = "ui-item-provider-test:Custom" ; private static _contentGroupProvider = new CustomContentGroupProvider ( ) ; public static register ( ) { const cornerButton = < BackstageAppButton />; const networkTracingStageProps = { id : CustomFrontstage . stageId , version : 1.1 , contentGroupProps : CustomFrontstage . _contentGroupProvider , hideNavigationAid : false , cornerButton , usage : StageUsage . General , applicationData : undefined , } ; CustomFrontstage . registerToolProviders ( ) ; ConfigurableUiManager . addFrontstageProvider ( new StandardFrontstageProvider ( networkTracingStageProps ) ) ; } private static registerToolProviders ( ) { StandardContentToolsProvider . register ( "customContentTools" , { horizontal : { clearSelection : true , clearDisplayOverrides : true , hide : "group" , isolate : "group" , emphasize : "element" , } , } , ( stageId , _stageUsage , _applicationData ) => { return stageId === CustomFrontstage . stageId ; } ) ; /** Provides standard tools for NavigationWidget */ StandardNavigationToolsProvider . register ( "customNavigationTools" , undefined , ( stageId , _stageUsage , _applicationData ) => { return stageId === CustomFrontstage . stageId ; } ) ; /** Provides standard status fields */ StandardStatusbarItemsProvider . register ( "customStatusFields" , undefined , ( stageId , _stageUsage , _applicationData ) => { return stageId === CustomFrontstage . stageId ; } ) ; CustomContentUiProvider . register ( ) ; } }