File tree Expand file tree Collapse file tree 4 files changed +21
-0
lines changed Expand file tree Collapse file tree 4 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ export interface PickerSharedProps<DateType> extends React.AriaAttributes {
4949 defaultOpen ?: boolean ;
5050 /** Make input readOnly to avoid popup keyboard in mobile */
5151 inputReadOnly ?: boolean ;
52+ id ?: string ;
5253
5354 // Value
5455 format ?: string | string [ ] ;
@@ -127,6 +128,7 @@ interface MergedPickerProps<DateType>
127128function InnerPicker < DateType > ( props : PickerProps < DateType > ) {
128129 const {
129130 prefixCls = 'rc-picker' ,
131+ id,
130132 style,
131133 className,
132134 dropdownClassName,
@@ -463,6 +465,7 @@ function InnerPicker<DateType>(props: PickerProps<DateType>) {
463465 >
464466 < div className = { `${ prefixCls } -input` } ref = { inputDivRef } >
465467 < input
468+ id = { id }
466469 disabled = { disabled }
467470 readOnly = { inputReadOnly || ! typing }
468471 value = { text }
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ function canValueTrigger<DateType>(
5555}
5656
5757export interface RangePickerSharedProps < DateType > {
58+ id ?: string ;
5859 value ?: RangeValue < DateType > ;
5960 defaultValue ?: RangeValue < DateType > ;
6061 defaultPickerValue ?: [ DateType , DateType ] ;
@@ -136,6 +137,7 @@ interface MergedRangePickerProps<DateType>
136137function InnerRangePicker < DateType > ( props : RangePickerProps < DateType > ) {
137138 const {
138139 prefixCls = 'rc-picker' ,
140+ id,
139141 style,
140142 className,
141143 popupStyle,
@@ -887,6 +889,7 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
887889 ref = { startInputDivRef }
888890 >
889891 < input
892+ id = { id }
890893 disabled = { mergedDisabled [ 0 ] }
891894 readOnly = { inputReadOnly || ! startTyping }
892895 value = { startText }
Original file line number Diff line number Diff line change @@ -612,4 +612,9 @@ describe('Picker.Basic', () => {
612612 expect ( wrapper . find ( 'input' ) . props ( ) . value ) . toEqual ( text ) ;
613613 } ) ;
614614 } ) ;
615+
616+ it ( 'id' , ( ) => {
617+ const wrapper = mount ( < MomentPicker id = "light" /> ) ;
618+ expect ( wrapper . find ( 'input' ) . props ( ) . id ) . toEqual ( 'light' ) ;
619+ } ) ;
615620} ) ;
Original file line number Diff line number Diff line change @@ -1036,4 +1036,14 @@ describe('Picker.Range', () => {
10361036 testOrderOnTime ( false , '23:00:00' , '02:00:00' ) ;
10371037 testOrderOnTime ( true , '02:00:00' , '23:00:00' ) ;
10381038 } ) ;
1039+
1040+ it ( 'id' , ( ) => {
1041+ const wrapper = mount ( < MomentRangePicker id = "bamboo" /> ) ;
1042+ expect (
1043+ wrapper
1044+ . find ( 'input' )
1045+ . first ( )
1046+ . props ( ) . id ,
1047+ ) . toEqual ( 'bamboo' ) ;
1048+ } ) ;
10391049} ) ;
You can’t perform that action at this time.
0 commit comments