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