From 00710328b1ddaea3ea861cbb1eebb8681d195d0c Mon Sep 17 00:00:00 2001 From: bang Date: Sat, 9 Jul 2016 10:52:58 +0800 Subject: [PATCH] update timepicker --- components/index.tsx | 3 +++ components/time-picker/index.tsx | 34 +++++++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/components/index.tsx b/components/index.tsx index 9a078bd471..161a518236 100644 --- a/components/index.tsx +++ b/components/index.tsx @@ -23,3 +23,6 @@ export { Tabs } import Tag from './tag'; export { Tag } + +import TimePicker from './time-picker'; +export { TimePicker } diff --git a/components/time-picker/index.tsx b/components/time-picker/index.tsx index 490c27075f..45ec32fd0e 100644 --- a/components/time-picker/index.tsx +++ b/components/time-picker/index.tsx @@ -5,7 +5,35 @@ import defaultLocale from './locale/zh_CN'; import classNames from 'classnames'; import GregorianCalendar from 'gregorian-calendar'; import assign from 'object-assign'; -export default class TimePicker extends React.Component { + +// TimePicker +export interface TimePickerProps { + /** 默认时间*/ + value?: string | Date, + /** 初始默认时间*/ + defaultValue?: string | Date, + /** 展示的时间格式 : "HH:mm:ss"、"HH:mm"、"mm:ss" */ + format?: string, + /** 时间发生变化的回调*/ + onChange?: (Date: Date) => void, + /** 禁用全部操作*/ + disabled?: boolean, + /** 没有值的时候显示的内容*/ + placeholder?: string, + /** 国际化配置*/ + locale?: Object, + /** 隐藏禁止选择的选项*/ + hideDisabledOptions?: boolean, + /** 禁止选择部分小时选项*/ + disabledHours?: Function, + /** 禁止选择部分分钟选项*/ + disabledMinutes?: Function, + /** 禁止选择部分秒选项*/ + disabledSeconds?: Function, + + style?: React.CSSProperties +} +export default class TimePicker extends React.Component { static defaultProps = { format: 'HH:mm:ss', prefixCls: 'ant-time-picker', @@ -109,9 +137,9 @@ export default class TimePicker extends React.Component { {...props} className={className} locale={locale} - formatter={this.getFormatter()} + formatter={this.getFormatter() } onChange={this.handleChange} - /> + /> ); } }