Compare commits

...

8 Commits

Author SHA1 Message Date
唐澜
f6305c2284
Merge pull request #3050 from alibaba/chore/update-codeowners
chore: update code owners
2024-06-11 21:12:45 +08:00
1ncounter
2892a01d29 chore: update code owners 2024-06-11 21:07:42 +08:00
GitHub Action
bd85ca3ca6 chore(release): publish 1.3.2 2024-02-23 01:51:23 +00:00
liujuping
44beb2a25a fix(workspace): fix workspace editorView is undefined 2024-02-07 13:43:39 +08:00
liujuping
86d50e0946 fix(setter): params is not shell SettingField 2024-02-04 16:42:46 +08:00
liujuping
19eb917259 refactor(plugin-command): add plugin-command package 2024-02-01 16:24:08 +08:00
GitHub Action
501ad872c4 chore(docs): publish documentation 2024-02-01 08:17:01 +00:00
liujuping
76b2a05049 docs(command): add command api docs 2024-02-01 16:15:16 +08:00
44 changed files with 245 additions and 101 deletions

2
.github/CODEOWNERS vendored
View File

@ -2,7 +2,7 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence
* @liujuping @JackLian
* @liujuping @1ncounter
/modules/material-parser @akirakai
/modules/code-generator @qingniaotonghua

View File

@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
if: >-
contains(github.ref, 'refs/heads/release/') &&
(github.actor == 'JackLian' || github.actor == 'liujuping')
(github.actor == '1ncounter' || github.actor == 'liujuping')
steps:
- uses: actions/checkout@v2
- name: Setup Node.js

View File

@ -1,6 +1,6 @@
---
title: canvas - 画布 API
sidebar_position: 12
sidebar_position: 10
---
> **@types** [IPublicApiCanvas](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/canvas.ts)<br/>

101
docs/docs/api/command.md Normal file
View File

@ -0,0 +1,101 @@
---
title: command - 指令 API
sidebar_position: 10
---
## 模块概览
该模块使得与命令系统的交互成为可能,提供了一种全面的方式来处理、执行和管理应用程序中的命令。
## 接口
### IPublicApiCommand
与命令交互的接口。它提供了注册、注销、执行和管理命令的方法。
## 方法
### registerCommand
注册一个新命令及其处理函数。
```
typescriptCopy code
/**
* 注册一个新的命令及其处理程序。
* @param command {IPublicTypeCommand} - 要注册的命令。
*/
registerCommand(command: IPublicTypeCommand): void;
```
### unregisterCommand
注销一个已存在的命令。
```
typescriptCopy code
/**
* 注销一个已存在的命令。
* @param name {string} - 要注销的命令的名称。
*/
unregisterCommand(name: string): void;
```
### executeCommand
根据名称和提供的参数执行命令,确保参数符合命令的定义。
```
typescriptCopy code
/**
* 根据名称和提供的参数执行命令。
* @param name {string} - 要执行的命令的名称。
* @param args {IPublicTypeCommandHandlerArgs} - 命令的参数。
*/
executeCommand(name: string, args?: IPublicTypeCommandHandlerArgs): void;
```
### batchExecuteCommand
批量执行命令,在所有命令执行后进行重绘,历史记录中只记录一次。
```
typescriptCopy code
/**
* 批量执行命令,随后进行重绘,历史记录中只记录一次。
* @param commands {Array} - 命令对象的数组,包含名称和可选参数。
*/
batchExecuteCommand(commands: { name: string; args?: IPublicTypeCommandHandlerArgs }[]): void;
```
### listCommands
列出所有已注册的命令。
```
typescriptCopy code
/**
* 列出所有已注册的命令。
* @returns {IPublicTypeListCommand[]} - 已注册命令的数组。
*/
listCommands(): IPublicTypeListCommand[];
```
### onCommandError
为命令执行过程中的错误注册错误处理回调函数。
```
typescriptCopy code
/**
* 为命令执行过程中的错误注册一个回调函数。
* @param callback {(name: string, error: Error) => void} - 错误处理的回调函数。
*/
onCommandError(callback: (name: string, error: Error) => void): void;
```

View File

@ -1,6 +1,6 @@
---
title: common - 通用 API
sidebar_position: 11
sidebar_position: 10
---
> **@types** [IPublicApiCommon](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/common.ts)<br/>

View File

@ -1,6 +1,6 @@
---
title: commonUI - UI 组件库
sidebar_position: 11
sidebar_position: 10
---
## 简介

View File

@ -1,6 +1,6 @@
---
title: config - 配置 API
sidebar_position: 8
sidebar_position: 5
---
> **@types** [IPublicModelEngineConfig](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/engine-config.ts)<br/>

View File

@ -1,6 +1,6 @@
---
title: config options - 配置列表
sidebar_position: 13
sidebar_position: 5
---
> **@types** [IPublicTypeEngineOptions](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/engine-options.ts)<br/>

View File

@ -1,6 +1,6 @@
---
title: event - 事件 API
sidebar_position: 7
sidebar_position: 10
---
> **@types** [IPublicApiEvent](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/event.ts)<br/>

View File

@ -1,6 +1,6 @@
---
title: hotkey - 快捷键 API
sidebar_position: 5
sidebar_position: 10
---
> **@types** [IPublicApiHotkey](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/hotkey.ts)<br/>

View File

@ -1,6 +1,6 @@
---
title: init - 初始化 API
sidebar_position: 10
sidebar_position: 0
---
> **@since** v1.0.0

View File

@ -1,6 +1,6 @@
---
title: logger - 日志 API
sidebar_position: 9
sidebar_position: 10
---
> **@types** [IPublicApiLogger](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/logger.ts)<br/>

View File

@ -1,6 +1,6 @@
---
title: material - 物料 API
sidebar_position: 2
sidebar_position: 10
---
> **@types** [IPublicApiMaterial](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/material.ts)<br/>

View File

@ -1,6 +1,6 @@
{
"label": "模型定义 Models",
"position": 14,
"position": 100,
"collapsed": false,
"collapsible": true
}

View File

@ -1,6 +1,6 @@
---
title: plugins - 插件 API
sidebar_position: 4
sidebar_position: 2
---
> **@types** [IPublicApiPlugins](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/plugins.ts)<br/>
> **@since** v1.0.0

View File

@ -1,6 +1,6 @@
---
title: project - 模型 API
sidebar_position: 3
sidebar_position: 10
---
## 模块简介

View File

@ -1,6 +1,6 @@
---
title: setters - 设置器 API
sidebar_position: 6
sidebar_position: 10
---
> **@types** [IPublicApiSetters](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/setters.ts)<br/>
> **@since** v1.0.0

View File

@ -1,6 +1,6 @@
---
title: simulatorHost - 模拟器 API
sidebar_position: 3
sidebar_position: 10
---
> **@types** [IPublicApiSimulatorHost](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts)<br/>
> **@since** v1.0.0

View File

@ -1,6 +1,6 @@
---
title: skeleton - 面板 API
sidebar_position: 1
sidebar_position: 10
---
> **@types** [IPublicApiSkeleton](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/skeleton.ts)<br/>
> **@since** v1.0.0

View File

@ -1,6 +1,6 @@
---
title: workspace - 应用级 API
sidebar_position: 12
sidebar_position: 10
---
> **[@experimental](./#experimental)**<br/>

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-engine-docs",
"version": "1.2.30",
"version": "1.2.31",
"description": "低代码引擎版本化文档",
"license": "MIT",
"files": [

View File

@ -1,6 +1,6 @@
{
"lerna": "4.0.0",
"version": "1.3.1",
"version": "1.3.2",
"npmClient": "yarn",
"useWorkspaces": true,
"packages": [

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-designer",
"version": "1.3.1",
"version": "1.3.2",
"description": "Designer for Ali LowCode Engine",
"main": "lib/index.js",
"module": "es/index.js",
@ -15,9 +15,9 @@
},
"license": "MIT",
"dependencies": {
"@alilc/lowcode-editor-core": "1.3.1",
"@alilc/lowcode-types": "1.3.1",
"@alilc/lowcode-utils": "1.3.1",
"@alilc/lowcode-editor-core": "1.3.2",
"@alilc/lowcode-types": "1.3.2",
"@alilc/lowcode-utils": "1.3.2",
"classnames": "^2.2.6",
"react": "^16",
"react-dom": "^16.7.0",

View File

@ -70,7 +70,7 @@ export class Transducer {
}
if (isDynamicSetter(setter) && isDynamic) {
try {
setter = setter.call(context, context);
setter = setter.call(context.internalToShellField(), context.internalToShellField());
} catch (e) { console.error(e); }
}

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-editor-core",
"version": "1.3.1",
"version": "1.3.2",
"description": "Core Api for Ali lowCode engine",
"license": "MIT",
"main": "lib/index.js",
@ -16,8 +16,8 @@
},
"dependencies": {
"@alifd/next": "^1.19.16",
"@alilc/lowcode-types": "1.3.1",
"@alilc/lowcode-utils": "1.3.1",
"@alilc/lowcode-types": "1.3.2",
"@alilc/lowcode-utils": "1.3.2",
"classnames": "^2.2.6",
"debug": "^4.1.1",
"intl-messageformat": "^9.3.1",

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-editor-skeleton",
"version": "1.3.1",
"version": "1.3.2",
"description": "alibaba lowcode editor skeleton",
"main": "lib/index.js",
"module": "es/index.js",
@ -19,10 +19,10 @@
],
"dependencies": {
"@alifd/next": "^1.20.12",
"@alilc/lowcode-designer": "1.3.1",
"@alilc/lowcode-editor-core": "1.3.1",
"@alilc/lowcode-types": "1.3.1",
"@alilc/lowcode-utils": "1.3.1",
"@alilc/lowcode-designer": "1.3.2",
"@alilc/lowcode-editor-core": "1.3.2",
"@alilc/lowcode-types": "1.3.2",
"@alilc/lowcode-utils": "1.3.2",
"classnames": "^2.2.6",
"react": "^16.8.1",
"react-dom": "^16.8.1"

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-engine",
"version": "1.3.1",
"version": "1.3.2",
"description": "An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系",
"main": "lib/engine-core.js",
"module": "es/engine-core.js",
@ -19,15 +19,16 @@
"license": "MIT",
"dependencies": {
"@alifd/next": "^1.19.12",
"@alilc/lowcode-designer": "1.3.1",
"@alilc/lowcode-editor-core": "1.3.1",
"@alilc/lowcode-editor-skeleton": "1.3.1",
"@alilc/lowcode-designer": "1.3.2",
"@alilc/lowcode-editor-core": "1.3.2",
"@alilc/lowcode-editor-skeleton": "1.3.2",
"@alilc/lowcode-engine-ext": "^1.0.0",
"@alilc/lowcode-plugin-designer": "1.3.1",
"@alilc/lowcode-plugin-outline-pane": "1.3.1",
"@alilc/lowcode-shell": "1.3.1",
"@alilc/lowcode-utils": "1.3.1",
"@alilc/lowcode-workspace": "1.3.1",
"@alilc/lowcode-plugin-command": "1.3.2",
"@alilc/lowcode-plugin-designer": "1.3.2",
"@alilc/lowcode-plugin-outline-pane": "1.3.2",
"@alilc/lowcode-shell": "1.3.2",
"@alilc/lowcode-utils": "1.3.2",
"@alilc/lowcode-workspace": "1.3.2",
"react": "^16.8.1",
"react-dom": "^16.8.1"
},

View File

@ -66,7 +66,7 @@ import { defaultPanelRegistry } from './inner-plugins/default-panel-registry';
import { shellModelFactory } from './modules/shell-model-factory';
import { builtinHotkey } from './inner-plugins/builtin-hotkey';
import { defaultContextMenu } from './inner-plugins/default-context-menu';
import { defaultCommand } from '@alilc/lowcode-plugin-command';
import { CommandPlugin } from '@alilc/lowcode-plugin-command';
import { OutlinePlugin } from '@alilc/lowcode-plugin-outline-pane';
export * from './modules/skeleton-types';
@ -84,7 +84,7 @@ async function registryInnerPlugin(designer: IDesigner, editor: IEditor, plugins
await plugins.register(builtinHotkey);
await plugins.register(registerDefaults, {}, { autoInit: true });
await plugins.register(defaultContextMenu);
await plugins.register(defaultCommand, {});
await plugins.register(CommandPlugin, {});
return () => {
plugins.delete(OutlinePlugin.pluginName);
@ -94,7 +94,7 @@ async function registryInnerPlugin(designer: IDesigner, editor: IEditor, plugins
plugins.delete(builtinHotkey.pluginName);
plugins.delete(registerDefaults.pluginName);
plugins.delete(defaultContextMenu.pluginName);
plugins.delete(defaultCommand.pluginName);
plugins.delete(CommandPlugin.pluginName);
};
}

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-ignitor",
"version": "1.3.1",
"version": "1.3.2",
"description": "点火器bootstrap lce project",
"main": "lib/index.js",
"private": true,

View File

@ -0,0 +1,22 @@
const fs = require('fs');
const { join } = require('path');
const esModules = [].join('|');
const pkgNames = fs.readdirSync(join('..')).filter(pkgName => !pkgName.startsWith('.'));
const jestConfig = {
transformIgnorePatterns: [
`/node_modules/(?!${esModules})/`,
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
collectCoverage: true,
collectCoverageFrom: [
'src/**/*.ts',
'src/**/*.tsx',
],
};
// 只对本仓库内的 pkg 做 mapping
jestConfig.moduleNameMapper = {};
jestConfig.moduleNameMapper[`^@alilc/lowcode\\-(${pkgNames.join('|')})$`] = '<rootDir>/../$1/src';
module.exports = jestConfig;

View File

@ -1,17 +1,19 @@
{
"name": "@alilc/lowcode-plugin-command",
"version": "1.3.1",
"version": "1.3.2",
"description": "> TODO: description",
"author": "liujuping <liujup@foxmail.com>",
"homepage": "https://github.com/alibaba/lowcode-engine#readme",
"license": "ISC",
"main": "lib/plugin-command.js",
"main": "lib/index.js",
"module": "es/index.js",
"directories": {
"lib": "lib",
"test": "__tests__"
},
"files": [
"lib"
"lib",
"es"
],
"publishConfig": {
"access": "public"
@ -28,7 +30,10 @@
"url": "https://github.com/alibaba/lowcode-engine/issues"
},
"dependencies": {
"@alilc/lowcode-types": "^1.3.1",
"@alilc/lowcode-utils": "^1.3.1"
"@alilc/lowcode-types": "1.3.2",
"@alilc/lowcode-utils": "1.3.2"
},
"devDependencies": {
"@alib/build-scripts": "^0.1.18"
}
}

View File

@ -2,7 +2,7 @@ import { IPublicModelPluginContext, IPublicTypePlugin } from '@alilc/lowcode-typ
import { nodeCommand } from './node-command';
import { historyCommand } from './history-command';
export const defaultCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext) => {
export const CommandPlugin: IPublicTypePlugin = (ctx: IPublicModelPluginContext) => {
const { plugins } = ctx;
return {
@ -17,7 +17,9 @@ export const defaultCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext
};
};
defaultCommand.pluginName = '___default_command___';
defaultCommand.meta = {
CommandPlugin.pluginName = '___default_command___';
CommandPlugin.meta = {
commandScope: 'common',
};
export default CommandPlugin;

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-plugin-designer",
"version": "1.3.1",
"version": "1.3.2",
"description": "alibaba lowcode editor designer plugin",
"files": [
"es",
@ -18,9 +18,9 @@
],
"author": "xiayang.xy",
"dependencies": {
"@alilc/lowcode-designer": "1.3.1",
"@alilc/lowcode-editor-core": "1.3.1",
"@alilc/lowcode-utils": "1.3.1",
"@alilc/lowcode-designer": "1.3.2",
"@alilc/lowcode-editor-core": "1.3.2",
"@alilc/lowcode-utils": "1.3.2",
"react": "^16.8.1",
"react-dom": "^16.8.1"
},

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-plugin-outline-pane",
"version": "1.3.1",
"version": "1.3.2",
"description": "Outline pane for Ali lowCode engine",
"files": [
"es",
@ -13,8 +13,8 @@
},
"dependencies": {
"@alifd/next": "^1.19.16",
"@alilc/lowcode-types": "1.3.1",
"@alilc/lowcode-utils": "1.3.1",
"@alilc/lowcode-types": "1.3.2",
"@alilc/lowcode-utils": "1.3.2",
"classnames": "^2.2.6",
"react": "^16",
"react-dom": "^16.7.0",

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-react-renderer",
"version": "1.3.1",
"version": "1.3.2",
"description": "react renderer for ali lowcode engine",
"main": "lib/index.js",
"module": "es/index.js",
@ -22,7 +22,7 @@
],
"dependencies": {
"@alifd/next": "^1.21.16",
"@alilc/lowcode-renderer-core": "1.3.1"
"@alilc/lowcode-renderer-core": "1.3.2"
},
"devDependencies": {
"@alib/build-scripts": "^0.1.18",

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-react-simulator-renderer",
"version": "1.3.1",
"version": "1.3.2",
"description": "react simulator renderer for alibaba lowcode designer",
"main": "lib/index.js",
"module": "es/index.js",
@ -17,10 +17,10 @@
"test:cov": "build-scripts test --config build.test.json --jest-coverage"
},
"dependencies": {
"@alilc/lowcode-designer": "1.3.1",
"@alilc/lowcode-react-renderer": "1.3.1",
"@alilc/lowcode-types": "1.3.1",
"@alilc/lowcode-utils": "1.3.1",
"@alilc/lowcode-designer": "1.3.2",
"@alilc/lowcode-react-renderer": "1.3.2",
"@alilc/lowcode-types": "1.3.2",
"@alilc/lowcode-utils": "1.3.2",
"classnames": "^2.2.6",
"mobx": "^6.3.0",
"mobx-react": "^7.2.0",

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-renderer-core",
"version": "1.3.1",
"version": "1.3.2",
"description": "renderer core",
"license": "MIT",
"main": "lib/index.js",
@ -16,8 +16,8 @@
},
"dependencies": {
"@alilc/lowcode-datasource-engine": "^1.0.0",
"@alilc/lowcode-types": "1.3.1",
"@alilc/lowcode-utils": "1.3.1",
"@alilc/lowcode-types": "1.3.2",
"@alilc/lowcode-utils": "1.3.2",
"classnames": "^2.2.6",
"debug": "^4.1.1",
"fetch-jsonp": "^1.1.3",
@ -32,7 +32,7 @@
"devDependencies": {
"@alib/build-scripts": "^0.1.18",
"@alifd/next": "^1.26.0",
"@alilc/lowcode-designer": "1.3.1",
"@alilc/lowcode-designer": "1.3.2",
"@babel/plugin-transform-typescript": "^7.16.8",
"@testing-library/react": "^11.2.2",
"@types/classnames": "^2.2.11",

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-shell",
"version": "1.3.1",
"version": "1.3.2",
"description": "Shell Layer for AliLowCodeEngine",
"main": "lib/index.js",
"module": "es/index.js",
@ -13,12 +13,12 @@
},
"license": "MIT",
"dependencies": {
"@alilc/lowcode-designer": "1.3.1",
"@alilc/lowcode-editor-core": "1.3.1",
"@alilc/lowcode-editor-skeleton": "1.3.1",
"@alilc/lowcode-types": "1.3.1",
"@alilc/lowcode-utils": "1.3.1",
"@alilc/lowcode-workspace": "1.3.1",
"@alilc/lowcode-designer": "1.3.2",
"@alilc/lowcode-editor-core": "1.3.2",
"@alilc/lowcode-editor-skeleton": "1.3.2",
"@alilc/lowcode-types": "1.3.2",
"@alilc/lowcode-utils": "1.3.2",
"@alilc/lowcode-workspace": "1.3.2",
"classnames": "^2.2.6",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",

View File

@ -3,7 +3,7 @@ import {
IDesigner,
isComponentMeta,
} from '@alilc/lowcode-designer';
import { IPublicTypeAssetsJson } from '@alilc/lowcode-utils';
import { IPublicTypeAssetsJson, getLogger } from '@alilc/lowcode-utils';
import {
IPublicTypeComponentAction,
IPublicTypeComponentMetadata,
@ -21,6 +21,8 @@ import { editorSymbol, designerSymbol } from '../symbols';
import { ComponentMeta as ShellComponentMeta } from '../model';
import { ComponentType } from 'react';
const logger = getLogger({ level: 'warn', bizName: 'shell-material' });
const innerEditorSymbol = Symbol('editor');
export class Material implements IPublicApiMaterial {
private readonly [innerEditorSymbol]: IPublicModelEditor;
@ -31,6 +33,10 @@ export class Material implements IPublicApiMaterial {
}
const workspace: InnerWorkspace = globalContext.get('workspace');
if (workspace.isActive) {
if (!workspace.window.editor) {
logger.error('Material api 调用时机出现问题,请检查');
return this[innerEditorSymbol];
}
return workspace.window.editor;
}

View File

@ -48,8 +48,8 @@ export class Window implements IPublicModelWindow {
}
get currentEditorView() {
if (this[windowSymbol].editorView) {
return new EditorView(this[windowSymbol].editorView).toProxy() as any;
if (this[windowSymbol]._editorView) {
return new EditorView(this[windowSymbol]._editorView).toProxy() as any;
}
return null;
}

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-types",
"version": "1.3.1",
"version": "1.3.2",
"description": "Types for Ali lowCode engine",
"files": [
"es",

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-utils",
"version": "1.3.1",
"version": "1.3.2",
"description": "Utils for Ali lowCode engine",
"files": [
"lib",
@ -14,7 +14,7 @@
},
"dependencies": {
"@alifd/next": "^1.19.16",
"@alilc/lowcode-types": "1.3.1",
"@alilc/lowcode-types": "1.3.2",
"lodash": "^4.17.21",
"mobx": "^6.3.0",
"prop-types": "^15.8.1",

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-workspace",
"version": "1.3.1",
"version": "1.3.2",
"description": "Shell Layer for AliLowCodeEngine",
"main": "lib/index.js",
"module": "es/index.js",
@ -15,11 +15,11 @@
},
"license": "MIT",
"dependencies": {
"@alilc/lowcode-designer": "1.3.1",
"@alilc/lowcode-editor-core": "1.3.1",
"@alilc/lowcode-editor-skeleton": "1.3.1",
"@alilc/lowcode-types": "1.3.1",
"@alilc/lowcode-utils": "1.3.1",
"@alilc/lowcode-designer": "1.3.2",
"@alilc/lowcode-editor-core": "1.3.2",
"@alilc/lowcode-editor-skeleton": "1.3.2",
"@alilc/lowcode-types": "1.3.2",
"@alilc/lowcode-utils": "1.3.2",
"classnames": "^2.2.6",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5",

View File

@ -17,7 +17,7 @@ export interface IEditorWindow extends Omit<IPublicModelWindow<IResource>, 'chan
editorViews: Map<string, IViewContext>;
editorView: IViewContext;
_editorView: IViewContext;
changeViewName: (name: string, ignoreEmit?: boolean) => void;
@ -54,7 +54,7 @@ export class EditorWindow implements IEditorWindow {
url: string | undefined;
@obx.ref editorView: Context;
@obx.ref _editorView: Context;
@obx editorViews: Map<string, Context> = new Map<string, Context>();
@ -62,6 +62,13 @@ export class EditorWindow implements IEditorWindow {
sleep: boolean | undefined;
get editorView() {
if (!this._editorView) {
return this.editorViews.values().next().value;
}
return this._editorView;
}
constructor(readonly resource: IResource, readonly workspace: IWorkspace, private config: IWindowCOnfig) {
makeObservable(this);
this.title = config.title;
@ -75,10 +82,10 @@ export class EditorWindow implements IEditorWindow {
updateState(state: WINDOW_STATE): void {
switch (state) {
case WINDOW_STATE.active:
this.editorView?.setActivate(true);
this._editorView?.setActivate(true);
break;
case WINDOW_STATE.inactive:
this.editorView?.setActivate(false);
this._editorView?.setActivate(false);
break;
case WINDOW_STATE.destroyed:
break;
@ -146,7 +153,7 @@ export class EditorWindow implements IEditorWindow {
for (let i = 0; i < editorViews.length; i++) {
const name = editorViews[i].viewName;
await this.initViewType(name);
if (!this.editorView) {
if (!this._editorView) {
this.changeViewName(name);
}
}
@ -190,14 +197,14 @@ export class EditorWindow implements IEditorWindow {
};
changeViewName = (name: string, ignoreEmit: boolean = true) => {
this.editorView?.setActivate(false);
this.editorView = this.editorViews.get(name)!;
this._editorView?.setActivate(false);
this._editorView = this.editorViews.get(name)!;
if (!this.editorView) {
if (!this._editorView) {
return;
}
this.editorView.setActivate(true);
this._editorView.setActivate(true);
if (!ignoreEmit) {
this.emitter.emit('window.change.view.type', name);