Skip to content

Commit

Permalink
Merge branch 'develop' into feat/reset-attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiZng committed Jan 11, 2024
2 parents 4c95af5 + 6f9359e commit c14baad
Show file tree
Hide file tree
Showing 127 changed files with 1,729 additions and 2,934 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
* @liujuping @JackLian

/modules/material-parser @akirakai
/modules/code-generator @leoyuan
/modules/code-generator @qingniaotonghua
2 changes: 1 addition & 1 deletion .github/workflows/publish docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Get version
id: get_version
run: echo "::set-output name=version::$(node -p "require('./docs/package.json').version")"
run: echo "version=$(node -p "require('./docs/package.json').version")" >> $GITHUB_OUTPUT

comment-pr:
needs: publish-docs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish engine beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Get version
id: get_version
run: echo "::set-output name=version::$(node -p "require('./package.json').version")"
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
2 changes: 1 addition & 1 deletion .github/workflows/publish engine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Get version
id: get_version
run: echo "::set-output name=version::$(node -p "require('./package.json').version")"
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,5 @@ typings/
# codealike
codealike.json
.node

.must.config.js
16 changes: 16 additions & 0 deletions docs/docs/api/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,22 @@ const { intl, getLocale, setLocale } = common.utils.createIntl({

```

#### intl

i18n 转换方法

```typescript
/**
* i18n 转换方法
*/
intl(data: IPublicTypeI18nData | string, params?: object): string;
```

##### 示例
```
const title = common.utils.intl(node.title)
```

### skeletonCabin
#### Workbench
编辑器框架 View
Expand Down
210 changes: 210 additions & 0 deletions docs/docs/api/commonUI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
---
title: commonUI - UI 组件库
sidebar_position: 11
---

## 简介
CommonUI API 是一个专为低代码引擎设计的组件 UI 库,使用它开发的插件,可以保证在不同项目和主题切换中能够保持一致性和兼容性。

## 组件列表

### Tip

提示组件

| 参数 | 说明 | 类型 | 默认值 |
|-----------|--------------|---------------------------------------|--------|
| className | className | string (optional) | |
| children | tip 的内容 | IPublicTypeI18nData \| ReactNode | |
| direction | tip 的方向 | 'top' \| 'bottom' \| 'left' \| 'right' | |


### HelpTip

带 help icon 的提示组件

| 参数 | 说明 | 类型 | 默认值 |
|-----------|--------|-----------------------------------|--------|
| help | 描述 | IPublicTypeHelpTipConfig | |
| direction | 方向 | IPublicTypeTipConfig['direction'] | 'top' |
| size | 方向 | IconProps['size'] | 'small'|

### Title

标题组件

| 参数 | 说明 | 类型 | 默认值 |
|-----------|------------|-----------------------------|--------|
| title | 标题内容 | IPublicTypeTitleContent | |
| className | className | string (optional) | |
| onClick | 点击事件 | () => void (optional) | |

### ContextMenu

| 参数 | 说明 | 类型 | 默认值 |
|--------|----------------------------------------------------|------------------------------------|--------|
| menus | 定义上下文菜单的动作数组 | IPublicTypeContextMenuAction[] | |
| children | 组件的子元素 | React.ReactElement[] | |

**IPublicTypeContextMenuAction Interface**

| 参数 | 说明 | 类型 | 默认值 |
|------------|--------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------|----------------------------------------|
| name | 动作的唯一标识符<br/>Unique identifier for the action | string | |
| title | 显示的标题,可以是字符串或国际化数据<br/>Display title, can be a string or internationalized data | string \| IPublicTypeI18nData (optional) | |
| type | 菜单项类型<br/>Menu item type | IPublicEnumContextMenuType (optional) | IPublicEnumContextMenuType.MENU_ITEM |
| action | 点击时执行的动作,可选<br/>Action to execute on click, optional | (nodes: IPublicModelNode[]) => void (optional) | |
| items | 子菜单项或生成子节点的函数,可选,仅支持两级<br/>Sub-menu items or function to generate child node, optional | Omit<IPublicTypeContextMenuAction, 'items'>[] \| ((nodes: IPublicModelNode[]) => Omit<IPublicTypeContextMenuAction, 'items'>[]) (optional) | |
| condition | 显示条件函数<br/>Function to determine display condition | (nodes: IPublicModelNode[]) => boolean (optional) | |
| disabled | 禁用条件函数,可选<br/>Function to determine disabled condition, optional | (nodes: IPublicModelNode[]) => boolean (optional) | |

**ContextMenu 示例**

```typescript
const App = () => {
const menuItems: IPublicTypeContextMenuAction[] = [
{
name: 'a',
title: '选项 1',
action: () => console.log('选项 1 被点击'),
},
{
name: 'b',
title: '选项 2',
action: () => console.log('选项 2 被点击'),
},
];

const ContextMenu = ctx.commonUI.ContextMenu;

return (
<div>
<ContextMenu menus={menuItems}>
<div>右键点击这里</div>
</ContextMenu>
</div>
);
};

export default App;
```

**ContextMenu.create 示例**

```typescript
const App = () => {
const menuItems: IPublicTypeContextMenuAction[] = [
{
name: 'a',
title: '选项 1',
action: () => console.log('选项 1 被点击'),
},
{
name: 'b',
title: '选项 2',
action: () => console.log('选项 2 被点击'),
},
];

const ContextMenu = ctx.commonUI.ContextMenu;

return (
<div>
<div onClick={(e) => {
ContextMenu.create(menuItems, e);
}}>点击这里</div>
</div>
);
};

export default App;
```

### Balloon

详细文档: [Balloon Documentation](https://fusion.design/pc/component/balloon)

### Breadcrumb
详细文档: [Breadcrumb Documentation](https://fusion.design/pc/component/breadcrumb)

### Button
详细文档: [Button Documentation](https://fusion.design/pc/component/button)

### Card
详细文档:[Card Documentation](https://fusion.design/pc/component/card)

### Checkbox
详细文档:[Checkbox Documentation](https://fusion.design/pc/component/checkbox)

### DatePicker
详细文档:[DatePicker Documentation](https://fusion.design/pc/component/datepicker)

### Dialog
详细文档:[Dialog Documentation](https://fusion.design/pc/component/dialog)

### Dropdown
详细文档:[Dropdown Documentation](https://fusion.design/pc/component/dropdown)

### Form
详细文档:[Form Documentation](https://fusion.design/pc/component/form)

### Icon
详细文档:[Icon Documentation](https://fusion.design/pc/component/icon)

引擎默认主题支持的 icon 列表:https://fusion.design/64063/component/icon?themeid=20133


### Input
详细文档:[Input Documentation](https://fusion.design/pc/component/input)

### Loading
详细文档:[Loading Documentation](https://fusion.design/pc/component/loading)

### Message
详细文档:[Message Documentation](https://fusion.design/pc/component/message)

### Overlay
详细文档:[Overlay Documentation](https://fusion.design/pc/component/overlay)

### Pagination
详细文档:[Pagination Documentation](https://fusion.design/pc/component/pagination)

### Radio
详细文档:[Radio Documentation](https://fusion.design/pc/component/radio)

### Search
详细文档:[Search Documentation](https://fusion.design/pc/component/search)

### Select
详细文档:[Select Documentation](https://fusion.design/pc/component/select)

### SplitButton
详细文档:[SplitButton Documentation](https://fusion.design/pc/component/splitbutton)

### Step
详细文档:[Step Documentation](https://fusion.design/pc/component/step)

### Switch
详细文档:[Switch Documentation](https://fusion.design/pc/component/switch)

### Tab
详细文档:[Tab Documentation](https://fusion.design/pc/component/tab)

### Table
详细文档:[Table Documentation](https://fusion.design/pc/component/table)

### Tree
详细文档:[Tree Documentation](https://fusion.design/pc/component/tree)

### TreeSelect
详细文档:[TreeSelect Documentation](https://fusion.design/pc/component/treeselect)

### Upload
详细文档:[Upload Documentation](https://fusion.design/pc/component/upload)

### Divider
详细文档:[Divider Documentation](https://fusion.design/pc/component/divider)

## 说明

如果需要其他组件,可以提 issue 给我们。
12 changes: 12 additions & 0 deletions docs/docs/api/configOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ config.set('enableCondition', false)

`@type {boolean}` `@default {false}`

#### enableContextMenu - 开启右键菜单

`@type {boolean}` `@default {false}`

是否开启右键菜单

#### disableDetecting

`@type {boolean}` `@default {false}`
Expand Down Expand Up @@ -218,6 +224,12 @@ config.set('enableCondition', false)

是否在只有一个 item 的时候隐藏设置 tabs

#### hideComponentAction

`@type {boolean}` `@default {false}`

隐藏设计器辅助层

#### thisRequiredInJSE

`@type {boolean}` `@default {true}`
Expand Down
83 changes: 83 additions & 0 deletions docs/docs/api/material.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,90 @@ material.modifyBuiltinComponentAction('remove', (action) => {
});
```

### 右键菜单项
#### addContextMenuOption

添加右键菜单项

```typescript
/**
* 添加右键菜单项
* @param action
*/
addContextMenuOption(action: IPublicTypeContextMenuAction): void;
```

示例

```typescript
import { IPublicEnumContextMenuType } from '@alilc/lowcode-types';

material.addContextMenuOption({
name: 'parentItem',
title: 'Parent Item',
condition: (nodes) => true,
items: [
{
name: 'childItem1',
title: 'Child Item 1',
action: (nodes) => console.log('Child Item 1 clicked', nodes),
condition: (nodes) => true
},
// 分割线
{
type: IPublicEnumContextMenuType.SEPARATOR
name: 'separator.1'
}
// 更多子菜单项...
]
});

```

#### removeContextMenuOption

删除特定右键菜单项

```typescript
/**
* 删除特定右键菜单项
* @param name
*/
removeContextMenuOption(name: string): void;
```

#### adjustContextMenuLayout

调整右键菜单项布局,每次调用都会覆盖之前注册的调整函数,只有最后注册的函数会被应用。

```typescript
/**
* 调整右键菜单项布局
* @param actions
*/
adjustContextMenuLayout(fn: (actions: IPublicTypeContextMenuItem[]) => IPublicTypeContextMenuItem[]): void;
```

**示例**

通过 adjustContextMenuLayout 补充分割线

```typescript
material.adjustContextMenuLayout((actions: IPublicTypeContextMenuAction) => {
const names = ['a', 'b'];
const newActions = [];
actions.forEach(d => {
newActions.push(d);
if (names.include(d.name)) {
newActions.push({ type: 'separator' })
}
});
return newActions
})
```

### 物料元数据

#### getComponentMeta
获取指定名称的物料元数据

Expand Down
2 changes: 0 additions & 2 deletions docs/docs/guide/appendix/npms.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ sidebar_position: 3
| @alilc/lowcode-engine | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/engine |
| @alilc/lowcode-plugin-designer | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/plugin-designer |
| @alilc/lowcode-plugin-outline-pane | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/plugin-outline-pane |
| @alilc/lowcode-rax-renderer | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/rax-renderer |
| @alilc/lowcode-rax-simulator-renderer | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/rax-simulator-renderer |
| @alilc/lowcode-react-renderer | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/react-renderer |
| @alilc/lowcode-react-simulator-renderer | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/react-simulator-renderer |
| @alilc/lowcode-renderer-core | [https://github.com/alibaba/lowcode-engine](https://github.com/alibaba/lowcode-engine) | packages/renderer-core |
Expand Down
Loading

0 comments on commit c14baad

Please sign in to comment.