Skip to content

Commit 90add38

Browse files
committed
chore: merge from release/1.2.3
2 parents 3c3a305 + f418e5b commit 90add38

File tree

154 files changed

+3828
-865
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+3828
-865
lines changed

.github/workflows/publish docs.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Update and Publish Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
paths:
8+
- 'docs/docs/**'
9+
10+
jobs:
11+
publish-docs:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v2
17+
with:
18+
node-version: '14'
19+
registry-url: 'https://registry.npmjs.org'
20+
- run: cd docs && npm install
21+
- run: |
22+
cd docs
23+
npm version patch
24+
git config --local user.email "action@github.com"
25+
git config --local user.name "GitHub Action"
26+
git add package.json
27+
git commit -m "Update package version"
28+
git push
29+
- run: cd docs && npm publish
30+
env:
31+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
32+
- name: Get version
33+
id: get_version
34+
run: echo "::set-output name=version::$(node -p "require('./docs/package.json').version")"
35+
36+
comment-pr:
37+
needs: publish-docs
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Comment on PR
41+
if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
42+
uses: actions/github-script@v4
43+
with:
44+
github-token: ${{ secrets.GITHUB_TOKEN }}
45+
script: |
46+
github.issues.createComment({
47+
issue_number: context.issue.number,
48+
owner: context.repo.owner,
49+
repo: context.repo.repo,
50+
body: '🚀 New version has been released: ' + '${{ needs.publish-docs.outputs.version }}'
51+
})
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish Engine Beta
2+
3+
on:
4+
push:
5+
branches:
6+
- 'release/[0-9]+.[0-9]+.[0-9]+-beta'
7+
paths:
8+
- 'packages/**'
9+
10+
jobs:
11+
publish-engine:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v2
17+
with:
18+
node-version: '14'
19+
registry-url: 'https://registry.npmjs.org'
20+
- run: npm install && npm run setup
21+
- run: |
22+
npm run build
23+
git config --local user.email "action@github.com"
24+
git config --local user.name "GitHub Action"
25+
- run: npm run pub:prerelease
26+
env:
27+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
28+
- name: Get version
29+
id: get_version
30+
run: echo "::set-output name=version::$(node -p "require('./package.json').version")"

docs/docs/api/material.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,21 @@ material.setAssets(assets1);
116116
material.loadIncrementalAssets(assets2);
117117
```
118118

119+
更新特定物料的描述文件
120+
121+
```typescript
122+
import { material } from '@alilc/lowcode-engine';
123+
material.loadIncrementalAssets({
124+
version: '',
125+
components: [
126+
{
127+
"componentName": 'Button',
128+
"props": [{ name: 'new', title: 'new', propType: 'string' }]
129+
}
130+
],
131+
})
132+
```
133+
119134
### 设计器辅助层
120135
#### addBuiltinComponentAction
121136
在设计器辅助层增加一个扩展 action

docs/docs/api/skeleton.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ skeleton.add({
6969
props: {
7070
align: "left",
7171
icon: "wenjian",
72+
title: '标题', // 图标下方展示的标题
7273
description: "JS 面板",
7374
},
7475
panelProps: {
@@ -295,6 +296,68 @@ showArea(areaName: string): void;
295296
*/
296297
hideArea(areaName: string): void;
297298
```
299+
300+
### registerConfigTransducer
301+
注册一个面板的配置转换器(transducer)。
302+
303+
```typescript
304+
/**
305+
* 注册一个面板的配置转换器(transducer)。
306+
* Registers a configuration transducer for a panel.
307+
* @param {IPublicTypeConfigTransducer} transducer
308+
* - 要注册的转换器函数。该函数接受一个配置对象(类型为 IPublicTypeSkeletonConfig)作为输入,并返回修改后的配置对象。
309+
* - The transducer function to be registered. This function takes a configuration object
310+
*
311+
* @param {number} level
312+
* - 转换器的优先级。优先级较高的转换器会先执行。
313+
* - The priority level of the transducer. Transducers with higher priority levels are executed first.
314+
*
315+
* @param {string} [id]
316+
* - (可选)转换器的唯一标识符。用于在需要时引用或操作特定的转换器。
317+
* - (Optional) A unique identifier for the transducer. Used for referencing or manipulating a specific transducer when needed.
318+
*/
319+
registerConfigTransducer(transducer: IPublicTypeConfigTransducer, level: number, id?: string): void;
320+
```
321+
322+
使用示例
323+
324+
```typescript
325+
import { IPublicModelPluginContext, IPublicTypeSkeletonConfig } from '@alilc/lowcode-types';
326+
327+
function updatePanelWidth(config: IPublicTypeSkeletonConfig) {
328+
if (config.type === 'PanelDock') {
329+
return {
330+
...config,
331+
panelProps: {
332+
...(config.panelProps || {}),
333+
width: 240,
334+
},
335+
}
336+
}
337+
338+
return config;
339+
}
340+
341+
const controlPanelWidthPlugin = (ctx: IPublicModelPluginContext) => {
342+
const { skeleton } = ctx;
343+
(skeleton as any).registerConfigTransducer?.(updatePanelWidth, 1, 'update-panel-width');
344+
345+
return {
346+
init() {},
347+
};
348+
};
349+
350+
controlPanelWidthPlugin.pluginName = 'controlPanelWidthPlugin';
351+
controlPanelWidthPlugin.meta = {
352+
dependencies: [],
353+
engines: {
354+
lowcodeEngine: '^1.2.3', // 插件需要配合 ^1.0.0 的引擎才可运行
355+
},
356+
};
357+
358+
export default controlPanelWidthPlugin;
359+
```
360+
298361
## 事件
299362
### onShowPanel
300363

docs/docs/article/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- [2022/12/21 低代码多分支协同开发的建设与实践](https://mp.weixin.qq.com/s/DmwxL67htHfTUP1U966N-Q)
77
- [2022/11/24 低代码引擎半岁啦,来跟大家唠唠嗑...](https://segmentfault.com/a/1190000042884409)
88
- [2022/10/27 低代码技术在研发团队的应用模式探讨](https://mp.weixin.qq.com/s/Ynk_wjJbmNw7fEG6UtGZbQ)
9+
- [2022/08/23 基于 LowCodeEngine 的调试能力建设与实践](https://mp.weixin.qq.com/s/H8KvEOylmzLPgIuuBO0S9w)
910
- [2022/06/23 低代码渲染那些事](https://mp.weixin.qq.com/s/yqYey76qLGYPfDtpGkVFfA)
1011
- [2022/06/16 关于 LowCode&ProCode 混合研发的思考](https://mp.weixin.qq.com/s/TY3VXjkSmsQoT47xma3wig)
1112
- [2022/04/07 磁贴布局在钉钉宜搭报表设计引擎中的实现](https://mp.weixin.qq.com/s/PSTut5ahAB8nlJ9kBpBaxw)

docs/docs/faq/faq023.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: Slot组件渲染报错问题
3+
sidebar_position: 23
4+
tags: [FAQ]
5+
---
6+
7+
## 问题描述
8+
在低代码引擎的页面渲染过程中,可能会遇到一个关于Slot组件的报错,提示“Slot找不到”。实际上,在渲染态时不应使用Slot组件。
9+
10+
## 问题原因
11+
低代码引擎渲染分为两个状态:设计态和渲染态。
12+
- **设计态**:为了帮助插槽进行可视化设计,引入了Slot组件。
13+
- **渲染态**:在此状态下,不需要使用Slot组件。
14+
15+
这个问题通常是因为在渲染态错误地使用了设计态的schema。
16+
17+
## 解决方案
18+
1. **区分设计态和渲染态**:通过`project.exportSchema(TransformStage.Save)`的参数来区分。
19+
- `TransformStage.Save`代表渲染态的schema,其中不包含Slot组件。
20+
- 【默认值】`TransformStage.Render`代表设计态的schema,其中包含Slot组件。
21+
2. **使用正确的API和参数**:确保在渲染态使用正确的schema,避免引用设计态的Slot组件。
22+
3. **处理脏数据问题**:如果问题是由脏数据导致,清除数据并重新拖拽组件以恢复正常。
23+
24+
## 注意事项
25+
- 确保在代码和配置中正确区分设计态和渲染态。
26+
- 如果遇到持续的问题,检查是否有脏数据或配置错误,并进行相应的清理和调整。
27+
28+
## 相关链接
29+
- Issue链接:[Issue #1798](https://github.com/alibaba/lowcode-engine/issues/1798)
30+
31+
---

docs/docs/faq/faq024.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
---
2+
title: workspace 模式常见问题
3+
sidebar_position: 23
4+
tags: [FAQ]
5+
---
6+
7+
#### 如何判断是否开启了IDE模式?
8+
9+
- **通过官方API判断**:您可以通过访问 [workspace.isActive](/site/docs/api/workspace#isactive) 来判断当前是否处于IDE模式。这是阿里低代码引擎提供的一个官方API,专门用于确认是否处于集成开发环境。
10+
11+
12+
13+
#### 如何使用插件的ctx来做判断在哪个模式下?
14+
15+
- **插件是否为应用级别**:可以通过 **ctx.isPluginRegisteredInWorkspace** 方法来判断一个插件是否是应用级别的插件。这有助于理解插件在阿里低代码引擎中的作用域和潜在的使用场景。
16+
- **插件的注册级别**:您可以使用 **ctx.registerLevel** 属性来判断插件处于哪个级别。插件级别的值包括:
17+
- **Default**:默认级别。非 IDE 模式下的值
18+
- **Workspace**:应用级别。
19+
- **Resource**:资源级别。
20+
- **EditorView**:编辑视图级别。 这些级别代表了插件可能的作用域和使用场景,有助于在开发和管理低代码应用时对插件进行更精确的控制和配置。
21+
22+
23+
24+
#### 如何在IDE模式下设置资源列表?
25+
26+
- **设置资源列表API**:在IDE模式下,可以通过访问 [workspace.setResourceList](/site/docs/api/workspace#setresourcelist) 来设置或更新IDE中的资源列表。这确保您在编辑器窗口中打开的资源是最新且可访问的。
27+
28+
29+
30+
#### 如何打开视图窗口?
31+
32+
- **使用推荐的方法**:使用 `openEditorWindow(resource: Resource, sleep?: boolean): Promise<void>;` 来打开视图窗口。这里的 **resource** 参数指的是您要打开的特定资源,可通过 [workspace.resourceList](/site/docs/api/workspace#resourcelist) 获取。
33+
- **不推荐使用的过时方法**:有一个过时的方法 `openEditorWindow(resourceName: string, id: string, extra: Object, viewName?: string, sleep?: boolean): Promise<void>;` 也用于打开视图窗口。虽然仍然可用,但官方不推荐使用此方法,并计划在后续版本中废弃,因为它在维护和可扩展性方面存在限制。
34+
35+
36+
37+
#### 如何在全局插件中获取视图的上下文?
38+
39+
- 在阿里低代码引擎的全局插件中获取视图的上下文,可以通过使用 **ProvideViewPluginContext** 函数实现。这个函数来自 **@alilc/lowcode-utils** 库,它使得您的 React 组件能够接收 **pluginContext** 作为 props,进而访问和操作当前视图的状态和属性。
40+
41+
**步骤**
42+
43+
**引入依赖**:首先,确保您的插件文件中已经引入了 **ProvideViewPluginContext** 以及其他必要的依赖。
44+
45+
```
46+
import { ProvideViewPluginContext } from '@alilc/lowcode-utils';
47+
```
48+
49+
**定义 React 组件**:创建一个 React 组件,它将使用来自 **ProvideViewPluginContext****pluginContext**
50+
51+
```typescript
52+
const MyComponent = (props) => {
53+
const { pluginContext } = props;
54+
// 组件逻辑
55+
return <div>/* 组件内容 */</div>;
56+
};
57+
```
58+
59+
**定义全局插件**:定义一个函数,这个函数会在插件被注册时调用。这个函数通常接受一个上下文对象 **ctx**,它提供了对引擎功能的访问。
60+
61+
```javascript
62+
const globalPlugin = (ctx) => {
63+
const { skeleton } = ctx;
64+
65+
skeleton.add({
66+
type: 'PanelDock',
67+
name: 'datapool',
68+
content: ProvideViewPluginContext((props) => {
69+
// 组件内容
70+
return (
71+
<MyComponent {...props} />
72+
)
73+
}),
74+
// 其他配置
75+
contentProps: {
76+
// 需要提供 pluginContext 作为参数
77+
pluginContext: ctx,
78+
}
79+
});
80+
};
81+
```
82+
83+
通过这些步骤,您的全局插件中的 React 组件就能够获取并使用视图的上下文了。这为您在插件中实现更复杂的功能和交互提供了基础。
84+
85+
86+
87+
**注意事项**
88+
89+
- **组件重渲染**:正常情况下,**pluginsContext** 是视图的上下文。当视图切换时,组件会重新渲染。如果需要在组件中处理视图切换导致的重新渲染,可以利用 React 的 **key** 属性。
90+
91+
**示例代码**
92+
93+
```typescript
94+
ProvideViewPluginContext(props => {
95+
return (
96+
<DataPoolPane
97+
{...props}
98+
key={props.pluginContext?.editorWindow?.id}
99+
);
100+
});
101+
```
102+
103+
通过这种方式,当视图切换时,组件会根据视图的不同进行重新渲染,确保组件状态与当前视图的上下文保持一致。这对于在低代码平台上开发复杂插件和交互功能是非常有用的。
104+
105+
106+
107+
#### 如何判断插件是否在 Workspace 模式下注册?
108+
109+
**使用** **ctx.isPluginRegisteredInWorkspace()** **方法**:
110+
111+
通过 **ctx.isPluginRegisteredInWorkspace()** 方法,可以判断一个插件是否在 Workspace 级别注册。以下是一个示例代码片段:
112+
113+
```javascript
114+
if (ctx.isPluginRegisteredInWorkspace('pluginName')) {
115+
console.log('插件已在 Workspace 模式下注册。');
116+
} else {
117+
console.log('插件未在 Workspace 模式下注册。');
118+
}
119+
```
120+
121+
注意:此方法目前在 beta 版本中,可能会有 TypeScript 提示显示已移除。
122+
123+
**检查** **ctx.registerLevel** **的值**:
124+
125+
可以通过比较 **ctx.registerLevel** 的值来判断插件的注册级别。示例代码如下:
126+
127+
```javascript
128+
if (ctx.registerLevel !== IPublicEnumPluginRegisterLevel.Workspace) {
129+
console.log('插件未在 Workspace 模式下注册。');
130+
} else {
131+
console.log('插件已在 Workspace 模式下注册。');
132+
}
133+
```

0 commit comments

Comments
 (0)