-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
162 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: commonUI - UI 组件库 | ||
sidebar_position: 11 | ||
sidebar_position: 10 | ||
--- | ||
|
||
## 简介 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: init - 初始化 API | ||
sidebar_position: 10 | ||
sidebar_position: 0 | ||
--- | ||
|
||
> **@since** v1.0.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"label": "模型定义 Models", | ||
"position": 14, | ||
"position": 100, | ||
"collapsed": false, | ||
"collapsible": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
title: project - 模型 API | ||
sidebar_position: 3 | ||
sidebar_position: 10 | ||
--- | ||
## 模块简介 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,15 @@ | |
"author": "liujuping <[email protected]>", | ||
"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" | ||
|
@@ -30,5 +32,8 @@ | |
"dependencies": { | ||
"@alilc/lowcode-types": "^1.3.1", | ||
"@alilc/lowcode-utils": "^1.3.1" | ||
}, | ||
"devDependencies": { | ||
"@alib/build-scripts": "^0.1.18" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters