@@ -209,6 +209,7 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
209209 const panelDivRef = React . useRef < HTMLDivElement > ( null ) ;
210210 const startInputDivRef = React . useRef < HTMLDivElement > ( null ) ;
211211 const endInputDivRef = React . useRef < HTMLDivElement > ( null ) ;
212+ const separatorRef = React . useRef < HTMLDivElement > ( null ) ;
212213 const startInputRef = React . useRef < HTMLInputElement > ( null ) ;
213214 const endInputRef = React . useRef < HTMLInputElement > ( null ) ;
214215
@@ -707,7 +708,7 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
707708 const showDoublePanel = currentMode === picker ;
708709
709710 return (
710- < >
711+ < div className = { ` ${ prefixCls } -range-panels` } ref = { panelDivRef } >
711712 { renderPanel ( showDoublePanel ? 'left' : false , {
712713 pickerValue : viewDate ,
713714 onPickerValueChange : ( newViewDate : DateType ) => {
@@ -729,15 +730,22 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
729730 ) ;
730731 } ,
731732 } ) }
732- </ >
733+ </ div >
733734 ) ;
734735 }
735736 return renderPanel ( ) ;
736737 }
737738
739+ let arrowLeft : number = 0 ;
740+ if ( activePickerIndex && startInputDivRef . current && separatorRef . current ) {
741+ // Arrow offset
742+ arrowLeft =
743+ startInputDivRef . current . offsetWidth + separatorRef . current . offsetWidth ;
744+ }
745+
738746 const rangePanel = (
739747 < div style = { { minWidth : popupMinWidth } } >
740- < div className = { `${ prefixCls } -range-arrow` } />
748+ < div className = { `${ prefixCls } -range-arrow` } style = { { left : arrowLeft } } />
741749
742750 { renderPanels ( ) }
743751 </ div >
@@ -780,12 +788,26 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
780788 size : getInputSize ( picker , formatList [ 0 ] ) ,
781789 } ;
782790
791+ let activeBarLeft : number = 0 ;
792+ let activeBarWidth : number = 0 ;
793+ if (
794+ startInputDivRef . current &&
795+ endInputDivRef . current &&
796+ separatorRef . current
797+ ) {
798+ if ( activePickerIndex === 0 ) {
799+ activeBarWidth = startInputDivRef . current . offsetWidth ;
800+ } else {
801+ activeBarLeft = arrowLeft ;
802+ activeBarWidth = endInputDivRef . current . offsetWidth ;
803+ }
804+ }
805+
783806 return (
784807 < PanelContext . Provider
785808 value = { {
786809 operationRef,
787810 hideHeader : picker === 'time' ,
788- panelRef : panelDivRef ,
789811 onDateMouseEnter,
790812 onDateMouseLeave,
791813 } }
@@ -828,12 +850,14 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
828850 { ...inputSharedProps }
829851 />
830852 </ div >
831- { separator }
853+ < div className = { `${ prefixCls } -range-separator` } ref = { separatorRef } >
854+ { separator }
855+ </ div >
832856 < div
833857 className = { classNames ( `${ prefixCls } -input` , {
834858 [ `${ prefixCls } -input-active` ] : activePickerIndex === 1 ,
835859 } ) }
836- ref = { startInputDivRef }
860+ ref = { endInputDivRef }
837861 >
838862 < input
839863 disabled = { mergedDisabled [ 1 ] }
@@ -846,6 +870,14 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
846870 { ...inputSharedProps }
847871 />
848872 </ div >
873+ < div
874+ className = { `${ prefixCls } -active-bar` }
875+ style = { {
876+ left : activeBarLeft ,
877+ width : activeBarWidth ,
878+ position : 'absolute' ,
879+ } }
880+ />
849881 { suffixNode }
850882 { clearNode }
851883 </ div >
0 commit comments