@@ -150,16 +150,25 @@ const BottomPanelView: React.FC<{
150150 side : string ;
151151 titleMenu : IMenu ;
152152} > = ( { component, titleMenu, side } ) => {
153- const contentRef = React . useRef < HTMLDivElement | null > ( ) ;
154- const titleComponent = component . options && component . options . titleComponent ;
153+ const ref = React . useRef < HTMLElement | null > ( ) ;
154+ const containerRef = React . useRef < HTMLDivElement | null > ( null ) ;
155+ const configContext = useInjectable < AppConfig > ( AppConfig ) ;
155156 const tabbarService : TabbarService = useInjectable ( TabbarServiceFactory ) ( side ) ;
156- // 注入自定义视图 or 通过views注入视图
157+ const { component : CustomComponent , containerId } = component . options || { } ;
158+ const titleComponent = component . options && component . options . titleComponent ;
159+
160+ if ( ! containerId ) {
161+ return null ;
162+ }
157163 const progressService : IProgressService = useInjectable ( IProgressService ) ;
158- const indicator = progressService . getIndicator ( component . options ! . containerId ) ! ;
159- const viewState = useViewState ( side , contentRef ) ;
164+ const indicator = progressService . getIndicator ( containerId ) ;
165+ if ( ! indicator ) {
166+ return null ;
167+ }
168+ const viewState = useViewState ( side , containerRef ) ;
160169
161170 return (
162- < div className = { styles . panel_container } >
171+ < div ref = { containerRef } className = { styles . panel_container } >
163172 < div className = { styles . panel_title_bar } style = { { height : LAYOUT_VIEW_SIZE . PANEL_TITLEBAR_HEIGHT } } >
164173 < h1 > { component . options ?. title ?. toUpperCase ( ) } </ h1 >
165174 < div className = { styles . title_component_container } >
@@ -172,12 +181,22 @@ const BottomPanelView: React.FC<{
172181 < InlineMenuBar menus = { tabbarService . commonTitleMenu } moreAtFirst />
173182 </ div >
174183 </ div >
175- < div ref = { ( ele ) => ( contentRef . current = ele ) } className = { styles . panel_wrapper } >
184+ < div className = { styles . container_wrap } ref = { ( ele ) => ( ref . current = ele ) } >
176185 < ProgressBar progressModel = { indicator . progressModel } />
177- < ComponentRenderer
178- initialProps = { { viewState, ...component . options ?. initialProps } }
179- Component = { component . options ?. component ? component . options . component : component . views [ 0 ] . component ! }
180- />
186+ { CustomComponent ? (
187+ < ConfigProvider value = { configContext } >
188+ < ComponentRenderer
189+ initialProps = { { viewState, ...component . options ?. initialProps } }
190+ Component = { CustomComponent }
191+ />
192+ </ ConfigProvider >
193+ ) : (
194+ < AccordionContainer
195+ views = { component . views }
196+ minSize = { component . options ! . miniSize }
197+ containerId = { component . options ! . containerId }
198+ />
199+ ) }
181200 </ div >
182201 </ div >
183202 ) ;
0 commit comments