Merge remote-tracking branch 'baidu/master'

This commit is contained in:
2betop 2021-08-03 17:33:34 +08:00
commit 53023a3577
5 changed files with 106 additions and 3 deletions

View File

@ -268,13 +268,13 @@ Dialog 弹框 主要由 [Action](./action) 触发,主要展示一个对话框
"title": "弹框",
"body": [
{
"type": "action",
"type": "button",
"label": "默认的 ajax 请求",
"actionType": "ajax",
"api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/form/saveForm?waitSeconds=1"
},
{
"type": "action",
"type": "button",
"label": "ajax 请求成功后关闭弹框",
"actionType": "ajax",
"api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/form/saveForm?waitSeconds=1",

View File

@ -0,0 +1,78 @@
---
title: InputMonthRange 时间范围
description:
type: 0
group: null
menuName: InputTimeRange
icon:
order: 15
---
## 基本用法
```schema: scope="body"
{
"type": "form",
"api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/form/saveForm",
"body": [
{
"type": "input-time-range",
"name": "times",
"label": "时间范围"
}
]
}
```
## 内嵌模式
```schema: scope="body"
{
"type": "form",
"api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/form/saveForm",
"debug": true,
"body": [
{
"type": "input-time-range",
"name": "times",
"label": "时间范围",
"embed": true
}
]
}
```
## 显示秒
默认显示的是时和分,要显示秒请参考以下配置
```schema: scope="body"
{
"type": "form",
"api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/form/saveForm",
"debug": true,
"body": [
{
"type": "input-time-range",
"name": "times",
"label": "时间范围",
"timeFormat": "HH:mm:ss",
"format": "HH:mm:ss",
"inputFormat": "HH:mm:ss"
}
]
}
```
## 属性表
除了支持 [普通表单项属性表](./formitem#%E5%B1%9E%E6%80%A7%E8%A1%A8) 中的配置以外,还支持下面一些配置
| 属性名 | 类型 | 默认值 | 说明 |
| ----------- | --------- | ------------------ | --------------------------------------------------------------------- |
| timeFormat | `string` | `HH:mm` | [时间范围选择器值格式](./date#%E5%80%BC%E6%A0%BC%E5%BC%8F) |
| format | `string` | `HH:mm` | [时间范围选择器值格式](./date#%E5%80%BC%E6%A0%BC%E5%BC%8F) |
| inputFormat | `string` | `HH:mm` | [时间范围选择器显示格式](./date#%E6%98%BE%E7%A4%BA%E6%A0%BC%E5%BC%8F) |
| placeholder | `string` | `"请选择时间范围"` | 占位文本 |
| clearable | `boolean` | `true` | 是否可清除 |
| embed | `boolean` | `false` | 是否内联模式 |

View File

@ -693,6 +693,15 @@ export const components = [
makeMarkdownRenderer
)
},
{
label: 'InputTimeRange 时间',
path: '/zh-CN/components/form/input-time-range',
getComponent: () =>
// @ts-ignore
import('../../docs/zh-CN/components/form/input-time-range.md').then(
makeMarkdownRenderer
)
},
{
label: 'Transfer 穿梭器',
path: '/zh-CN/components/form/transfer',

View File

@ -218,6 +218,7 @@ export type SchemaType =
| 'input-year'
| 'input-month'
| 'input-date-range'
| 'input-time-range'
| 'input-datetime-range'
| 'diff-editor'

View File

@ -15,7 +15,7 @@ export interface DateRangeControlSchema extends FormBaseControl {
/**
*
*/
type: 'input-date-range' | 'input-datetime-range';
type: 'input-date-range' | 'input-datetime-range' | 'input-time-range';
/**
* ,
@ -208,3 +208,18 @@ export class DateTimeRangeControlRenderer extends DateRangeControl {
inputFormat: 'YYYY-MM-DD HH:mm'
};
}
@FormItem({
type: 'input-time-range',
sizeMutable: false
})
export class TimeRangeControlRenderer extends DateRangeControl {
static defaultProps = {
...DateRangeControl.defaultProps,
format: 'HH:mm',
timeFormat: 'HH:mm',
inputFormat: 'HH:mm',
viewMode: 'time',
ranges: ''
};
}