merge 280-6.3.0 into 280-6.4.0 (#10172)

* bump: 6.4.0-280.0

* fix: 修复弹窗中关闭动作中打开弹窗后续事件动作不执行的问题 (#10044)

* fix: 修复新建弹窗中弹窗列表出现重复的问题 (#10047)

* fix: 修复 form 的 flush 逻辑可能会出现一直等待自己的问题 (#10059)

* fix: 修复动作面板中弹窗信息显示不全的问题 (#10063)

* chore: 减小 Excel 默认单元格的 padding 大小

* fix: 修复弹窗中的弹窗编辑器中出现重复的问题 (#10073)

* fix: 更新 citydb closes #10046

* style(amis): 样式细节优化,避免异常溢出和换行展示 (#10072)

* style(amis): 样式细节优化,避免异常溢出和换行展示

* style(amis-editor): 属性配置面板样式补充,用于避免配置面板被超长的valueLabel撑开,导致样式异常

* fix: 修复弹窗中引用弹窗自己的编辑器逻辑问题 (#10078)

* 补充之前的辖区信息

* fix: 修复弹窗编辑问题 (#10083)

* fix(amis): 修复InputRange不能拖拽到负值的问题

* fix(amis): 修复InputRange精度失效问题

* Update Form.tsx

修改dispatchInited方法,主要解决:当跳转到包含Form的新页面,新页面还没加载完成时,快速后退导致的报错:Uncaught (in promise) Error: [mobx-state-tree] You are trying to read or write to an object that is no longer part of a state tree.

* fix: 修复弹窗编辑嵌套异常问题 (#10089)

* fix:发送请求动作的sendOn配置不生效

* fix:发送请求动作的sendOn配置不生效

* fix: 修复修复内嵌弹窗中内嵌弹窗失效的问题 (#10100)

* fix:刷新crud未执行切刷新service的问题

* fix: revert #9941 修复弹窗下有多个 form 时数据混乱问题

* fix: 修复弹窗修改无法删除属性的问题

* fix(amis): 修正range.test.tsx用例

* fix(editor): 修复校验规则修改后面板不更新问题 (#10113)

Co-authored-by: qinhaoyan <30946345+qinhaoyan@users.noreply.github.com>

* fix: 修复 crud 中 filter 开启 submitOnChnage 后无法分页问题 (#10115)

* fix(editor): 修复校验规则修改后面板不更新问题 (#10113)

Co-authored-by: qinhaoyan <30946345+qinhaoyan@users.noreply.github.com>

* fix: 修复 inputArray 在编辑器中渲染错误的问题 (#10104)

* fix: 修复右击菜单后报错 (#10121)

* fix: 修复选项卡新增选项组件前后无插入支持

* fix: 修复crud2编辑器内设置多列右侧固定显示问题

* fix: 修复crud2组件特性动作

* fix: 修复crud2按钮列表管理编辑bug

* fix: 修复each组件items数组时编辑报错

* refactor: table2刷新页面改成crud2下发

* fix: 修复选项卡新增选项组件前后无插入支持

* fix: 修复crud2编辑器内设置多列右侧固定显示问题

* fix: 修复crud2组件特性动作

* fix: 修复crud2按钮列表管理编辑bug

* fix: 修复each组件items数组时编辑报错

* refactor: table2刷新页面改成crud2下发

* fix:inputTable删除行动作没有触发change事件

* fix:表单项reset支持重置为初始值

* fix(amis): 修正range.test.tsx用例

* chore: 升级amis-publish版本,支持分支版本

* chore: 升级amis-publish版本,支持分支版本 (#10150)

Co-authored-by: qinhaoyan <30946345+qinhaoyan@users.noreply.github.com>

* breaking: 打印功能使用 id 而不是 testid Closes #10123 (#10126)

* breaking: 打印功能使用 id 而不是 testid Closes #10123

* 修复文档错误

* 更新 snapshot

* fix: 修复 inputTable 在分页情况切换数据表单项不更新的问题 (#10157)

* bump: 6.4.0

* fix(amis): 修正range.test.tsx用例

* fix(amis): 注释掉range.test.tsx中的滑动change case

* fix(amis): 更新range.test.tsx.snap

---------

Co-authored-by: 2betop <2betop.cn@gmail.com>
Co-authored-by: wuduoyi <wuduoyi@baidu.com>
Co-authored-by: 刘丹 <365533093@qq.com>
Co-authored-by: sidrong <529672493@qq.com>
Co-authored-by: lvxiaojiao <lvxiaojiao@baidu.com>
Co-authored-by: qkiroc <30946345+qkiroc@users.noreply.github.com>
Co-authored-by: qinhaoyan <30946345+qinhaoyan@users.noreply.github.com>
Co-authored-by: liaoxuezhi <2698393+2betop@users.noreply.github.com>
Co-authored-by: F-jianchao <161407305+F-jianchao@users.noreply.github.com>
Co-authored-by: zhangtao07 <zhang.tao.1006@163.com>
Co-authored-by: hsm-lv <80095014+hsm-lv@users.noreply.github.com>
This commit is contained in:
lmaomaoz 2024-05-08 10:31:52 +08:00 committed by GitHub
parent ef8c5f3cfb
commit e22452d1ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
139 changed files with 6012 additions and 1268 deletions

View File

@ -232,7 +232,7 @@ order: 36
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------ | ------------------------------------------------------ |
| -------- | ------------------------ | ------------------------------------------------ |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string` 更新的值 | 更新数据 |

View File

@ -264,6 +264,188 @@ order: 6
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------ | ------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| reload | - | 重新加载,调用 `source`,刷新数据域数据刷新(重新加载) |
| setValue | `value: string` 更新的值 | 更新数据 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "button-group-select",
"label": "选项",
"name": "type",
"id": "clear_type",
"options": [
{
"label": "Option A",
"value": "a"
},
{
"label": "Option B",
"value": "b"
},
{
"label": "Option C",
"value": "c"
}
],
"value": "b"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_type"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"data": {
"abc": {
"type": "c"
}
},
"body": [
{
"type": "button-group-select",
"label": "选项",
"name": "type",
"id": "reset_type",
"options": [
{
"label": "Option A",
"value": "a"
},
{
"label": "Option B",
"value": "b"
},
{
"label": "Option C",
"value": "c"
}
],
"value": "b"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_type"
}
]
}
}
}
]
}
```
### reload
只有选择器模式支持,即配置`source`,用于重新加载选择器的数据源。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "button-group-select",
"label": "选项",
"name": "type",
"id": "reload_type",
"source": "/api/mock2/form/getOptions?waitSeconds=1"
},
{
"type": "button",
"label": "重新加载",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reload",
"componentId": "reload_type"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "button-group-select",
"label": "选项",
"name": "type",
"id": "setvalue_type",
"options": [
{
"label": "Option A",
"value": "a"
},
{
"label": "Option B",
"value": "b"
},
{
"label": "Option C",
"value": "c"
}
],
"value": "b"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_type",
"args": {
"value": "c"
}
}
]
}
}
}
]
}
```

View File

@ -102,6 +102,145 @@ order: 7
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------ | ------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| reload | - | 重新加载,调用 `source`,刷新数据域数据刷新(重新加载) |
| setValue | `value: string` 更新的值 | 更新数据,多个值用`,`分隔 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "type",
"id": "clear_type",
"type": "chained-select",
"label": "链式下拉",
"source": "/api/mock2/options/chainedOptions?waitSeconds=1&parentId=$parentId&level=$level&maxLevel=4",
"value": "a,b"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_type"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "type",
"id": "reset_type",
"type": "chained-select",
"label": "链式下拉",
"source": "/api/mock2/options/chainedOptions?waitSeconds=1&parentId=$parentId&level=$level&maxLevel=4",
"value": "a,b"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_type"
}
]
}
}
}
]
}
```
### reload
只有选择器模式支持,即配置`source`,用于重新加载选择器的数据源。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "type",
"id": "reload_type",
"type": "chained-select",
"label": "链式下拉",
"source": "/api/mock2/options/chainedOptions?waitSeconds=1&parentId=$parentId&level=$level&maxLevel=4",
"value": "a,b"
},
{
"type": "button",
"label": "重新加载",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reload",
"componentId": "reload_type"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "type",
"id": "setvalue_type",
"type": "chained-select",
"label": "链式下拉",
"source": "/api/mock2/options/chainedOptions?waitSeconds=1&parentId=$parentId&level=$level&maxLevel=4",
"value": "a,b"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_type",
"args": {
"value": "c"
}
}
]
}
}
}
]
}
```

View File

@ -144,7 +144,111 @@ order: 8
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------------------------- | ------------------------------------------------------ |
| -------- | ------------------------------------------- | ------------------------------------------------ |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string \|number \|boolean` 更新的值 | 更新数据 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "checkbox",
"label": "选项",
"name": "type",
"id": "clear_type",
"option": "选项说明",
"value": true
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_type"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "checkbox",
"label": "选项",
"name": "type",
"id": "reset_type",
"option": "选项说明",
"value": true
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_type"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "checkbox",
"label": "选项",
"name": "type",
"id": "setvalue_type",
"option": "选项说明",
"value": true
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_type",
"args": {
"value": false
}
}
]
}
}
}
]
}
```

View File

@ -682,6 +682,183 @@ order: 9
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------ | ------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| reload | - | 重新加载,调用 `source`,刷新数据域数据刷新(重新加载) |
| setValue | `value: string` 更新的值 | 更新数据,多个值用`,`分隔 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "checkboxes",
"label": "选项",
"name": "type",
"id": "clear_type",
"options": [
{
"label": "Option A",
"value": "a"
},
{
"label": "Option B",
"value": "b"
},
{
"label": "Option C",
"value": "c"
}
],
"value": "b"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_type"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "checkboxes",
"label": "选项",
"name": "type",
"id": "reset_type",
"options": [
{
"label": "Option A",
"value": "a"
},
{
"label": "Option B",
"value": "b"
},
{
"label": "Option C",
"value": "c"
}
],
"value": "b"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_type"
}
]
}
}
}
]
}
```
### reload
只有选择器模式支持,即配置`source`,用于重新加载选择器的数据源。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "checkboxes",
"label": "选项",
"name": "type",
"id": "reload_type",
"source": "/api/mock2/form/getOptions?waitSeconds=1"
},
{
"type": "button",
"label": "重新加载",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reload",
"componentId": "reload_type"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "checkboxes",
"label": "选项",
"name": "type",
"id": "setvalue_type",
"options": [
{
"label": "Option A",
"value": "a"
},
{
"label": "Option B",
"value": "b"
},
{
"label": "Option C",
"value": "c"
}
],
"value": "b"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_type",
"args": {
"value": "c"
}
}
]
}
}
}
]
}
```

View File

@ -1134,9 +1134,113 @@ combo 还有一个作用是增加层级,比如返回的数据是一个深层
| -------- | --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| addItem | `item: object` 新增项的值 | 只有开启`multiple`模式才能使用, `multiple`模式下,给新增项添加默认值 |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: object \| Array<object>` 更新的值<br/>`index?: number` 指定更新的数据索引, 1.10.1 及以上版本引入 | 更新数据,对象数组针对开启`multiple`模式, `multiple`模式下可以通过指定`index`来更新指定索引的数据 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "combo",
"name": "type",
"id": "clear_type",
"label": "用户",
"items": [
{
"name": "text",
"label": "名字",
"type": "input-text"
},
{
"name": "gender",
"label": "性别",
"type": "select",
"options": [
"男",
"女"
]
}
],
"value": {
"text": "amis",
"gender": "男"
}
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_type"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "combo",
"name": "type",
"id": "reset_type",
"label": "用户",
"items": [
{
"name": "text",
"label": "名字",
"type": "input-text"
},
{
"name": "gender",
"label": "性别",
"type": "select",
"options": [
"男",
"女"
]
}
],
"value": {
"text": "amis",
"gender": "男"
}
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_type"
}
]
}
}
}
]
}
```
### setValue
#### 复制数值
@ -1145,12 +1249,12 @@ combo 还有一个作用是增加层级,比如返回的数据是一个深层
此示例主要用来演示如何通过已有数据快速填充 combo 某条数据。点击 copy 按钮会弹出一个 crud 列表,点击对应行上的复制按钮,将选中数据填充到外层的 combo.
注意事项:
1. 需要给 combo 设置个 id 属性,用来给事件动作指定目标用。
2. 弹窗按钮配置了数据映射 `{comboIndex: "${index}"}` 因为 crud 的行数据上也有 index 变量,派送动作时获取 index 变量是 crud 所在行的序号。所以弹出弹窗的时候,先把 combo 的序号赋值给 comboIndex
3. crud 操作栏里面添加了个按钮close: true 设置是让动作完成后关闭弹窗。
4. 按钮里面添加了 onEvent 配置click 时做 `setValue` 动作,并设置参数 index 为 '${comboIndex}' 值为 `${&}`。其中 `${&}` 是特殊语法,用来取整个上下数据。
> 注意事项:
>
> 1. 需要给 combo 设置个 id 属性,用来给事件动作指定目标用。
> 2. 弹窗按钮配置了数据映射 `{comboIndex: "${index}"}` 因为 crud 的行数据上也有 index 变量,派送动作时获取 index 变量是 crud 所在行的序号。所以弹出弹窗的时候,先把 combo 的序号赋值给 comboIndex
> 3. crud 操作栏里面添加了个按钮close: true 设置是让动作完成后关闭弹窗。
> 4. 按钮里面添加了 onEvent 配置click 时做 `setValue` 动作,并设置参数 index 为 '${comboIndex}' 值为 `${&}`。其中 `${&}` 是特殊语法,用来取整个上下数据。
```schema: scope="body"
{

View File

@ -101,8 +101,145 @@ order: 17
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ---------------------------------------- | ------------------------------------------------------ |
| -------- | ---------------------------------------- | ------------------------------------------------ |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| focus | - | 获取焦点,焦点落在右侧编辑面板 |
| setValue | `value: string` 更新的右侧编辑面板中的值 | 更新数据 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "diff-editor",
"name": "diff",
"id": "clear_text",
"label": "Diff-Editor",
"diffValue": "hello world",
"value": "hello"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"id": "reset_text",
"type": "diff-editor",
"name": "diff",
"label": "Diff-Editor",
"diffValue": "hello world",
"value": "hello"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### focus
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"id": "focus_text",
"type": "diff-editor",
"name": "diff",
"label": "Diff-Editor",
"diffValue": "hello world",
"value": "hello"
},
{
"type": "button",
"label": "聚焦",
"onEvent": {
"click": {
"actions": [
{
"actionType": "focus",
"componentId": "focus_text"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"id": "setvalue_text",
"type": "diff-editor",
"name": "diff",
"label": "Diff-Editor",
"diffValue": "hello world",
"value": "hello"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": "amis go go go!"
}
}
]
}
}
}
]
}
```

View File

@ -182,8 +182,141 @@ amis 的编辑器是基于 monaco 开发的,如果想进行深度定制,比
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------ | ------------------------------------------------------ |
| -------- | ------------------------ | ------------------------------------------------ |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| focus | - | 获取焦点 |
| setValue | `value: string` 更新的值 | 更新数据 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "editor",
"name": "editor",
"label": "编辑器",
"id": "clear_text",
"value": "hello"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "editor",
"id": "reset_text",
"name": "editor",
"label": "编辑器",
"value": "hello"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### focus
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "editor",
"id": "focus_text",
"name": "editor",
"label": "编辑器",
"value": "hello"
},
{
"type": "button",
"label": "聚焦",
"onEvent": {
"click": {
"actions": [
{
"actionType": "focus",
"componentId": "focus_text"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "editor",
"id": "setvalue_text",
"name": "editor",
"label": "编辑器",
"value": "hello"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": "amis go go go!"
}
}
]
}
}
}
]
}
```

View File

@ -146,7 +146,108 @@ order: 10
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ---------------------------------- | ------------------------------------------------------ |
| -------- | ---------------------------------- | ------------------------------------------------ |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string \| number` 更新的值 | 更新数据 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "city",
"type": "input-city",
"label": "城市",
"id": "clear_text",
"value": "110000"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "city",
"type": "input-city",
"label": "城市",
"id": "reset_text",
"value": "110000"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "city",
"type": "input-city",
"label": "城市",
"id": "setvalue_text",
"value": "110000"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": "110100"
}
}
]
}
}
}
]
}
```

View File

@ -372,5 +372,106 @@ function transform(value, config, props, data) {
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------------------------- | ----------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string` 更新的时间区间值,用`,`隔开 | 更新数据,,依赖格式`format`,例如:'1650556800,1652889599' |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-date-range",
"name": "date",
"label": "日期",
"id": "clear_text",
"value": "1714060800,1714319999"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-date-range",
"name": "date",
"label": "日期",
"id": "reset_text",
"value": "1714060800,1714319999"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-date-range",
"name": "date",
"label": "日期",
"id": "setvalue_text",
"value": "1714060800,1714319999"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": "1714060800,1714492799"
}
}
]
}
}
}
]
}
```

View File

@ -445,7 +445,108 @@ order: 13
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ---------------------------- | ------------------------------------------------------ |
| -------- | ---------------------------- | ------------------------------------------------ |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string` 更新的时间值 | 更新数据,依赖格式`format`,例如:'1650556800' |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-date",
"name": "date",
"label": "日期",
"id": "clear_text",
"value": "1714060800"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-date",
"name": "date",
"label": "日期",
"id": "reset_text",
"value": "1714060800"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-date",
"name": "date",
"label": "日期",
"id": "setvalue_text",
"value": "1714060800"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": "1714233600"
}
}
]
}
}
}
]
}
```

View File

@ -159,5 +159,5 @@ order: 16
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------------------------- | -------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string` 更新的时间区间值,用`,`隔开 | 更新数据,依赖格式`format`,例如 '1650556800,1652889599' |

View File

@ -445,7 +445,7 @@ order: 14
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ---------------------------- | ------------------------------------------------------ |
| -------- | ---------------------------- | ------------------------------------------------ |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string` 更新的时间值 | 更新数据,依赖格式`format`,例如:'1650556800' |

View File

@ -275,11 +275,10 @@ interface InputExcelData {
}
```
## 属性表
| 属性名 | 类型 | 默认值 | 说明 | 版本 |
| ------------ | ----------------------- | ------------------------------- | ------------------ | ------- |
| ------------ | ------------------------ | ------------------------------- | ------------------ | ------- |
| allSheets | `boolean` | false | 是否解析所有 sheet |
| parseMode | `'array'``'object'` | 'object' | 解析模式 |
| includeEmpty | `boolean` | true | 是否包含空值 |
@ -302,7 +301,116 @@ interface InputExcelData {
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ---------------------------------------------- | ------------------------------------------------------ |
| -------- | ---------------------------------------------- | ------------------------------------------------ |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: Array<object>` 更新的 excel 解析后数据 | 更新数据 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-excel",
"name": "excel",
"label": "上传 Excel",
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-excel",
"name": "excel",
"label": "上传 Excel",
"id": "reset_text",
"value": [
{
"ID": "1",
"NAME": "amis"
}
]
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-excel",
"name": "excel",
"label": "上传 Excel",
"id": "setvalue_text"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": [
{
"ID": "1",
"NAME": "amis"
}
]
}
}
]
}
}
}
]
}
```

View File

@ -185,7 +185,7 @@ order: 21
## 作为表单项上传
如果不希望 InputFile 组件在提交Form之前上传可以配置 `asBlob` 或者 `asBase64`,采用这种方式后,组件不再自己上传了,而是直接把文件数据作为表单项的值,文件内容会在 Form 表单提交的接口里面一起带上。
如果不希望 InputFile 组件在提交 Form 之前上传,可以配置 `asBlob` 或者 `asBase64`,采用这种方式后,组件不再自己上传了,而是直接把文件数据作为表单项的值,文件内容会在 Form 表单提交的接口里面一起带上。
```schema: scope="body"
{
@ -435,7 +435,6 @@ order: 21
}
```
## 属性表
除了支持 [普通表单项属性表](./formitem#%E5%B1%9E%E6%80%A7%E8%A1%A8) 中的配置以外,还支持下面一些配置
@ -502,3 +501,36 @@ order: 21
| 动作名称 | 动作配置 | 说明 |
| -------- | -------- | ---- |
| clear | - | 清空 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-file",
"name": "file",
"label": "File",
"accept": "*",
"receiver": "/api/upload/file",
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```

View File

@ -733,3 +733,35 @@ app.listen(8080, function () {});
| 动作名称 | 动作配置 | 说明 |
| -------- | -------- | ---- |
| clear | - | 清空 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-image",
"name": "image",
"label": "Image",
"receiver": "/api/upload/file",
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```

View File

@ -223,7 +223,7 @@ key 只能是字符串,因此输入格式是 `input-text`,但 value 格式
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------ | ------------------------------------------------------ |
| -------- | ------------------------ | ------------------------------------------------ |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: object` 更新的值 | 更新数据 |

View File

@ -102,5 +102,5 @@ order: 15
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------------------------- | -------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string` 更新的时间区间值,用`,`隔开 | 更新数据,依赖格式`format`,例如 '1646064000,1651334399' |

View File

@ -172,7 +172,7 @@ order: 81
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ---------------------------- | ------------------------------------------------------ |
| -------- | ---------------------------- | --------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string` 更新的时间值 | 更新数据,依赖格式`valueFormat`,例如:'1646064000' |

View File

@ -314,3 +314,104 @@ order: 32
| clear | - | 清空 |
| reset | - | 将值重置为 `resetValue`,若没有配置 `resetValue`,则清空 |
| setValue | `value: number` 更新的数值 | 更新数据 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-number",
"name": "number",
"label": "数字",
"id": "clear_text",
"value": 1
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-number",
"name": "number",
"label": "数字",
"id": "reset_text",
"value": 1
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-number",
"name": "number",
"label": "数字",
"id": "setvalue_text",
"value": 1
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": 2
}
}
]
}
}
}
]
}
```

View File

@ -101,5 +101,5 @@ order: 15
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------------------------- | -------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string` 更新的时间区间值,用`,`隔开 | 更新数据,依赖格式`format`,例如 '1640966400,1664553600' |

View File

@ -43,7 +43,7 @@ order: 62
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ---------------------------- | ------------------------------------------------------ |
| -------- | ---------------------------- | ------------------------------------------------ |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string` 更新的时间值 | 更新数据,依赖格式`format`,例如:'1640966400' |

View File

@ -232,7 +232,7 @@ order: 38
## 显示单位
在打开`showInput`输入框且设置了`unit`单位的前提下,开启`showInputUnit`可在input框中显示已配置的单位。
在打开`showInput`输入框且设置了`unit`单位的前提下,开启`showInputUnit`可在 input 框中显示已配置的单位。
```schema: scope="body"
{
@ -320,7 +320,7 @@ order: 38
| unit | `string` | | 单位 |
| clearable | `boolean` | `false` | 是否可清除<br/>前置条件:开启`showInput`时有效 |
| showInput | `boolean` | `false` | 是否显示输入框 |
| showInputUnit | `boolean` | `false` | 是否显示输入框单位<br/>前置条件:开启`showInput`且配置了`unit`单位时有效 |`6.0.0`后支持变量
| showInputUnit | `boolean` | `false` | 是否显示输入框单位<br/>前置条件:开启`showInput`且配置了`unit`单位时有效 | `6.0.0`后支持变量 |
| onChange | `function` | | 当 组件 的值发生改变时,会触发 onChange 事件,并把改变后的值作为参数传入 |
| onAfterChange | `function` | | 与 `onmouseup` 触发时机一致,把当前值作为参数传入 |
@ -434,7 +434,108 @@ order: 38
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ---------------------------------------------------------------- | ---------------------------------------------------------- |
| clear | - | 清除输入框<br />前置条件showInput 和 clearable 都为 true |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| -------- | ---------------------------------------------------------------- | ------------------------------------------------ |
| clear | - | 清除输入框 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: number \| string \| {min: number, max: number}` 更新的值 | 更新数据 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-range",
"label": "滑块",
"name": "range",
"value": 20,
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-range",
"label": "滑块",
"name": "range",
"value": 20,
"id": "reset_text"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-range",
"label": "滑块",
"name": "range",
"value": 20,
"id": "setvalue_text"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": 30
}
}
]
}
}
}
]
}
```

View File

@ -175,7 +175,114 @@ order: 37
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------ | ------------------------------------------------------ |
| -------- | ------------------------ | ------------------------------------------------ |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: number` 更新的值 | 更新数据 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-rating",
"name": "rating",
"label": "评分",
"count": 5,
"value": 3.5,
"half": true,
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-rating",
"name": "rating",
"label": "评分",
"count": 5,
"value": 3.5,
"half": true,
"id": "reset_text"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-rating",
"name": "rating",
"label": "评分",
"count": 5,
"value": 3.5,
"half": true,
"id": "setvalue_text"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": 4
}
}
]
}
}
}
]
}
```

View File

@ -2549,7 +2549,7 @@ order: 54
"label": "表格表单",
"id": "reset-input-table",
"name": "table",
"resetValue": [
"value": [
{
"a": "a-resetValue1",
"b": "b-resetValue1"

View File

@ -256,6 +256,164 @@ order: 55
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------ | ------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| reload | - | 重新加载,调用 `source`,刷新数据域数据刷新(重新加载) |
| setValue | `value: string` 更新的值 | 更新数据,多个值用`,`分隔 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-tag",
"name": "tag",
"label": "标签",
"placeholder": "请选择标签",
"options": [
"Aaron Rodgers",
"Tom Brady",
"Charlse Woodson",
"Aaron Jones"
],
"value": "Charlse Woodson",
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-tag",
"name": "tag",
"label": "标签",
"placeholder": "请选择标签",
"options": [
"Aaron Rodgers",
"Tom Brady",
"Charlse Woodson",
"Aaron Jones"
],
"value": "Charlse Woodson",
"id": "reset_text"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### reload
只有选择器模式支持,即配置`source`,用于重新加载选择器的数据源。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-tag",
"name": "tag",
"label": "标签",
"placeholder": "请选择标签",
"id": "reload_type",
"source": "/api/mock2/form/getOptions?waitSeconds=1",
"value": "a"
},
{
"type": "button",
"label": "重新加载",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reload",
"componentId": "reload_type"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-tag",
"name": "tag",
"label": "标签",
"placeholder": "请选择标签",
"options": [
"Aaron Rodgers",
"Tom Brady",
"Charlse Woodson",
"Aaron Jones"
],
"value": "Charlse Woodson",
"id": "setvalue_text"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": "Tom Brady"
}
}
]
}
}
}
]
}
```

View File

@ -626,3 +626,173 @@ order: 56
| focus | - | 获取焦点 |
| reload | - | 刷新(重新加载),只针对配置了`source`的输入框有效 |
| setValue | `value: string` 更新的值 | 更新数据,开启`multiple`多选时用`,`分隔 |
### clear
如果配置了`clearValueOnEmpty: true`,则清空时将置为`undefined`,否则置为空字符串。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "text",
"id": "clear_text",
"type": "input-text",
"label": "text",
"value": "清空我"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "text",
"id": "reset_text",
"type": "input-text",
"label": "text",
"value": "重置我"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### focus
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "text",
"id": "focus_text",
"type": "input-text",
"label": "text",
"value": "聚焦我"
},
{
"type": "button",
"label": "聚焦",
"onEvent": {
"click": {
"actions": [
{
"actionType": "focus",
"componentId": "focus_text"
}
]
}
}
}
]
}
```
### reload
只有选择器模式支持,即配置`source`,用于重新加载选择器的数据源。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "text",
"id": "reload_text",
"type": "input-text",
"label": "text",
"value": "a",
"source": "/api/mock2/form/getOptions?waitSeconds=1"
},
{
"type": "button",
"label": "重新加载",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reload",
"componentId": "reload_text"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "text",
"id": "setvalue_text",
"type": "input-text",
"label": "text",
"value": "amis"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": "amis go go go!"
}
}
]
}
}
}
]
}
```

View File

@ -118,5 +118,5 @@ order: 15
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------------------------- | -------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string` 更新的时间区间值,用`,`隔开 | 更新数据,依赖格式`format`,例如 '1617206400,1743436800' |

View File

@ -277,7 +277,7 @@ order: 58
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ---------------------------- | ------------------------------------------------------ |
| -------- | ---------------------------- | ------------------------------------------------ |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string` 更新的时间值 | 更新数据,依赖格式`format`,例如:'1648746120' |

View File

@ -1453,5 +1453,139 @@ true false false [{label: 'A/B/C', value: 'a/b/c'},{label: 'A
| delete | value: ` any` | 删除数据项的 value如果配置了 valueField以 valueField 的字段值为准) |
| reload | - | 刷新 |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string` \| `string[]` 更新的值 | 更新数据,开启`multiple`支持设置多项,开启`joinValues`时,多值用`,`分隔,否则多值用数组 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-tree",
"name": "tree",
"label": "Tree",
"options": [
{
"label": "Folder A",
"value": 1,
"children": [
{
"label": "file A",
"value": 2
},
{
"label": "Folder B",
"value": 3,
"children": [
{
"label": "file b1",
"value": 3.1
},
{
"label": "file b2",
"value": 3.2
}
]
}
]
},
{
"label": "file C",
"value": 4
},
{
"label": "file D",
"value": 5
}
],
"value": 5,
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "input-tree",
"name": "tree",
"label": "Tree",
"options": [
{
"label": "Folder A",
"value": 1,
"children": [
{
"label": "file A",
"value": 2
},
{
"label": "Folder B",
"value": 3,
"children": [
{
"label": "file b1",
"value": 3.1
},
{
"label": "file b2",
"value": 3.2
}
]
}
]
},
{
"label": "file C",
"value": 4
},
{
"label": "file D",
"value": 5
}
],
"value": 5,
"id": "reset_text"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```

View File

@ -101,5 +101,5 @@ order: 15
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------------------------- | -------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string` 更新的时间区间值,用`,`隔开 | 更新数据,依赖格式`format`,例如 '1648746120,1648760760' |

View File

@ -43,7 +43,7 @@ order: 61
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ---------------------------- | ------------------------------------------------------ |
| -------- | ---------------------------- | ------------------------------------------------ |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string` 更新的时间值 | 更新数据,依赖格式`format`,例如:'1617206400' |

View File

@ -147,6 +147,176 @@ ListSelect 一般用来实现选择,可以单选也可以多选,和 Radio/Ch
| 动作名称 | 动作配置 | 说明 |
| -------- | -------------------------------------- | --------------------------------------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| reload | - | 重新加载,调用 `source`,刷新数据域数据刷新(重新加载) |
| setValue | `value: string` \| `string[]` 更新的值 | 更新数据,开启`multiple`支持设置多项,开启`joinValues`时,多值用`,`分隔,否则多值用数组 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "list-select",
"name": "select",
"label": "单选",
"clearable": true,
"options": [
{
"label": "Option A",
"value": "a"
},
{
"label": "Option B",
"value": "b"
}
],
"value": "a",
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "list-select",
"name": "select",
"label": "单选",
"clearable": true,
"options": [
{
"label": "Option A",
"value": "a"
},
{
"label": "Option B",
"value": "b"
}
],
"value": "a",
"id": "reset_text"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### reload
只有选择器模式支持,即配置`source`,用于重新加载选择器的数据源。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "list-select",
"name": "select",
"label": "单选",
"clearable": true,
"id": "reload_type",
"source": "/api/mock2/form/getOptions?waitSeconds=1",
"value": "a"
},
{
"type": "button",
"label": "重新加载",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reload",
"componentId": "reload_type"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "list-select",
"name": "select",
"label": "单选",
"clearable": true,
"options": [
{
"label": "Option A",
"value": "a"
},
{
"label": "Option B",
"value": "b"
}
],
"value": "a",
"id": "setvalue_text"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": "b"
}
}
]
}
}
}
]
}
```

View File

@ -124,7 +124,128 @@ order: 30
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | -------- | ------------------------------------------------------ |
| -------- | -------- | ------------------------------------------------ |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value` | 参考 [`LocationData`](#LocationData) |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "location-picker",
"name": "location",
"ak": "LiZT5dVbGTsPI91tFGcOlSpe5FDehpf7",
"label": "地址",
"value": {
"address":"北京市西城区府右街131号",
"lat":39.916383659908185,
"lng":116.38854914523102,
"city":"北京市",
"vendor":"baidu"
},
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "location-picker",
"name": "location",
"ak": "LiZT5dVbGTsPI91tFGcOlSpe5FDehpf7",
"label": "地址",
"value": {
"address":"北京市西城区府右街131号",
"lat":39.916383659908185,
"lng":116.38854914523102,
"city":"北京市",
"vendor":"baidu"
},
"id": "reset_text"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "location-picker",
"name": "location",
"ak": "LiZT5dVbGTsPI91tFGcOlSpe5FDehpf7",
"label": "地址",
"id": "setvalue_text"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": {
"address":"北京市西城区府右街131号",
"lat":39.916383659908185,
"lng":116.38854914523102,
"city":"北京市",
"vendor":"baidu"
}
}
}
]
}
}
}
]
}
```

View File

@ -383,6 +383,257 @@ row 模式,每行只能单选某个单元格
| 动作名称 | 动作配置 | 说明 |
| -------- | ----------------------- | ------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| reload | - | 重新加载,调用 `source`,刷新数据域数据刷新(重新加载) |
| setValue | `value: Array` 更新的值 | 更新数据 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "matrix-checkboxes",
"name": "matrix",
"label": "Matrix",
"rowLabel": "行标题说明",
"columns": [
{
"label": "列1"
},
{
"label": "列2"
}
],
"rows": [
{
"label": "行1"
},
{
"label": "行2"
}
],
"value": [
[
{
"label": "列1",
"checked": true
},
{
"label": "列1",
"checked": false
}
],
[
{
"label": "列2",
"checked": false
},
{
"label": "列2",
"checked": true
}
]
],
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "matrix-checkboxes",
"name": "matrix",
"label": "Matrix",
"rowLabel": "行标题说明",
"columns": [
{
"label": "列1"
},
{
"label": "列2"
}
],
"rows": [
{
"label": "行1"
},
{
"label": "行2"
}
],
"value": [
[
{
"label": "列1",
"checked": true
},
{
"label": "列1",
"checked": false
}
],
[
{
"label": "列2",
"checked": false
},
{
"label": "列2",
"checked": true
}
]
],
"id": "reset_text"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### reload
只有选择器模式支持,即配置`source`,用于重新加载选择器的数据源。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "list-select",
"name": "select",
"label": "单选",
"clearable": true,
"id": "reload_type",
"source": "/api/mock2/form/getOptions?waitSeconds=1",
"value": "a"
},
{
"type": "button",
"label": "重新加载",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reload",
"componentId": "reload_type"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "matrix-checkboxes",
"name": "matrix",
"label": "Matrix",
"rowLabel": "行标题说明",
"columns": [
{
"label": "列1"
},
{
"label": "列2"
}
],
"rows": [
{
"label": "行1"
},
{
"label": "行2"
}
],
"value": "a",
"id": "setvalue_text"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": [
[
{
"label": "列1",
"checked": true
},
{
"label": "列1",
"checked": true
}
],
[
{
"label": "列2",
"checked": false
},
{
"label": "列2",
"checked": true
}
]
]
}
}
]
}
}
}
]
}
```

View File

@ -844,6 +844,226 @@ order: 31
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------ | ------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| reload | - | 重新加载,调用 `source`,刷新数据域数据刷新(重新加载) |
| setValue | `value: string` 更新的值 | 更新数据,开启`multiple`时,多个值用`,`分隔 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "nested-select",
"name": "nestedSelect",
"label": "级联选择器",
"options": [
{
"label": "A",
"value": "a"
},
{
"label": "B",
"value": "b",
"children": [
{
"label": "B-1",
"value": "b-1"
},
{
"label": "B-2",
"value": "b-2"
},
{
"label": "B-3",
"value": "b-3"
}
]
},
{
"label": "C",
"value": "c"
}
],
"value": "a",
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "nested-select",
"name": "nestedSelect",
"label": "级联选择器",
"options": [
{
"label": "A",
"value": "a"
},
{
"label": "B",
"value": "b",
"children": [
{
"label": "B-1",
"value": "b-1"
},
{
"label": "B-2",
"value": "b-2"
},
{
"label": "B-3",
"value": "b-3"
}
]
},
{
"label": "C",
"value": "c"
}
],
"value": "a",
"id": "reset_text"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### reload
只有选择器模式支持,即配置`source`,用于重新加载选择器的数据源。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "nested-select",
"name": "nestedSelect",
"label": "级联选择器",
"id": "reload_type",
"source": "/api/mock2/form/getTreeOptions",
"value": "a"
},
{
"type": "button",
"label": "重新加载",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reload",
"componentId": "reload_type"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "nested-select",
"name": "nestedSelect",
"label": "级联选择器",
"options": [
{
"label": "A",
"value": "a"
},
{
"label": "B",
"value": "b",
"children": [
{
"label": "B-1",
"value": "b-1"
},
{
"label": "B-2",
"value": "b-2"
},
{
"label": "B-3",
"value": "b-3"
}
]
},
{
"label": "C",
"value": "c"
}
],
"value": "a",
"id": "setvalue_text"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": "b"
}
}
]
}
}
}
]
}
```

View File

@ -211,7 +211,111 @@ order: 8
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------------------------- | ------------------------------------------------------ |
| -------- | ------------------------------------------- | ------------------------------------------------ |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string \|number \|boolean` 更新的值 | 更新数据 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "radio",
"label": "选项",
"name": "type",
"id": "clear_type",
"option": "选项说明",
"value": true
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_type"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "radio",
"label": "选项",
"name": "type",
"id": "reset_type",
"option": "选项说明",
"value": false
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_type"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "radio",
"label": "选项",
"name": "type",
"id": "setvalue_type",
"option": "选项说明",
"value": true
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_type",
"args": {
"value": false
}
}
]
}
}
}
]
}
```

View File

@ -313,6 +313,196 @@ api 返回内容需要包含 options 字段
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------ | ------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| reload | - | 重新加载,调用 `source`,刷新数据域数据刷新(重新加载) |
| setValue | `value: string` 更新的值 | 更新数据 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "radios",
"type": "radios",
"label": "radios",
"options": [
{
"label": "OptionA",
"value": "a"
},
{
"label": "OptionB",
"value": "b"
},
{
"label": "OptionC",
"value": "c"
},
{
"label": "OptionD",
"value": "d"
}
],
"value": "a",
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "radios",
"type": "radios",
"label": "radios",
"options": [
{
"label": "OptionA",
"value": "a"
},
{
"label": "OptionB",
"value": "b"
},
{
"label": "OptionC",
"value": "c"
},
{
"label": "OptionD",
"value": "d"
}
],
"value": "a",
"id": "reset_text"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### reload
只有选择器模式支持,即配置`source`,用于重新加载选择器的数据源。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "radios",
"type": "radios",
"label": "radios",
"id": "reload_type",
"source": "/api/mock2/form/getOptions",
"value": "a"
},
{
"type": "button",
"label": "重新加载",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reload",
"componentId": "reload_type"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "radios",
"type": "radios",
"label": "radios",
"options": [
{
"label": "OptionA",
"value": "a"
},
{
"label": "OptionB",
"value": "b"
},
{
"label": "OptionC",
"value": "c"
},
{
"label": "OptionD",
"value": "d"
}
],
"value": "a",
"id": "setvalue_text"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": "b"
}
}
]
}
}
}
]
}
```

View File

@ -1566,10 +1566,112 @@ leftOptions 动态加载,默认 source 接口是返回 options 部分,而 le
| 动作名称 | 动作配置 | 说明 |
| -------- | -------------------------------------- | --------------------------------------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| reload | - | 重新加载,调用 `source`,刷新数据域数据刷新(重新加载) |
| setValue | `value: string` \| `string[]` 更新的值 | 更新数据,开启`multiple`支持设置多项,开启`joinValues`时,多值用`,`分隔,否则多值用数组 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "select",
"type": "select",
"label": "select",
"options": [
{
"label": "OptionA",
"value": "a"
},
{
"label": "OptionB",
"value": "b"
},
{
"label": "OptionC",
"value": "c"
},
{
"label": "OptionD",
"value": "d"
}
],
"value": "a",
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "select",
"type": "select",
"label": "select",
"options": [
{
"label": "OptionA",
"value": "a"
},
{
"label": "OptionB",
"value": "b"
},
{
"label": "OptionC",
"value": "c"
},
{
"label": "OptionD",
"value": "d"
}
],
"value": "a",
"id": "reset_text"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### 刷新数据源 reload
```schema: scope="body"
@ -1635,3 +1737,56 @@ leftOptions 动态加载,默认 source 接口是返回 options 部分,而 le
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "select",
"type": "select",
"label": "select",
"options": [
{
"label": "OptionA",
"value": "a"
},
{
"label": "OptionB",
"value": "b"
},
{
"label": "OptionC",
"value": "c"
},
{
"label": "OptionD",
"value": "d"
}
],
"value": "a",
"id": "setvalue_text"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": "b"
}
}
]
}
}
}
]
}
```

View File

@ -102,7 +102,7 @@ order: 51
}
```
### 使用Schema配置文本
### 使用 Schema 配置文本
> `3.6.0` 版本之后支持
@ -142,7 +142,6 @@ order: 51
}
```
## 默认值
和其它表单项一样,如果要设置默认值,可以使用 value 属性
@ -295,10 +294,10 @@ order: 51
除了支持 [普通表单项属性表](./formitem#%E5%B1%9E%E6%80%A7%E8%A1%A8) 中的配置以外,还支持下面一些配置
| 属性名 | 类型 | 默认值 | 说明 | 版本 |
| ---------- | --------------------------- | ------- | -------------------- | --- |
| ---------- | ------------------------------------------ | ------- | -------------------- | ------------------ |
| option | `string` | | 选项说明 |
| onText | `string \| IconSchema \| SchemaCollection` | | 开启时开关显示的内容 | `3.6.0`支持Schema |
| offText | `string \| IconSchema \| SchemaCollection` | | 关闭时开关显示的内容 | `3.6.0`支持Schema |
| onText | `string \| IconSchema \| SchemaCollection` | | 开启时开关显示的内容 | `3.6.0`支持 Schema |
| offText | `string \| IconSchema \| SchemaCollection` | | 关闭时开关显示的内容 | `3.6.0`支持 Schema |
| trueValue | `boolean \| string \| number` | `true` | 标识真值 |
| falseValue | `boolean \| string \| number` | `false` | 标识假值 |
| size | `"sm" \| "md"` | `"md"` | 开关大小 |
@ -421,9 +420,76 @@ switch 值更新时弹出确认提示,确认后发送请求。
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------------------- | -------- |
| -------- | ------------------------------------- | ---------------------------------------------------------------------- | --- |
| clear | - | 清空6.3.1 及以上版本支持 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue`6.3.1 及以上版本支持 | |
| setValue | `value: string \| boolean` 更新的数据 | 更新数据 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "switch",
"label": "开关",
"type": "switch",
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "switch",
"label": "开关",
"type": "switch",
"id": "reset_text",
"value": true
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"

View File

@ -169,5 +169,391 @@ icon:
| 动作名称 | 动作配置 | 说明 |
| -------- | -------------------------------------- | --------------------------------------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string` \| `string[]` 更新的值 | 更新数据,开启`multiple`支持设置多项,开启`joinValues`时,多值用`,`分隔,否则多值用数组 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"label": "穿梭选择器",
"type": "tabs-transfer-picker",
"name": "a",
"sortable": true,
"selectMode": "tree",
"options": [
{
"label": "成员",
"selectMode": "tree",
"searchable": true,
"children": [
{
"label": "法师",
"children": [
{
"label": "诸葛亮",
"value": "zhugeliang"
}
]
},
{
"label": "战士",
"children": [
{
"label": "曹操",
"value": "caocao"
},
{
"label": "钟无艳",
"value": "zhongwuyan"
}
]
},
{
"label": "打野",
"children": [
{
"label": "李白",
"value": "libai"
},
{
"label": "韩信",
"value": "hanxin"
},
{
"label": "云中君",
"value": "yunzhongjun"
}
]
}
]
},
{
"label": "用户",
"selectMode": "chained",
"children": [
{
"label": "法师",
"children": [
{
"label": "诸葛亮",
"value": "zhugeliang2"
}
]
},
{
"label": "战士",
"children": [
{
"label": "曹操",
"value": "caocao2"
},
{
"label": "钟无艳",
"value": "zhongwuyan2"
}
]
},
{
"label": "打野",
"children": [
{
"label": "李白",
"value": "libai2"
},
{
"label": "韩信",
"value": "hanxin2"
},
{
"label": "云中君",
"value": "yunzhongjun2"
}
]
}
]
}
],
"value": "zhugeliang",
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"label": "穿梭选择器",
"type": "tabs-transfer-picker",
"name": "a",
"sortable": true,
"selectMode": "tree",
"options": [
{
"label": "成员",
"selectMode": "tree",
"searchable": true,
"children": [
{
"label": "法师",
"children": [
{
"label": "诸葛亮",
"value": "zhugeliang"
}
]
},
{
"label": "战士",
"children": [
{
"label": "曹操",
"value": "caocao"
},
{
"label": "钟无艳",
"value": "zhongwuyan"
}
]
},
{
"label": "打野",
"children": [
{
"label": "李白",
"value": "libai"
},
{
"label": "韩信",
"value": "hanxin"
},
{
"label": "云中君",
"value": "yunzhongjun"
}
]
}
]
},
{
"label": "用户",
"selectMode": "chained",
"children": [
{
"label": "法师",
"children": [
{
"label": "诸葛亮",
"value": "zhugeliang2"
}
]
},
{
"label": "战士",
"children": [
{
"label": "曹操",
"value": "caocao2"
},
{
"label": "钟无艳",
"value": "zhongwuyan2"
}
]
},
{
"label": "打野",
"children": [
{
"label": "李白",
"value": "libai2"
},
{
"label": "韩信",
"value": "hanxin2"
},
{
"label": "云中君",
"value": "yunzhongjun2"
}
]
}
]
}
],
"value": "zhugeliang",
"id": "reset_text"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"label": "穿梭选择器",
"type": "tabs-transfer-picker",
"name": "a",
"sortable": true,
"selectMode": "tree",
"options": [
{
"label": "成员",
"selectMode": "tree",
"searchable": true,
"children": [
{
"label": "法师",
"children": [
{
"label": "诸葛亮",
"value": "zhugeliang"
}
]
},
{
"label": "战士",
"children": [
{
"label": "曹操",
"value": "caocao"
},
{
"label": "钟无艳",
"value": "zhongwuyan"
}
]
},
{
"label": "打野",
"children": [
{
"label": "李白",
"value": "libai"
},
{
"label": "韩信",
"value": "hanxin"
},
{
"label": "云中君",
"value": "yunzhongjun"
}
]
}
]
},
{
"label": "用户",
"selectMode": "chained",
"children": [
{
"label": "法师",
"children": [
{
"label": "诸葛亮",
"value": "zhugeliang2"
}
]
},
{
"label": "战士",
"children": [
{
"label": "曹操",
"value": "caocao2"
},
{
"label": "钟无艳",
"value": "zhongwuyan2"
}
]
},
{
"label": "打野",
"children": [
{
"label": "李白",
"value": "libai2"
},
{
"label": "韩信",
"value": "hanxin2"
},
{
"label": "云中君",
"value": "yunzhongjun2"
}
]
}
]
}
],
"value": "zhugeliang",
"id": "setvalue_text"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": "yunzhongjun2"
}
}
]
}
}
}
]
}
```

View File

@ -631,7 +631,393 @@ icon:
| 动作名称 | 动作配置 | 说明 |
| ------------ | -------------------------------------- | --------------------------------------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| selectAll | - | 全选 |
| changeTabKey | `activeKey: number` 选中的 Tab | 修改当前选中 tab来选择其他选项 |
| setValue | `value: string` \| `string[]` 更新的值 | 更新数据,开启`multiple`支持设置多项,开启`joinValues`时,多值用`,`分隔,否则多值用数组 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"label": "组合穿梭器",
"type": "tabs-transfer",
"name": "a",
"sortable": true,
"selectMode": "tree",
"options": [
{
"label": "成员",
"selectMode": "tree",
"searchable": true,
"children": [
{
"label": "法师",
"children": [
{
"label": "诸葛亮",
"value": "zhugeliang"
}
]
},
{
"label": "战士",
"children": [
{
"label": "曹操",
"value": "caocao"
},
{
"label": "钟无艳",
"value": "zhongwuyan"
}
]
},
{
"label": "打野",
"children": [
{
"label": "李白",
"value": "libai"
},
{
"label": "韩信",
"value": "hanxin"
},
{
"label": "云中君",
"value": "yunzhongjun"
}
]
}
]
},
{
"label": "用户",
"selectMode": "chained",
"children": [
{
"label": "法师",
"children": [
{
"label": "诸葛亮",
"value": "zhugeliang2"
}
]
},
{
"label": "战士",
"children": [
{
"label": "曹操",
"value": "caocao2"
},
{
"label": "钟无艳",
"value": "zhongwuyan2"
}
]
},
{
"label": "打野",
"children": [
{
"label": "李白",
"value": "libai2"
},
{
"label": "韩信",
"value": "hanxin2"
},
{
"label": "云中君",
"value": "yunzhongjun2"
}
]
}
]
}
],
"value": "zhugeliang",
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"label": "组合穿梭器",
"type": "tabs-transfer",
"name": "a",
"sortable": true,
"selectMode": "tree",
"options": [
{
"label": "成员",
"selectMode": "tree",
"searchable": true,
"children": [
{
"label": "法师",
"children": [
{
"label": "诸葛亮",
"value": "zhugeliang"
}
]
},
{
"label": "战士",
"children": [
{
"label": "曹操",
"value": "caocao"
},
{
"label": "钟无艳",
"value": "zhongwuyan"
}
]
},
{
"label": "打野",
"children": [
{
"label": "李白",
"value": "libai"
},
{
"label": "韩信",
"value": "hanxin"
},
{
"label": "云中君",
"value": "yunzhongjun"
}
]
}
]
},
{
"label": "用户",
"selectMode": "chained",
"children": [
{
"label": "法师",
"children": [
{
"label": "诸葛亮",
"value": "zhugeliang2"
}
]
},
{
"label": "战士",
"children": [
{
"label": "曹操",
"value": "caocao2"
},
{
"label": "钟无艳",
"value": "zhongwuyan2"
}
]
},
{
"label": "打野",
"children": [
{
"label": "李白",
"value": "libai2"
},
{
"label": "韩信",
"value": "hanxin2"
},
{
"label": "云中君",
"value": "yunzhongjun2"
}
]
}
]
}
],
"value": "zhugeliang",
"id": "reset_text"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"label": "组合穿梭器",
"type": "tabs-transfer",
"name": "a",
"sortable": true,
"selectMode": "tree",
"options": [
{
"label": "成员",
"selectMode": "tree",
"searchable": true,
"children": [
{
"label": "法师",
"children": [
{
"label": "诸葛亮",
"value": "zhugeliang"
}
]
},
{
"label": "战士",
"children": [
{
"label": "曹操",
"value": "caocao"
},
{
"label": "钟无艳",
"value": "zhongwuyan"
}
]
},
{
"label": "打野",
"children": [
{
"label": "李白",
"value": "libai"
},
{
"label": "韩信",
"value": "hanxin"
},
{
"label": "云中君",
"value": "yunzhongjun"
}
]
}
]
},
{
"label": "用户",
"selectMode": "chained",
"children": [
{
"label": "法师",
"children": [
{
"label": "诸葛亮",
"value": "zhugeliang2"
}
]
},
{
"label": "战士",
"children": [
{
"label": "曹操",
"value": "caocao2"
},
{
"label": "钟无艳",
"value": "zhongwuyan2"
}
]
},
{
"label": "打野",
"children": [
{
"label": "李白",
"value": "libai2"
},
{
"label": "韩信",
"value": "hanxin2"
},
{
"label": "云中君",
"value": "yunzhongjun2"
}
]
}
]
}
],
"value": "zhugeliang",
"id": "setvalue_text"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": "yunzhongjun2"
}
}
]
}
}
}
]
}
```

View File

@ -122,8 +122,141 @@ order: 57
当前组件对外暴露以下特性动作,其他组件可以通过指定`actionType: 动作名称`、`componentId: 该组件id`来触发这些动作,动作配置可以通过`args: {动作配置项名称: xxx}`来配置具体的参数,详细请查看[事件动作](../../docs/concepts/event-action#触发其他组件的动作)。
| 动作名称 | 动作配置 | 说明 |
| -------- | ------------------------ | ------------------------------------------------------ |
| -------- | ------------------------ | ------------------------------------------------ |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| focus | - | 获取焦点 |
| setValue | `value: string` 更新的值 | 更新数据 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "text",
"id": "clear_text",
"type": "textarea",
"label": "text",
"value": "清空我"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "text",
"id": "reset_text",
"type": "textarea",
"label": "text",
"value": "重置我"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### focus
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "text",
"id": "focus_text",
"type": "textarea",
"label": "text",
"value": "聚焦我"
},
{
"type": "button",
"label": "聚焦",
"onEvent": {
"click": {
"actions": [
{
"actionType": "focus",
"componentId": "focus_text"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"name": "text",
"id": "setvalue_text",
"type": "textarea",
"label": "text",
"value": "amis"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": "amis go go go!"
}
}
]
}
}
}
]
}
```

View File

@ -117,10 +117,11 @@ icon:
```
## 属性表
下面属性为`transfer-picker`独占属性, 更多属性用法,参考[穿梭器Transfer](./transfer)
| 属性名 | 类型 | 默认值 | 说明
| ----------------- | --------- | ------- | -------------------------------------------------
| 属性名 | 类型 | 默认值 | 说明 |
| ---------- | -------------------------------- | ------ | -------------------------------------------------------------- |
| borderMode | `'full'` \| `'half'` \| `'none'` | | 边框模式,`'full'`为全边框,`'half'`为半边框,`'none'`为没边框 |
| pickerSize | string | | 弹窗大小,支持: xs、sm、md、lg、xl、full |
@ -143,5 +144,187 @@ icon:
| 动作名称 | 动作配置 | 说明 |
| -------- | -------------------------------------- | --------------------------------------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string` \| `string[]` 更新的值 | 更新数据,开启`multiple`支持设置多项,开启`joinValues`时,多值用`,`分隔,否则多值用数组 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"label": "默认",
"type": "transfer-picker",
"name": "transfer",
"value": "zhugeliang,libai",
"options": [
{
"label": "诸葛亮",
"value": "zhugeliang"
},
{
"label": "曹操",
"value": "caocao"
},
{
"label": "钟无艳",
"value": "zhongwuyan"
},
{
"label": "李白",
"value": "libai"
},
{
"label": "韩信",
"value": "hanxin"
},
{
"label": "云中君",
"value": "yunzhongjun"
}
],
"value": "zhugeliang",
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"label": "默认",
"type": "transfer-picker",
"name": "transfer",
"value": "zhugeliang,libai",
"options": [
{
"label": "诸葛亮",
"value": "zhugeliang"
},
{
"label": "曹操",
"value": "caocao"
},
{
"label": "钟无艳",
"value": "zhongwuyan"
},
{
"label": "李白",
"value": "libai"
},
{
"label": "韩信",
"value": "hanxin"
},
{
"label": "云中君",
"value": "yunzhongjun"
}
],
"value": "zhugeliang",
"id": "reset_text"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"label": "默认",
"type": "transfer-picker",
"name": "transfer",
"value": "zhugeliang,libai",
"options": [
{
"label": "诸葛亮",
"value": "zhugeliang"
},
{
"label": "曹操",
"value": "caocao"
},
{
"label": "钟无艳",
"value": "zhongwuyan"
},
{
"label": "李白",
"value": "libai"
},
{
"label": "韩信",
"value": "hanxin"
},
{
"label": "云中君",
"value": "yunzhongjun"
}
],
"value": "zhugeliang",
"id": "setvalue_text"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": "yunzhongjun"
}
}
]
}
}
}
]
}
```

View File

@ -1101,7 +1101,189 @@ icon:
| 动作名称 | 动作配置 | 说明 |
| ----------- | ------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| clearSearch | `left: boolean` 左侧搜索、`right:boolean`右侧搜索 | 默认清除所有搜索态,可以单独配置`left`、`right`为`true`来清空对应左侧或者右侧面板(`3.4.0`及以上版本支持) |
| selectAll | - | 全选 |
| setValue | `value: string` \| `string[]` 更新的值 | 更新数据,开启`multiple`支持设置多项,开启`joinValues`时,多值用`,`分隔,否则多值用数组 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"label": "默认",
"type": "transfer",
"name": "transfer",
"value": "zhugeliang,libai",
"options": [
{
"label": "诸葛亮",
"value": "zhugeliang"
},
{
"label": "曹操",
"value": "caocao"
},
{
"label": "钟无艳",
"value": "zhongwuyan"
},
{
"label": "李白",
"value": "libai"
},
{
"label": "韩信",
"value": "hanxin"
},
{
"label": "云中君",
"value": "yunzhongjun"
}
],
"value": "zhugeliang",
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"label": "默认",
"type": "transfer",
"name": "transfer",
"value": "zhugeliang,libai",
"options": [
{
"label": "诸葛亮",
"value": "zhugeliang"
},
{
"label": "曹操",
"value": "caocao"
},
{
"label": "钟无艳",
"value": "zhongwuyan"
},
{
"label": "李白",
"value": "libai"
},
{
"label": "韩信",
"value": "hanxin"
},
{
"label": "云中君",
"value": "yunzhongjun"
}
],
"value": "zhugeliang",
"id": "reset_text"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```
### setValue
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"label": "默认",
"type": "transfer",
"name": "transfer",
"value": "zhugeliang,libai",
"options": [
{
"label": "诸葛亮",
"value": "zhugeliang"
},
{
"label": "曹操",
"value": "caocao"
},
{
"label": "钟无艳",
"value": "zhongwuyan"
},
{
"label": "李白",
"value": "libai"
},
{
"label": "韩信",
"value": "hanxin"
},
{
"label": "云中君",
"value": "yunzhongjun"
}
],
"value": "zhugeliang",
"id": "setvalue_text"
},
{
"type": "button",
"label": "赋值",
"onEvent": {
"click": {
"actions": [
{
"actionType": "setValue",
"componentId": "setvalue_text",
"args": {
"value": "yunzhongjun"
}
}
]
}
}
}
]
}
```

View File

@ -823,5 +823,139 @@ order: 60
| delete | value: ` any` | 删除数据项的 value如果配置了 valueField以 valueField 的字段值为准) |
| reload | - | 刷新 |
| clear | - | 清空 |
| reset | - | 将值重置为`resetValue`,若没有配置`resetValue`,则清空 |
| reset | - | 将值重置为初始值。6.3.0 及以下版本为`resetValue` |
| setValue | `value: string` \| `string[]` 更新的值 | 更新数据,开启`multiple`支持设置多项,开启`joinValues`时,多值用`,`分隔,否则多值用数组 |
### clear
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "tree-select",
"name": "tree",
"label": "Tree",
"options": [
{
"label": "Folder A",
"value": 1,
"children": [
{
"label": "file A",
"value": 2
},
{
"label": "Folder B",
"value": 3,
"children": [
{
"label": "file b1",
"value": 3.1
},
{
"label": "file b2",
"value": 3.2
}
]
}
]
},
{
"label": "file C",
"value": 4
},
{
"label": "file D",
"value": 5
}
],
"value": 5,
"id": "clear_text"
},
{
"type": "button",
"label": "清空",
"onEvent": {
"click": {
"actions": [
{
"actionType": "clear",
"componentId": "clear_text"
}
]
}
}
}
]
}
```
### reset
如果配置了`resetValue`,则重置时使用`resetValue`的值,否则使用初始值。
```schema: scope="body"
{
"type": "form",
"debug": true,
"body": [
{
"type": "tree-select",
"name": "tree",
"label": "Tree",
"options": [
{
"label": "Folder A",
"value": 1,
"children": [
{
"label": "file A",
"value": 2
},
{
"label": "Folder B",
"value": 3,
"children": [
{
"label": "file b1",
"value": 3.1
},
{
"label": "file b2",
"value": 3.2
}
]
}
]
},
{
"label": "file C",
"value": 4
},
{
"label": "file D",
"value": 5
}
],
"value": 5,
"id": "reset_text"
},
{
"type": "button",
"label": "重置",
"onEvent": {
"click": {
"actions": [
{
"actionType": "reset",
"componentId": "reset_text"
}
]
}
}
}
]
}
```

View File

@ -1452,7 +1452,9 @@ run action ajax
> 6.2.0 及以后版本
打印页面中的某个组件,对应的组件需要配置 `testid`,如果要打印多个,可以使用 `"testids": ["x", "y"]` 来打印多个组件
打印页面中的某个组件,对应的组件需要配置 `id`,如果要打印多个,可以使用 `"ids": ["x", "y"]` 来打印多个组件,只支持主要是容器类组件 `crud`、`crud2`、`form`、`table`、`wrapper`、`container`、`flex`、`grid`、`grid2d`、`tableview`
> breaking在 6.2.0 版本中配置是 testid但这个配置会导致性能问题所以新版使用 id 作为标识。
```schema
{
@ -1469,7 +1471,7 @@ run action ajax
{
actionType: 'print',
args: {
testid: 'mycrud'
id: 'mycrud'
}
}
]
@ -1479,7 +1481,7 @@ run action ajax
{
"type": "crud",
"api": "/api/mock2/sample",
"testid": "mycrud",
"id": "mycrud",
"syncLocation": false,
"columns": [
{

View File

@ -8,5 +8,5 @@
"packages/amis-editor"
],
"useWorkspaces": false,
"version": "6.3.0"
"version": "6.4.0"
}

View File

@ -1,6 +1,6 @@
{
"name": "amis-core",
"version": "6.3.0",
"version": "6.4.0",
"description": "amis-core",
"main": "lib/index.js",
"module": "esm/index.js",
@ -48,7 +48,7 @@
"esm"
],
"dependencies": {
"amis-formula": "^6.3.0",
"amis-formula": "^6.4.0",
"classnames": "2.3.2",
"file-saver": "^2.0.2",
"hoist-non-react-statics": "^3.3.2",

View File

@ -10,8 +10,8 @@ import {
export interface IPrintAction extends ListenerAction {
actionType: 'copy';
args: {
testid?: string;
testids?: string[];
id?: string;
ids?: string[];
};
}
@ -28,17 +28,15 @@ export class PrintAction implements RendererAction {
renderer: ListenerContext,
event: RendererEvent<any>
) {
if (action.args?.testid) {
const element = document.querySelector(
`[data-testid='${action.args.testid}']`
);
if (action.args?.id) {
const element = document.querySelector(`[data-id='${action.args.id}']`);
if (element) {
printElements([element]);
}
} else if (action.args?.testids) {
} else if (action.args?.ids) {
const elements: Element[] = [];
action.args.testids.forEach(testid => {
const element = document.querySelector(`[data-testid='${testid}']`);
action.args.ids.forEach(id => {
const element = document.querySelector(`[data-id='${id}']`);
if (element) {
elements.push(element);
}

View File

@ -713,7 +713,7 @@ export default class Form extends React.Component<FormProps, object> {
async dispatchInited(value: any) {
const {data, store, dispatchEvent} = this.props;
if (store.fetching) {
if (!isAlive(store) || store.fetching) {
return value;
}

View File

@ -1,7 +1,10 @@
import {toFixed} from '@rc-component/mini-decimal';
// 主要用于解决 0.1+0.2 结果的精度问题导致太长
export function stripNumber(number: number, precision = 16) {
if (typeof number === 'number' && !Number.isInteger(number)) {
return parseFloat(number.toPrecision(precision));
// return parseFloat(number.toPrecision(precision));
return parseFloat(toFixed(number.toString(), '.', precision));
} else {
return number;
}

View File

@ -1,6 +1,6 @@
{
"name": "amis-editor-core",
"version": "6.3.0",
"version": "6.4.0",
"description": "amis 可视化编辑器",
"main": "lib/index.js",
"module": "esm/index.js",

View File

@ -37,6 +37,11 @@ $tooltip-bottom: '[data-tooltip][data-position=' bottom ']:hover:after';
transition: none;
}
// 用于避免右侧配置面板被超长的valueLabel撑开导致样式异常
.#{$ns}SubForm-valueLabel {
word-break: break-all;
}
// 外层有多个tab面板
&.mul-tabs-panel {
width: calc(#{$right-panel-sidetab-width} + #{$right-panel-width});

View File

@ -1,6 +1,6 @@
{
"name": "amis-editor",
"version": "6.3.0",
"version": "6.4.0",
"description": "amis 可视化编辑器",
"main": "lib/index.js",
"module": "esm/index.js",
@ -41,7 +41,7 @@
],
"dependencies": {
"@webcomponents/webcomponentsjs": "^2.6.0",
"amis-editor-core": "^6.3.0",
"amis-editor-core": "^6.4.0",
"amis-postcss": "1.0.0",
"amis-theme-editor-helper": "*",
"i18n-runtime": "*",

View File

@ -632,9 +632,7 @@ extendLocale('en-US', {
'528609917710d813a55e5a6cecf1e458': 'Selected value',
'288f0c404c4e546aa3683ff5054e85e2': 'Clear',
'c374a44713fa5ff5da2565beb398c7d3': 'Delete selected value',
'8db57ba01ffb9bf29c1656de5f0208f5':
'Reset the value to resetValue. If the resetValue is not configured, the value is cleared.',
'8f40db3b25528063f1b6a59602a05cd5': 'Value assignment',
'8db57ba01ffb9bf29c1656de5f0208f5': 'Reset the value to the initial value.',
'944908c981a86bfa0cfab9360ab38184':
'Allow the button to occupy the parent container fully. The width of individual buttons is adaptive.',
'ac3880323853de9adc4f66bc06d438ff': 'Button style',

View File

@ -636,8 +636,7 @@ extendLocale('zh-CN', {
'528609917710d813a55e5a6cecf1e458': '选中值',
'288f0c404c4e546aa3683ff5054e85e2': '清空',
'c374a44713fa5ff5da2565beb398c7d3': '清除选中值',
'8db57ba01ffb9bf29c1656de5f0208f5':
'将值重置为resetValue若没有配置resetValue则清空',
'8db57ba01ffb9bf29c1656de5f0208f5': '将值重置为初始值',
'8f40db3b25528063f1b6a59602a05cd5': '赋值',
'944908c981a86bfa0cfab9360ab38184': '使按钮宽度占满父容器,各按钮宽度自适应',
'0b98b0bea3db6ae5b67a09c7bb2d032b': '按钮选中样式',

View File

@ -131,7 +131,7 @@ export class CalendarPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'setValue',

View File

@ -100,7 +100,7 @@ export class ButtonGroupControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'reload',

View File

@ -88,7 +88,7 @@ export class ChainedSelectControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'reload',

View File

@ -108,7 +108,7 @@ export class CheckboxControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'setValue',

View File

@ -113,7 +113,7 @@ export class CheckboxesControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'reload',

View File

@ -120,7 +120,7 @@ export class CodeEditorControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'focus',

View File

@ -254,7 +254,7 @@ export class ComboControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'addItem',

View File

@ -127,7 +127,7 @@ export class DiffEditorControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'focus',

View File

@ -253,7 +253,7 @@ export class DateControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'setValue',

View File

@ -299,7 +299,7 @@ export class DateRangeControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'setValue',

View File

@ -85,7 +85,7 @@ export class ExcelControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'setValue',

View File

@ -118,7 +118,7 @@ export class KVControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'setValue',

View File

@ -160,7 +160,7 @@ export class RangeControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'setValue',

View File

@ -85,7 +85,7 @@ export class RateControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'setValue',

View File

@ -1094,7 +1094,7 @@ export class TableControlPlugin extends BasePlugin {
// {
// actionType: 'reset',
// actionLabel: '重置',
// description: '将值重置为resetValue若没有配置resetValue则清空'
// description: '将值重置为初始值'
// },
{
actionType: 'clear',

View File

@ -190,7 +190,7 @@ export class TextControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'reload',

View File

@ -107,7 +107,7 @@ export class ListControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'reload',

View File

@ -95,7 +95,7 @@ export class LocationControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'setValue',

View File

@ -201,7 +201,7 @@ export class NestedSelectControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'reload',

View File

@ -103,7 +103,7 @@ export class RadiosControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'reload',

View File

@ -176,7 +176,7 @@ export class SelectControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'reload',

View File

@ -94,6 +94,16 @@ export class SwitchControlPlugin extends BasePlugin {
// 动作定义
actions: RendererPluginAction[] = [
{
actionType: 'clear',
actionLabel: '清空',
description: '清除选中值'
},
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为初始值'
},
{
actionType: 'setValue',
actionLabel: '赋值',

View File

@ -119,7 +119,7 @@ export class TextareaControlPlugin extends BasePlugin {
{
actionType: 'reset',
actionLabel: '重置',
description: '将值重置为resetValue若没有配置resetValue则清空'
description: '将值重置为初始值'
},
{
actionType: 'setValue',

View File

@ -1,6 +1,6 @@
{
"name": "amis-formula",
"version": "6.3.0",
"version": "6.4.0",
"description": "负责 amis 里面的表达式实现,内置公式,编辑器等",
"main": "lib/index.js",
"module": "esm/index.js",

View File

@ -3,7 +3,7 @@
"main": "lib/index.js",
"module": "esm/index.js",
"types": "lib/index.d.ts",
"version": "6.3.0",
"version": "6.4.0",
"description": "",
"scripts": {
"build": "npm run clean-dist && NODE_ENV=production rollup -c ",
@ -36,8 +36,8 @@
},
"dependencies": {
"@rc-component/mini-decimal": "^1.0.1",
"amis-core": "^6.3.0",
"amis-formula": "^6.3.0",
"amis-core": "^6.4.0",
"amis-formula": "^6.4.0",
"classnames": "2.3.2",
"codemirror": "^5.63.0",
"downshift": "6.1.12",

View File

@ -681,6 +681,7 @@
.#{$ns}ResultBox-value-wrap {
justify-content: flex-end;
text-align: right;
flex-wrap: nowrap; // 避免右侧下拉箭头换行
}
}

View File

@ -452,6 +452,7 @@
display: inline-block;
margin: px2rem(3px);
vertical-align: middle;
max-width: 100%; // 避免超出父级容器显示
&-caret {
transition: transform var(--animation-duration) ease-out;

File diff suppressed because it is too large Load Diff

View File

@ -1446,9 +1446,8 @@ export class DateRangePicker extends React.Component<
}
// 重置
reset() {
reset(resetValue?: any) {
const {
resetValue,
onChange,
format,
valueFormat,
@ -1458,17 +1457,16 @@ export class DateRangePicker extends React.Component<
displayFormat,
data
} = this.props;
if (!resetValue) {
return;
}
const tmpResetValue = resetValue ?? this.props.resetValue;
const {startDate, endDate} = DateRangePicker.unFormatValue(
resetValue,
tmpResetValue,
valueFormat || (format as string),
joinValues,
delimiter,
data
);
onChange(resetValue);
onChange?.(tmpResetValue);
this.setState({
startInputValue: startDate?.format(displayFormat || inputFormat),
endInputValue: endDate?.format(displayFormat || inputFormat)

View File

@ -382,11 +382,21 @@ export class Range extends React.Component<RangeItemProps, any> {
*/
getStepValue(value: number, step: number) {
const surplus = value % step;
let curValue = 0;
const closeNum = value - surplus;
// 余数 >= 步长一半 -> 向上取value为正值的时候使用 safeAdd否则使用 safeSub
// 余数 < 步长一半 -> 向下取,使用 closeNum
if (Math.abs(surplus) >= step / 2) {
curValue = value >= 0 ? safeAdd(closeNum, step) : safeSub(closeNum, step);
} else {
curValue = closeNum;
}
/*
let result = 0;
let closeNum = Math.floor(value - (value % step));
let closeNum = Math.floor(value - surplus);
// 余数 >= 步长一半 -> 向上取
// 余数 < 步长一半 -> 向下取
const _value = surplus >= step / 2 ? value : safeSub(value, step);
const _value = Math.abs(surplus) >= step / 2 ? value : safeSub(value, step);
while (result <= _value) {
if (step < 1 || result === 0 || result === closeNum) {
result = safeAdd(result, step);
@ -395,6 +405,8 @@ export class Range extends React.Component<RangeItemProps, any> {
}
}
return result;
*/
return curValue;
}
/**

View File

@ -25,6 +25,7 @@ exports[`doAction:crud reload 1`] = `
</button>
<div
class="cxd-Crud is-loading"
data-id="crud_reload"
>
<div
class="cxd-Table cxd-Crud-body"
@ -332,6 +333,7 @@ exports[`doAction:crud reload with data1 1`] = `
</button>
<div
class="cxd-Crud is-loading"
data-id="crud_reload"
>
<div
class="cxd-Table cxd-Crud-body"
@ -639,6 +641,7 @@ exports[`doAction:crud reload with data2 1`] = `
</button>
<div
class="cxd-Crud is-loading"
data-id="crud_reload"
>
<div
class="cxd-Table cxd-Crud-body"

View File

@ -45,7 +45,7 @@ exports[`EventAction:inputRange 1`] = `
/>
</div>
<div
class="cxd-InputRange-label pos-top cxd-InputRange-label-visible"
class="cxd-InputRange-label pos-top"
style="position: relative;"
>
<span>

View File

@ -15,7 +15,6 @@ test('EventAction:locationPicker', async () => {
id: 'location-picker',
ak: 'LiZT5dVbGTsPI91tFGcOlSpe5FDehpf7',
coordinatesType: 'bd09',
value: '',
name: 'location',
resetValue: {
address: '北京市东城区天安门广场中央',

View File

@ -1,4 +1,5 @@
import {fireEvent, render, waitFor} from '@testing-library/react';
// import {fireEvent as fireEvent2} from '@testing-library/dom';
import '../../../../src';
import {render as amisRender} from '../../../../src';
import {makeEnv, wait} from '../../../helper';
@ -14,6 +15,7 @@ test('EventAction:inputRange', async () => {
type: 'input-range',
name: 'range',
value: 10,
min: 0,
showInput: true,
clearabled: true,
onEvent: {
@ -116,6 +118,8 @@ test('EventAction:inputRange', async () => {
).toBeInTheDocument();
});
/**
* change case先注释掉fireEvent.mouseMove时event中拿不到pageX
// 滑动 change
const slider = container.querySelector('.cxd-InputRange-handle-icon')!;
fireEvent.mouseDown(slider);
@ -131,6 +135,15 @@ test('EventAction:inputRange', async () => {
).toBeInTheDocument();
expect(container.querySelector(`[value="值为0"]`)).toBeInTheDocument();
});
*/
// 临时替代滑动 change case
fireEvent.change(inputs, {
target: {
value: 0
}
});
await wait(300);
// focus
fireEvent.focus(inputs);

View File

@ -1020,8 +1020,6 @@ test('Renderer:input-table canAccessSuperData', async () => {
expect(inputs).toEqual(['a1', '']);
});
// 对应 github issue: https://github.com/baidu/amis/issues/9537
test('Renderer:input-table item confirm validate', async () => {
const onSubmit = jest.fn();
@ -1085,3 +1083,74 @@ test('Renderer:input-table item confirm validate', async () => {
expect(container.querySelector('.has-error--isRequired')).toBeInTheDocument();
});
// 问题:分页切换后,新行数据中不存在原始行中的某个数据,但是切换后,表单项还是展示的原来的值
// 比如下面的例子,新行 c 字段不存在但是切过去后c 显示 c1
test('Renderer:input-table pagination data issue', async () => {
const onSubmit = jest.fn();
const {container, findByRole, findByText} = render(
amisRender(
{
type: 'page',
body: {
type: 'form',
data: {
table: [
{
a: 'a1',
b: 'b1',
c: 'c1'
},
{
a: 'a2',
b: 'b2'
}
]
},
body: [
{
showIndex: true,
type: 'input-table',
needConfirm: false,
perPage: 1,
name: 'table',
columns: [
{
name: 'a',
label: 'A'
},
{
name: 'b',
label: 'B',
quickEdit: {
type: 'form',
body: [
{
type: 'input-text',
name: 'b'
},
{
type: 'input-text',
name: 'c'
}
]
}
}
]
}
]
}
},
{},
makeEnv({})
)
);
await wait(200);
const nextBtn = container.querySelector('.cxd-Pagination-next');
fireEvent.click(nextBtn!);
await wait(200);
const c = container.querySelector('input[name="c"]');
expect(c).toHaveValue('');
});

View File

@ -1,5 +1,11 @@
import React = require('react');
import {render, cleanup, fireEvent, waitFor, screen} from '@testing-library/react';
import {
render,
cleanup,
fireEvent,
waitFor,
screen
} from '@testing-library/react';
import '../../../src';
import {render as amisRender} from '../../../src';
import {makeEnv, replaceReactAriaIds, wait} from '../../helper';
@ -354,36 +360,40 @@ describe('Renderer:text with options and multiple', () => {
test('Renderer:text with options auto ellipsis', async () => {
const longText = 'OptionB (with long suffix for testing ellipsis)';
const {container} = await setup({
"name": "text",
"type": "input-text",
"label": "text",
"multiple": true,
"options": [
name: 'text',
type: 'input-text',
label: 'text',
multiple: true,
options: [
{
"label": "OptionA",
"value": "a"
label: 'OptionA',
value: 'a'
},
{
"label": longText,
"value": "b"
label: longText,
value: 'b'
},
{
"label": "OptionC",
"value": "c"
label: 'OptionC',
value: 'c'
},
{
"label": "OptionD",
"value": "d"
label: 'OptionD',
value: 'd'
}
]
});
const textControl = container.querySelector('.cxd-TextControl-input') as HTMLElement;
const textControl = container.querySelector(
'.cxd-TextControl-input'
) as HTMLElement;
fireEvent.click(textControl);
await wait(300);
replaceReactAriaIds(container);
const listItems = container.querySelectorAll('.cxd-TextControl-sugs .cxd-TextControl-sugItem');
const listItems = container.querySelectorAll(
'.cxd-TextControl-sugs .cxd-TextControl-sugItem'
);
expect(listItems.length).toBe(4);
// 选中长文本项
@ -503,7 +513,7 @@ test('Renderer:text with resetValue and trimContents', async () => {
await wait(500);
expect(input.value).toBe('reset-value');
expect(input.value).toBe('text-value');
// trimContents
const textControl = container.querySelector(

View File

@ -1,6 +1,6 @@
{
"name": "amis",
"version": "6.3.0",
"version": "6.4.0",
"description": "一种MIS页面生成工具",
"main": "lib/index.js",
"module": "esm/index.js",
@ -37,8 +37,8 @@
}
],
"dependencies": {
"amis-core": "^6.3.0",
"amis-ui": "^6.3.0",
"amis-core": "^6.4.0",
"amis-ui": "^6.4.0",
"attr-accept": "2.2.2",
"blueimp-canvastoblob": "2.1.0",
"classnames": "2.3.2",
@ -62,7 +62,7 @@
"moment": "^2.19.4",
"moment-timezone": "^0.5.34",
"mpegts.js": "^1.6.10",
"office-viewer": "^0.3.10",
"office-viewer": "^0.3.11",
"prop-types": "^15.6.1",
"qrcode.react": "^3.1.0",
"react-cropper": "^2.1.8",

View File

@ -2665,6 +2665,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
headerToolbarRender,
footerToolbarRender,
testIdBuilder,
id,
...rest
} = this.props;
@ -2675,6 +2676,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
'is-mobile': isMobile()
})}
style={style}
data-id={id}
{...testIdBuilder?.getChild('wrapper').getTestId()}
>
{filter && (!store.filterTogggable || store.filterVisible)

View File

@ -1322,6 +1322,7 @@ export default class CRUD2 extends React.Component<CRUD2Props, any> {
columnsTogglable,
headerToolbarClassName,
footerToolbarClassName,
id,
...rest
} = this.props;
@ -1331,6 +1332,7 @@ export default class CRUD2 extends React.Component<CRUD2Props, any> {
'is-loading': store.loading
})}
style={style}
data-id={id}
>
<div className={cx('Crud2-filter')}>
{this.renderFilter(filterSchema)}

View File

@ -54,7 +54,7 @@ const DEFAULT_EVENT_PARAMS = [
/**
* Chart
* https://aisuda.bce.baidu.com/amis/zh-CN/components/carousel
* https://aisuda.bce.baidu.com/amis/zh-CN/components/chart
*/
export interface ChartSchema extends BaseSchema {
/**

View File

@ -195,8 +195,7 @@ export default class Container<T> extends React.Component<
wrapperCustomStyle,
env,
themeCss,
baseControlClassName,
testid
baseControlClassName
} = this.props;
const finalDraggable: boolean = isPureVariable(draggable)
? resolveVariableAndFilter(draggable, data, '| raw')
@ -232,6 +231,7 @@ export default class Container<T> extends React.Component<
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}
style={buildStyle(style, data)}
data-id={id}
>
{this.renderBody()}
<CustomStyle

View File

@ -111,8 +111,7 @@ export default class Flex extends React.Component<FlexProps, object> {
wrapperCustomStyle,
env,
themeCss,
classnames: cx,
testid
classnames: cx
} = this.props;
const styleVar = buildStyle(style, data);
const flexStyle = {
@ -151,6 +150,7 @@ export default class Flex extends React.Component<FlexProps, object> {
themeCss: wrapperCustomStyle
})
)}
data-id={id}
>
{(Array.isArray(items) ? items : items ? [items] : []).map(
(item, key) =>

View File

@ -2,7 +2,9 @@ import React from 'react';
import {
OptionsControl,
OptionsControlProps,
FormOptionsControl
FormOptionsControl,
filter,
getVariable
} from 'amis-core';
import {Option, TestIdBuilder} from 'amis-core';
import {ActionObject, isObject} from 'amis-core';
@ -49,13 +51,15 @@ export default class ButtonGroupControl extends React.Component<
};
doAction(action: ActionObject, data: object, throwErrors: boolean) {
const {resetValue, onChange} = this.props;
const {resetValue, onChange, formStore, store, name} = this.props;
const actionType = action?.actionType as string;
if (actionType === 'clear') {
onChange('');
} else if (actionType === 'reset') {
onChange(resetValue ?? '');
const pristineVal =
getVariable(formStore?.pristine ?? store?.pristine, name) ?? resetValue;
onChange(pristineVal ?? '');
}
}

Some files were not shown because too many files have changed in this diff Show More