mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 11:20:11 +00:00
chore: merge from develop
This commit is contained in:
commit
170a45d949
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: canvas - 画布 API
|
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/>
|
> **@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
101
docs/docs/api/command.md
Normal 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;
|
||||||
|
```
|
||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: common - 通用 API
|
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/>
|
> **@types** [IPublicApiCommon](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/common.ts)<br/>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: commonUI - UI 组件库
|
title: commonUI - UI 组件库
|
||||||
sidebar_position: 11
|
sidebar_position: 10
|
||||||
---
|
---
|
||||||
|
|
||||||
## 简介
|
## 简介
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: config - 配置 API
|
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/>
|
> **@types** [IPublicModelEngineConfig](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/engine-config.ts)<br/>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: config options - 配置列表
|
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/>
|
> **@types** [IPublicTypeEngineOptions](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/engine-options.ts)<br/>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: event - 事件 API
|
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/>
|
> **@types** [IPublicApiEvent](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/event.ts)<br/>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: hotkey - 快捷键 API
|
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/>
|
> **@types** [IPublicApiHotkey](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/hotkey.ts)<br/>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: init - 初始化 API
|
title: init - 初始化 API
|
||||||
sidebar_position: 10
|
sidebar_position: 0
|
||||||
---
|
---
|
||||||
|
|
||||||
> **@since** v1.0.0
|
> **@since** v1.0.0
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: logger - 日志 API
|
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/>
|
> **@types** [IPublicApiLogger](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/logger.ts)<br/>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: material - 物料 API
|
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/>
|
> **@types** [IPublicApiMaterial](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/material.ts)<br/>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"label": "模型定义 Models",
|
"label": "模型定义 Models",
|
||||||
"position": 14,
|
"position": 100,
|
||||||
"collapsed": false,
|
"collapsed": false,
|
||||||
"collapsible": true
|
"collapsible": true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: plugins - 插件 API
|
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/>
|
> **@types** [IPublicApiPlugins](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/plugins.ts)<br/>
|
||||||
> **@since** v1.0.0
|
> **@since** v1.0.0
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: project - 模型 API
|
title: project - 模型 API
|
||||||
sidebar_position: 3
|
sidebar_position: 10
|
||||||
---
|
---
|
||||||
## 模块简介
|
## 模块简介
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: setters - 设置器 API
|
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/>
|
> **@types** [IPublicApiSetters](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/setters.ts)<br/>
|
||||||
> **@since** v1.0.0
|
> **@since** v1.0.0
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: simulatorHost - 模拟器 API
|
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/>
|
> **@types** [IPublicApiSimulatorHost](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/simulator-host.ts)<br/>
|
||||||
> **@since** v1.0.0
|
> **@since** v1.0.0
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: skeleton - 面板 API
|
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/>
|
> **@types** [IPublicApiSkeleton](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/api/skeleton.ts)<br/>
|
||||||
> **@since** v1.0.0
|
> **@since** v1.0.0
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
title: workspace - 应用级 API
|
title: workspace - 应用级 API
|
||||||
sidebar_position: 12
|
sidebar_position: 10
|
||||||
---
|
---
|
||||||
|
|
||||||
> **[@experimental](./#experimental)**<br/>
|
> **[@experimental](./#experimental)**<br/>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alilc/lowcode-engine-docs",
|
"name": "@alilc/lowcode-engine-docs",
|
||||||
"version": "1.2.30",
|
"version": "1.2.31",
|
||||||
"description": "低代码引擎版本化文档",
|
"description": "低代码引擎版本化文档",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"files": [
|
"files": [
|
||||||
|
|||||||
@ -23,11 +23,12 @@
|
|||||||
"@alilc/lowcode-editor-core": "1.3.2-beta.4",
|
"@alilc/lowcode-editor-core": "1.3.2-beta.4",
|
||||||
"@alilc/lowcode-editor-skeleton": "1.3.2-beta.4",
|
"@alilc/lowcode-editor-skeleton": "1.3.2-beta.4",
|
||||||
"@alilc/lowcode-engine-ext": "^1.0.0",
|
"@alilc/lowcode-engine-ext": "^1.0.0",
|
||||||
"@alilc/lowcode-plugin-designer": "1.3.2-beta.4",
|
"@alilc/lowcode-plugin-designer": "1.3.1",
|
||||||
"@alilc/lowcode-plugin-outline-pane": "1.3.2-beta.4",
|
"@alilc/lowcode-plugin-outline-pane": "1.3.1",
|
||||||
"@alilc/lowcode-shell": "1.3.2-beta.4",
|
"@alilc/lowcode-shell": "1.3.1",
|
||||||
"@alilc/lowcode-utils": "1.3.2-beta.4",
|
"@alilc/lowcode-utils": "1.3.1",
|
||||||
"@alilc/lowcode-workspace": "1.3.2-beta.4",
|
"@alilc/lowcode-workspace": "1.3.1",
|
||||||
|
"@alilc/lowcode-plugin-command": "1.3.1",
|
||||||
"react": "^16.8.1",
|
"react": "^16.8.1",
|
||||||
"react-dom": "^16.8.1"
|
"react-dom": "^16.8.1"
|
||||||
},
|
},
|
||||||
|
|||||||
@ -66,7 +66,7 @@ import { defaultPanelRegistry } from './inner-plugins/default-panel-registry';
|
|||||||
import { shellModelFactory } from './modules/shell-model-factory';
|
import { shellModelFactory } from './modules/shell-model-factory';
|
||||||
import { builtinHotkey } from './inner-plugins/builtin-hotkey';
|
import { builtinHotkey } from './inner-plugins/builtin-hotkey';
|
||||||
import { defaultContextMenu } from './inner-plugins/default-context-menu';
|
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';
|
import { OutlinePlugin } from '@alilc/lowcode-plugin-outline-pane';
|
||||||
|
|
||||||
export * from './modules/skeleton-types';
|
export * from './modules/skeleton-types';
|
||||||
@ -84,7 +84,7 @@ async function registryInnerPlugin(designer: IDesigner, editor: IEditor, plugins
|
|||||||
await plugins.register(builtinHotkey);
|
await plugins.register(builtinHotkey);
|
||||||
await plugins.register(registerDefaults, {}, { autoInit: true });
|
await plugins.register(registerDefaults, {}, { autoInit: true });
|
||||||
await plugins.register(defaultContextMenu);
|
await plugins.register(defaultContextMenu);
|
||||||
await plugins.register(defaultCommand, {});
|
await plugins.register(CommandPlugin, {});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
plugins.delete(OutlinePlugin.pluginName);
|
plugins.delete(OutlinePlugin.pluginName);
|
||||||
@ -94,7 +94,7 @@ async function registryInnerPlugin(designer: IDesigner, editor: IEditor, plugins
|
|||||||
plugins.delete(builtinHotkey.pluginName);
|
plugins.delete(builtinHotkey.pluginName);
|
||||||
plugins.delete(registerDefaults.pluginName);
|
plugins.delete(registerDefaults.pluginName);
|
||||||
plugins.delete(defaultContextMenu.pluginName);
|
plugins.delete(defaultContextMenu.pluginName);
|
||||||
plugins.delete(defaultCommand.pluginName);
|
plugins.delete(CommandPlugin.pluginName);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
22
packages/plugin-command/jest.config.js
Normal file
22
packages/plugin-command/jest.config.js
Normal 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;
|
||||||
@ -5,13 +5,15 @@
|
|||||||
"author": "liujuping <liujup@foxmail.com>",
|
"author": "liujuping <liujup@foxmail.com>",
|
||||||
"homepage": "https://github.com/alibaba/lowcode-engine#readme",
|
"homepage": "https://github.com/alibaba/lowcode-engine#readme",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"main": "lib/plugin-command.js",
|
"main": "lib/index.js",
|
||||||
|
"module": "es/index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
"lib": "lib",
|
"lib": "lib",
|
||||||
"test": "__tests__"
|
"test": "__tests__"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib",
|
||||||
|
"es"
|
||||||
],
|
],
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
@ -30,5 +32,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alilc/lowcode-types": "^1.3.1",
|
"@alilc/lowcode-types": "^1.3.1",
|
||||||
"@alilc/lowcode-utils": "^1.3.1"
|
"@alilc/lowcode-utils": "^1.3.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@alib/build-scripts": "^0.1.18"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { IPublicModelPluginContext, IPublicTypePlugin } from '@alilc/lowcode-typ
|
|||||||
import { nodeCommand } from './node-command';
|
import { nodeCommand } from './node-command';
|
||||||
import { historyCommand } from './history-command';
|
import { historyCommand } from './history-command';
|
||||||
|
|
||||||
export const defaultCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext) => {
|
export const CommandPlugin: IPublicTypePlugin = (ctx: IPublicModelPluginContext) => {
|
||||||
const { plugins } = ctx;
|
const { plugins } = ctx;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -17,7 +17,9 @@ export const defaultCommand: IPublicTypePlugin = (ctx: IPublicModelPluginContext
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
defaultCommand.pluginName = '___default_command___';
|
CommandPlugin.pluginName = '___default_command___';
|
||||||
defaultCommand.meta = {
|
CommandPlugin.meta = {
|
||||||
commandScope: 'common',
|
commandScope: 'common',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default CommandPlugin;
|
||||||
Loading…
x
Reference in New Issue
Block a user