Browse Source

Merge branch 'freestyle21-develop-1.0.0' into develop-1.0.0

pull/1434/head
afc163 9 years ago
parent
commit
5f15195c14
  1. 2
      components/date-picker/demo/time.md
  2. 3
      components/date-picker/index.md
  3. 12
      components/date-picker/wrapPicker.jsx

2
components/date-picker/demo/time.md

@ -3,7 +3,7 @@ order: 4
title: 日期时间选择
---
增加选择时间功能。不要修改时间的格式 `HH:mm:ss`
增加选择时间功能,当 `showTime` 为一个对象时,其属性会传递给内建的 `TimePicker`
````jsx
import { DatePicker } from 'antd';

3
components/date-picker/index.md

@ -34,9 +34,9 @@ english: DatePicker
| popupStyle | 格外的弹出日历样式 | object | {} |
| size | 输入框大小,`large` 高度为 32px,`small` 为 22px,默认是 28px | string | 无 |
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/issues/424) |
| showTime | 增加时间选择功能 | bool | false |
| onOk | 点击确定按钮的回调 | function(Date value) | 无 |
| getCalendarContainer | 定义浮层的容器,默认为 body 上新建 div | function(trigger) | 无 |
| showTime | 增加时间选择功能 | Object or Boolean | [TimePicker Options](http://ant.design/components/time-picker/#api) |
### MonthPicker
@ -61,6 +61,7 @@ english: DatePicker
| defaultValue | 默认日期 | [string/Date, string/Date] | 无 |
| format | 展示的日期格式 | string | "yyyy-MM-dd HH:mm:ss" |
| onChange | 时间发生变化的回调,发生在用户选择时间时 | function(date[], dateString[]) | 无 |
| showTime | 增加时间选择功能 | Object or Boolean | [TimePicker Options](http://ant.design/components/time-picker/#api) |
`disabled` `style` `popupStyle` `size` `locale` `showTime` `onOk` `getCalendarContainer` 属性与 DatePicker 的一致。

12
components/date-picker/wrapPicker.jsx

@ -94,12 +94,22 @@ export default function wrapPicker(Picker, defaultFormat) {
});
const locale = this.getLocale();
const timeFormat = props.showTime && props.showTime.format;
const rcTimePickerProps = {
formatter: new DateTimeFormat(timeFormat || 'HH:mm:ss'),
showSecond: timeFormat && timeFormat.indexOf('ss') >= 0,
showHour: timeFormat && timeFormat.indexOf('HH') >= 0
};
const timePicker = props.showTime ? (
<TimePicker
{...rcTimePickerProps}
{...props.showTime}
prefixCls="ant-time-picker"
placeholder={locale.timePickerLocale.placeholder}
locale={locale.timePickerLocale}
transitionName="slide-up" />
transitionName="slide-up"
/>
) : null;
return (

Loading…
Cancel
Save