1 | # TimePicker
|
2 |
|
3 | React TimePicker
|
4 |
|
5 | [![NPM version][npm-image]][npm-url]
|
6 | [![build status][travis-image]][travis-url]
|
7 | [![Test coverage][codecov-image]][codecov-url]
|
8 | [![Dependencies](https://img.shields.io/david/react-component/time-picker.svg?style=flat-square)](https://david-dm.org/react-component/time-picker)
|
9 | [![DevDependencies](https://img.shields.io/david/dev/react-component/time-picker.svg?style=flat-square)](https://david-dm.org/react-component/time-picker?type=dev)
|
10 | [![npm download][download-image]][download-url]
|
11 |
|
12 | [npm-image]: http://img.shields.io/npm/v/rc-time-picker.svg?style=flat-square
|
13 | [npm-url]: http://npmjs.org/package/rc-time-picker
|
14 | [travis-image]: https://img.shields.io/travis/react-component/time-picker.svg?style=flat-square
|
15 | [travis-url]: https://travis-ci.org/react-component/time-picker
|
16 | [codecov-image]: https://codecov.io/gh/react-component/time-picker/branch/master/graph/badge.svg
|
17 | [codecov-url]: https://codecov.io/gh/react-component/time-picker
|
18 | [download-image]: https://img.shields.io/npm/dm/rc-time-picker.svg?style=flat-square
|
19 | [download-url]: https://npmjs.org/package/rc-time-picker
|
20 |
|
21 | example
|
22 | --------
|
23 |
|
24 | http://react-component.github.io/time-picker/
|
25 |
|
26 | install
|
27 | -------
|
28 |
|
29 | ```
|
30 | npm install rc-time-picker
|
31 | ```
|
32 |
|
33 | Usage
|
34 | -----
|
35 |
|
36 | ```
|
37 | import TimePicker from 'rc-time-picker';
|
38 | import ReactDOM from 'react-dom';
|
39 | import 'rc-time-picker/assets/index.css';
|
40 | ReactDOM.render(<TimePicker />, container);
|
41 | ```
|
42 |
|
43 | API
|
44 | ---
|
45 |
|
46 | ### TimePicker
|
47 |
|
48 | | Name | Type | Default | Description |
|
49 | |-------------------------|-----------------------------------|---------|-------------|
|
50 | | prefixCls | String | 'rc-time-picker' | prefixCls of this component |
|
51 | | clearText | String | 'clear' | clear tooltip of icon |
|
52 | | disabled | Boolean | false | whether picker is disabled |
|
53 | | allowEmpty | Boolean | true | allow clearing text |
|
54 | | open | Boolean | false | current open state of picker. controlled prop |
|
55 | | defaultValue | moment | null | default initial value |
|
56 | | defaultOpenValue | moment | moment() | default open panel value, used to set utcOffset,locale if value/defaultValue absent |
|
57 | | value | moment | null | current value |
|
58 | | placeholder | String | '' | time input's placeholder |
|
59 | | className | String | '' | time picker className |
|
60 | | id | String | '' | time picker id |
|
61 | | popupClassName | String | '' | time panel className |
|
62 | | popupStyle | object | {} | customize popup style
|
63 | | showHour | Boolean | true | whether show hour | |
|
64 | | showMinute | Boolean | true | whether show minute |
|
65 | | showSecond | Boolean | true | whether show second |
|
66 | | format | String | - | moment format |
|
67 | | disabledHours | Function | - | disabled hour options |
|
68 | | disabledMinutes | Function | - | disabled minute options |
|
69 | | disabledSeconds | Function | - | disabled second options |
|
70 | | use12Hours | Boolean | false | 12 hours display mode |
|
71 | | hideDisabledOptions | Boolean | false | whether hide disabled options |
|
72 | | onChange | Function | null | called when select a different value |
|
73 | | onAmPmChange | Function | null | called when select an am/pm value |
|
74 | | addon | Function | - | called from timepicker panel to render some addon to its bottom, like an OK button. Receives panel instance as parameter, to be able to close it like `panel.close()`.|
|
75 | | placement | String | bottomLeft | one of ['topLeft', 'topRight', 'bottomLeft', 'bottomRight'] |
|
76 | | transitionName | String | '' | |
|
77 | | name | String | - | sets the name of the generated input |
|
78 | | onOpen | Function({ open }) | | when TimePicker panel is opened |
|
79 | | onClose | Function({ open }) | | when TimePicker panel is closed |
|
80 | | hourStep | Number | 1 | interval between hours in picker |
|
81 | | minuteStep | Number | 1 | interval between minutes in picker |
|
82 | | secondStep | Number | 1 | interval between seconds in picker |
|
83 | | focusOnOpen | Boolean | false | automatically focus the input when the picker opens |
|
84 | | inputReadOnly | Boolean | false | set input to read only |
|
85 | | inputIcon | ReactNode | | specific the select icon. |
|
86 | | clearIcon | ReactNode | | specific the clear icon. |
|
87 |
|
88 | ## Test Case
|
89 |
|
90 | ```
|
91 | npm test
|
92 | npm run chrome-test
|
93 | ```
|
94 |
|
95 | ## Coverage
|
96 |
|
97 | ```
|
98 | npm run coverage
|
99 | ```
|
100 |
|
101 | open coverage/ dir
|
102 |
|
103 | License
|
104 | -------
|
105 |
|
106 | rc-time-picker is released under the MIT license.
|