25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

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