11import { Component } from 'react' ;
2- import { TipContainer , observer } from '@alilc/lowcode-editor-core' ;
2+ import { TipContainer , engineConfig , observer } from '@alilc/lowcode-editor-core' ;
33import { WindowView } from '../view/window-view' ;
44import classNames from 'classnames' ;
55import TopArea from './top-area' ;
@@ -21,17 +21,29 @@ export class Workbench extends Component<{
2121 components ?: PluginClassSet ;
2222 className ?: string ;
2323 topAreaItemClassName ?: string ;
24+ } , {
25+ workspaceEmptyComponent : any ;
2426} > {
2527 constructor ( props : any ) {
2628 super ( props ) ;
2729 const { config, components, workspace } = this . props ;
2830 const { skeleton } = workspace ;
2931 skeleton . buildFromConfig ( config , components ) ;
32+ engineConfig . onGot ( 'workspaceEmptyComponent' , ( workspaceEmptyComponent ) => {
33+ this . setState ( {
34+ workspaceEmptyComponent,
35+ } ) ;
36+ } ) ;
37+ this . state = {
38+ workspaceEmptyComponent : engineConfig . get ( 'workspaceEmptyComponent' ) ,
39+ } ;
3040 }
3141
3242 render ( ) {
3343 const { workspace, className, topAreaItemClassName } = this . props ;
3444 const { skeleton } = workspace ;
45+ const WorkspaceEmptyComponent = this . state . workspaceEmptyComponent ;
46+
3547 return (
3648 < div className = { classNames ( 'lc-workspace-workbench' , className ) } >
3749 < SkeletonContext . Provider value = { skeleton } >
@@ -53,6 +65,10 @@ export class Workbench extends Component<{
5365 />
5466 ) )
5567 }
68+
69+ {
70+ ! workspace . windows . length && WorkspaceEmptyComponent ? < WorkspaceEmptyComponent /> : null
71+ }
5672 </ div >
5773 </ div >
5874 < MainArea area = { skeleton . mainArea } />
0 commit comments