mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-11 02:12:56 +00:00
feat: add config.workspaceEmptyComponent
This commit is contained in:
parent
2d98f1c9b5
commit
aa1bb1c0d7
@ -155,6 +155,10 @@ const VALID_ENGINE_OPTIONS = {
|
||||
description: '是否开启应用级设计模式',
|
||||
default: false,
|
||||
},
|
||||
workspaceEmptyComponent: {
|
||||
type: 'function',
|
||||
description: '应用级设计模式下,窗口为空时展示的占位组件',
|
||||
},
|
||||
};
|
||||
|
||||
const getStrictModeValue = (engineOptions: IPublicTypeEngineOptions, defaultValue: boolean): boolean => {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { Component } from 'react';
|
||||
import { TipContainer, observer } from '@alilc/lowcode-editor-core';
|
||||
import { TipContainer, engineConfig, observer } from '@alilc/lowcode-editor-core';
|
||||
import { WindowView } from '../view/window-view';
|
||||
import classNames from 'classnames';
|
||||
import TopArea from './top-area';
|
||||
@ -21,17 +21,29 @@ export class Workbench extends Component<{
|
||||
components?: PluginClassSet;
|
||||
className?: string;
|
||||
topAreaItemClassName?: string;
|
||||
}, {
|
||||
workspaceEmptyComponent: any;
|
||||
}> {
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
const { config, components, workspace } = this.props;
|
||||
const { skeleton } = workspace;
|
||||
skeleton.buildFromConfig(config, components);
|
||||
engineConfig.onGot('workspaceEmptyComponent', (workspaceEmptyComponent) => {
|
||||
this.setState({
|
||||
workspaceEmptyComponent,
|
||||
});
|
||||
});
|
||||
this.state = {
|
||||
workspaceEmptyComponent: engineConfig.get('workspaceEmptyComponent'),
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
const { workspace, className, topAreaItemClassName } = this.props;
|
||||
const { skeleton } = workspace;
|
||||
const WorkspaceEmptyComponent = this.state.workspaceEmptyComponent;
|
||||
|
||||
return (
|
||||
<div className={classNames('lc-workspace-workbench', className)}>
|
||||
<SkeletonContext.Provider value={skeleton}>
|
||||
@ -53,6 +65,10 @@ export class Workbench extends Component<{
|
||||
/>
|
||||
))
|
||||
}
|
||||
|
||||
{
|
||||
!workspace.windows.length && WorkspaceEmptyComponent ? <WorkspaceEmptyComponent /> : null
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<MainArea area={skeleton.mainArea} />
|
||||
|
||||
@ -199,7 +199,7 @@ export class Workspace implements IWorkspace {
|
||||
this.windows.splice(index, 1);
|
||||
if (this.window === window) {
|
||||
this.window = this.windows[index] || this.windows[index + 1] || this.windows[index - 1];
|
||||
if (this.window.sleep) {
|
||||
if (this.window?.sleep) {
|
||||
this.window.init();
|
||||
}
|
||||
this.emitChangeActiveWindow();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user