Skip to content

Commit

Permalink
chore:表单项事件参数动态构建&事件补充&文档补充
Browse files Browse the repository at this point in the history
  • Loading branch information
hsm-lv committed Dec 28, 2023
1 parent 068c424 commit 667ee24
Show file tree
Hide file tree
Showing 51 changed files with 4,220 additions and 1,374 deletions.
42 changes: 42 additions & 0 deletions docs/zh-CN/components/form/button-group-select.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,48 @@ order: 6
| -------- | ------------------------- | ---------------- |
| change | `[name]: string` 组件的值 | 选中值变化时触发 |

### change

```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "button-group-select",
"label": "选项",
"name": "type",
"options": [
{
"label": "Option A",
"value": "a"
},
{
"label": "Option B",
"value": "b"
},
{
"label": "Option C",
"value": "c"
}
],
"onEvent": {
"change": {
"actions": [
{
"actionType": "toast",
"args": {
"msg": "${event.data.value|json}"
}
}
]
}
}
}
]
}
```

## 动作表

当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称``componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)
Expand Down
30 changes: 30 additions & 0 deletions docs/zh-CN/components/form/chain-select.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,36 @@ order: 7
| -------- | ------------------------- | ---------------- |
| change | `[name]: string` 组件的值 | 选中值变化时触发 |

### change

```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "select3",
"type": "chained-select",
"label": "链式下拉",
"source": "/api/mock2/options/chainedOptions?waitSeconds=1&parentId=$parentId&level=$level&maxLevel=4",
"value": "a,b",
"onEvent": {
"change": {
"actions": [
{
"actionType": "toast",
"args": {
"msg": "${event.data.value|json}"
}
}
]
}
}
}
]
}
```

## 动作表

当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称``componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)
Expand Down
29 changes: 29 additions & 0 deletions docs/zh-CN/components/form/checkbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,35 @@ order: 8
| -------- | -------------------------- | ------------------ |
| change | `[name]: boolean` 组件的值 | 选中状态变化时触发 |

### change

```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "checkbox",
"type": "checkbox",
"label": "勾选框",
"option": "选项说明",
"onEvent": {
"change": {
"actions": [
{
"actionType": "toast",
"args": {
"msg": "${event.data.value|json}"
}
}
]
}
}
}
]
}
```

## 动作表

当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称``componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)
Expand Down
204 changes: 201 additions & 3 deletions docs/zh-CN/components/form/checkboxes.md
Original file line number Diff line number Diff line change
Expand Up @@ -473,9 +473,207 @@ order: 9

> `[name]`表示当前组件绑定的名称,即`name`属性,如果没有配置`name`属性,则通过`value`取值。
| 事件名称 | 事件参数 | 说明 |
| -------- | ----------------------- | ---------------- |
| change | `[name]: string` 选中值 | 选中值变化时触发 |
| 事件名称 | 事件参数 | 说明 |
| -------------------------------- | ----------------------------------------------------------------------------------------- | ------------------ |
| change | `[name]: string` 选中值 | 选中值变化时触发 |
| addConfirm (3.6.4 及以上版本) | `[name]: string` 组件的值<br/>`item: object` 新增的节点信息<br/>`items: object[]`选项集合 | 新增节点提交时触发 |
| editConfirm (3.6.4 及以上版本) | `[name]: object` 组件的值<br/>`item: object` 编辑的节点信息<br/>`items: object[]`选项集合 | 编辑节点提交时触发 |
| deleteConfirm (3.6.4 及以上版本) | `[name]: string` 组件的值<br/>`item: object` 删除的节点信息<br/>`items: object[]`选项集合 | 删除节点提交时触发 |

### change

```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "checkboxes",
"type": "checkboxes",
"label": "复选框",
"options": [
{
"label": "OptionA",
"value": "a"
},
{
"label": "OptionB",
"value": "b"
},
{
"label": "OptionC",
"value": "c"
},
{
"label": "OptionD",
"value": "d"
}
],
"onEvent": {
"change": {
"actions": [
{
"actionType": "toast",
"args": {
"msg": "${event.data.value}"
}
}
]
}
}
}
]
}
```

### addConfirm

配置 `creatable`后,可监听确认新增操作。

```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "checkboxes",
"type": "checkboxes",
"label": "复选框",
"creatable": true,
"options": [
{
"label": "OptionA",
"value": "a"
},
{
"label": "OptionB",
"value": "b"
},
{
"label": "OptionC",
"value": "c"
},
{
"label": "OptionD",
"value": "d"
}
],
"onEvent": {
"addConfirm": {
"actions": [
{
"actionType": "toast",
"args": {
"msg": "${event.data.item|json}"
}
}
]
}
}
}
]
}
```

### editConfirm

配置 `editable`后,可监听确认编辑操作。

```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "checkboxes",
"type": "checkboxes",
"label": "复选框",
"editable": true,
"options": [
{
"label": "OptionA",
"value": "a"
},
{
"label": "OptionB",
"value": "b"
},
{
"label": "OptionC",
"value": "c"
},
{
"label": "OptionD",
"value": "d"
}
],
"onEvent": {
"editConfirm": {
"actions": [
{
"actionType": "toast",
"args": {
"msg": "${event.data.item|json}"
}
}
]
}
}
}
]
}
```

### deleteConfirm

配置 `removable`后,可监听确认删除操作。

```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "checkboxes",
"type": "checkboxes",
"label": "复选框",
"removable": true,
"labelField": "label2",
"valueField": "value2",
"options": [
{
"label2": "OptionA",
"value2": "a"
},
{
"label2": "OptionB",
"value2": "b"
},
{
"label2": "OptionC",
"value2": "c"
},
{
"label2": "OptionD",
"value2": "d"
}
],
"onEvent": {
"deleteConfirm": {
"actions": [
{
"actionType": "toast",
"args": {
"msg": "${event.data.item|json}"
}
}
]
}
}
}
]
}
```

## 动作表

Expand Down
Loading

0 comments on commit 667ee24

Please sign in to comment.