mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-11 18:42:56 +00:00
feat: workspace add some features
This commit is contained in:
parent
f5438ff1ab
commit
ee80fb12b8
@ -150,6 +150,11 @@ const VALID_ENGINE_OPTIONS = {
|
|||||||
description: '应用级设计模式下,自动打开第一个窗口',
|
description: '应用级设计模式下,自动打开第一个窗口',
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
enableWorkspaceMode: {
|
||||||
|
type: 'boolean',
|
||||||
|
description: '是否开启应用级设计模式',
|
||||||
|
default: false,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const getStrictModeValue = (engineOptions: IPublicTypeEngineOptions, defaultValue: boolean): boolean => {
|
const getStrictModeValue = (engineOptions: IPublicTypeEngineOptions, defaultValue: boolean): boolean => {
|
||||||
|
|||||||
@ -42,8 +42,8 @@ export class Workspace implements IPublicApiWorkspace {
|
|||||||
this[workspaceSymbol].registerResourceType(resourceTypeModel);
|
this[workspaceSymbol].registerResourceType(resourceTypeModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
openEditorWindow(resourceName: string, title: string, extra: object, viewName?: string, sleep?: boolean): void {
|
async openEditorWindow(resourceName: string, title: string, extra: object, viewName?: string, sleep?: boolean): Promise<void> {
|
||||||
this[workspaceSymbol].openEditorWindow(resourceName, title, extra, viewName, sleep);
|
await this[workspaceSymbol].openEditorWindow(resourceName, title, extra, viewName, sleep);
|
||||||
}
|
}
|
||||||
|
|
||||||
openEditorWindowById(id: string) {
|
openEditorWindowById(id: string) {
|
||||||
|
|||||||
@ -30,7 +30,7 @@ export interface IPublicApiWorkspace<
|
|||||||
registerResourceType(resourceTypeModel: IPublicTypeResourceType): void;
|
registerResourceType(resourceTypeModel: IPublicTypeResourceType): void;
|
||||||
|
|
||||||
/** 打开视图窗口 */
|
/** 打开视图窗口 */
|
||||||
openEditorWindow(resourceName: string, title: string, extra: Object, viewName?: string, sleep?: boolean): void;
|
openEditorWindow(resourceName: string, title: string, extra: Object, viewName?: string, sleep?: boolean): Promise<void>;
|
||||||
|
|
||||||
/** 通过视图 id 打开窗口 */
|
/** 通过视图 id 打开窗口 */
|
||||||
openEditorWindowById(id: string): void;
|
openEditorWindowById(id: string): void;
|
||||||
@ -47,6 +47,12 @@ export interface IPublicApiWorkspace<
|
|||||||
/** active 窗口变更事件 */
|
/** active 窗口变更事件 */
|
||||||
onChangeActiveWindow(fn: () => void): IPublicTypeDisposable;
|
onChangeActiveWindow(fn: () => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* active 视图变更事件
|
||||||
|
* @since v1.1.7
|
||||||
|
*/
|
||||||
|
onChangeActiveEditorView(fn: () => void): IPublicTypeDisposable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* window 下的所有视图 renderer ready 事件
|
* window 下的所有视图 renderer ready 事件
|
||||||
* @since v1.1.7
|
* @since v1.1.7
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import {
|
|||||||
IPublicApiWorkspace,
|
IPublicApiWorkspace,
|
||||||
} from '../api';
|
} from '../api';
|
||||||
import { IPublicEnumPluginRegisterLevel } from '../enum';
|
import { IPublicEnumPluginRegisterLevel } from '../enum';
|
||||||
import { IPublicModelEngineConfig } from './';
|
import { IPublicModelEngineConfig, IPublicModelEditorView } from './';
|
||||||
|
|
||||||
export interface IPublicModelPluginContext {
|
export interface IPublicModelPluginContext {
|
||||||
|
|
||||||
@ -107,6 +107,8 @@ export interface IPublicModelPluginContext {
|
|||||||
* @since v1.1.7
|
* @since v1.1.7
|
||||||
*/
|
*/
|
||||||
get registerLevel(): IPublicEnumPluginRegisterLevel;
|
get registerLevel(): IPublicEnumPluginRegisterLevel;
|
||||||
|
|
||||||
|
get editorWindow(): IPublicModelEditorView;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -128,7 +128,7 @@ export class Workspace implements IWorkspace {
|
|||||||
title: resource.title,
|
title: resource.title,
|
||||||
});
|
});
|
||||||
this.editorWindowMap.set(this.window.id, this.window);
|
this.editorWindowMap.set(this.window.id, this.window);
|
||||||
this.windows.push(this.window);
|
this.windows = [...this.windows, this.window];
|
||||||
this.emitChangeWindow();
|
this.emitChangeWindow();
|
||||||
this.emitChangeActiveWindow();
|
this.emitChangeActiveWindow();
|
||||||
}
|
}
|
||||||
@ -214,7 +214,7 @@ export class Workspace implements IWorkspace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openEditorWindow(name: string, title: string, options: Object, viewType?: string, sleep?: boolean) {
|
async openEditorWindow(name: string, title: string, options: Object, viewType?: string, sleep?: boolean) {
|
||||||
if (this.window && !this.window?.initReady && !sleep) {
|
if (this.window && !this.window?.initReady && !sleep) {
|
||||||
this.windowQueue.push({
|
this.windowQueue.push({
|
||||||
name, title, options, viewType,
|
name, title, options, viewType,
|
||||||
@ -230,7 +230,7 @@ export class Workspace implements IWorkspace {
|
|||||||
if (filterWindows && filterWindows.length) {
|
if (filterWindows && filterWindows.length) {
|
||||||
this.window = filterWindows[0];
|
this.window = filterWindows[0];
|
||||||
if (!sleep && this.window.sleep) {
|
if (!sleep && this.window.sleep) {
|
||||||
this.window.init();
|
await this.window.init();
|
||||||
} else {
|
} else {
|
||||||
this.checkWindowQueue();
|
this.checkWindowQueue();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user