File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -470,7 +470,7 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
470470 if (
471471 nextOpenIndex !== null &&
472472 nextOpenIndex !== mergedActivePickerIndex &&
473- ! openRecordsRef . current [ nextOpenIndex ] &&
473+ ( ! openRecordsRef . current [ nextOpenIndex ] || ! getValue ( values , nextOpenIndex ) ) &&
474474 getValue ( values , sourceIndex )
475475 ) {
476476 // Delay to focus to avoid input blur trigger expired selectedValues
Original file line number Diff line number Diff line change @@ -1696,4 +1696,40 @@ describe('Picker.Range', () => {
16961696 ) . toEqual ( '2020-07-24 06:00:00' ) ;
16971697 expect ( wrapper . find ( '.rc-picker-ok button' ) . props ( ) . disabled ) . toBeTruthy ( ) ;
16981698 } ) ;
1699+
1700+ // https://github.com/ant-design/ant-design/issues/26024
1701+ it ( 'panel should keep open when nextValue is empty' , ( ) => {
1702+ const wrapper = mount ( < MomentRangePicker /> ) ;
1703+
1704+ wrapper . openPicker ( 0 ) ;
1705+
1706+ wrapper . selectCell ( 7 , 0 ) ;
1707+ expect (
1708+ wrapper
1709+ . find ( 'input' )
1710+ . first ( )
1711+ . prop ( 'value' ) ,
1712+ ) . toBe ( '1990-09-07' ) ;
1713+
1714+ // back to first panel and clear input value
1715+ wrapper
1716+ . find ( 'input' )
1717+ . first ( )
1718+ . simulate ( 'focus' ) ;
1719+ wrapper . inputValue ( '' , 0 ) ;
1720+
1721+ // reselect date
1722+ wrapper . selectCell ( 9 , 0 ) ;
1723+ expect (
1724+ wrapper
1725+ . find ( 'input' )
1726+ . first ( )
1727+ . prop ( 'value' ) ,
1728+ ) . toBe ( '1990-09-09' ) ;
1729+
1730+ // end date
1731+ wrapper . selectCell ( 9 , 1 ) ;
1732+
1733+ matchValues ( wrapper , '1990-09-09' , '1990-10-09' ) ;
1734+ } ) ;
16991735} ) ;
You can’t perform that action at this time.
0 commit comments