@@ -30,12 +30,15 @@ class Combobox extends Component {
30
30
showHour : PropTypes . bool ,
31
31
showMinute : PropTypes . bool ,
32
32
showSecond : PropTypes . bool ,
33
+ showMillisecond : PropTypes . bool ,
33
34
hourOptions : PropTypes . array ,
34
35
minuteOptions : PropTypes . array ,
35
36
secondOptions : PropTypes . array ,
37
+ millisecondOptions : PropTypes . array ,
36
38
disabledHours : PropTypes . func ,
37
39
disabledMinutes : PropTypes . func ,
38
40
disabledSeconds : PropTypes . func ,
41
+ disabledMilliseconds : PropTypes . func ,
39
42
onCurrentSelectPanelChange : PropTypes . func ,
40
43
use12Hours : PropTypes . bool ,
41
44
isAM : PropTypes . bool ,
@@ -78,8 +81,11 @@ class Combobox extends Component {
78
81
}
79
82
}
80
83
onAmPmChange ( ampm ) ;
81
- } else {
84
+ } else if ( type === 'second' ) {
82
85
value . second ( + itemValue ) ;
86
+ } else {
87
+ itemValue += '0' ;
88
+ value . millisecond ( + itemValue ) ;
83
89
}
84
90
onChange ( value ) ;
85
91
} ;
@@ -171,6 +177,33 @@ class Combobox extends Component {
171
177
) ;
172
178
}
173
179
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
+
174
207
getAMPMSelect ( ) {
175
208
const { prefixCls, use12Hours, format, isAM } = this . props ;
176
209
if ( ! use12Hours ) {
@@ -203,6 +236,7 @@ class Combobox extends Component {
203
236
{ this . getHourSelect ( value . hour ( ) ) }
204
237
{ this . getMinuteSelect ( value . minute ( ) ) }
205
238
{ this . getSecondSelect ( value . second ( ) ) }
239
+ { this . getMillisecondSelect ( value . millisecond ( ) ) }
206
240
{ this . getAMPMSelect ( value . hour ( ) ) }
207
241
</ div >
208
242
) ;
0 commit comments