@@ -30,12 +30,15 @@ class Combobox extends Component {
3030 showHour : PropTypes . bool ,
3131 showMinute : PropTypes . bool ,
3232 showSecond : PropTypes . bool ,
33+ showMillisecond : PropTypes . bool ,
3334 hourOptions : PropTypes . array ,
3435 minuteOptions : PropTypes . array ,
3536 secondOptions : PropTypes . array ,
37+ millisecondOptions : PropTypes . array ,
3638 disabledHours : PropTypes . func ,
3739 disabledMinutes : PropTypes . func ,
3840 disabledSeconds : PropTypes . func ,
41+ disabledMilliseconds : PropTypes . func ,
3942 onCurrentSelectPanelChange : PropTypes . func ,
4043 use12Hours : PropTypes . bool ,
4144 isAM : PropTypes . bool ,
@@ -78,8 +81,11 @@ class Combobox extends Component {
7881 }
7982 }
8083 onAmPmChange ( ampm ) ;
81- } else {
84+ } else if ( type === 'second' ) {
8285 value . second ( + itemValue ) ;
86+ } else {
87+ itemValue += '0' ;
88+ value . millisecond ( + itemValue ) ;
8389 }
8490 onChange ( value ) ;
8591 } ;
@@ -171,6 +177,33 @@ class Combobox extends Component {
171177 ) ;
172178 }
173179
180+ getMillisecondSelect ( millisecond ) {
181+ const {
182+ prefixCls,
183+ millisecondOptions,
184+ disabledMilliseconds,
185+ showMillisecond,
186+ defaultOpenValue,
187+ value : propValue ,
188+ } = this . props ;
189+ if ( ! showMillisecond ) {
190+ return null ;
191+ }
192+ const value = propValue || defaultOpenValue ;
193+ const disabledOptions = disabledMilliseconds ( value . hour ( ) , value . minute ( ) , value . second ( ) ) ;
194+
195+ return (
196+ < Select
197+ prefixCls = { prefixCls }
198+ options = { millisecondOptions . map ( option => formatOption ( option , disabledOptions ) ) }
199+ selectedIndex = { millisecondOptions . indexOf ( Math . floor ( millisecond / 10 ) ) }
200+ type = "millisecond"
201+ onSelect = { this . onItemChange }
202+ onMouseEnter = { ( ) => this . onEnterSelectPanel ( 'millisecond' ) }
203+ />
204+ ) ;
205+ }
206+
174207 getAMPMSelect ( ) {
175208 const { prefixCls, use12Hours, format, isAM } = this . props ;
176209 if ( ! use12Hours ) {
@@ -203,6 +236,7 @@ class Combobox extends Component {
203236 { this . getHourSelect ( value . hour ( ) ) }
204237 { this . getMinuteSelect ( value . minute ( ) ) }
205238 { this . getSecondSelect ( value . second ( ) ) }
239+ { this . getMillisecondSelect ( value . millisecond ( ) ) }
206240 { this . getAMPMSelect ( value . hour ( ) ) }
207241 </ div >
208242 ) ;
0 commit comments