@@ -59,7 +59,6 @@ function reorderValues<DateType>(
5959function canValueTrigger < DateType > (
6060 value : EventValue < DateType > ,
6161 index : number ,
62- disabledList : [ boolean , boolean ] ,
6362 allowEmpty ?: [ boolean , boolean ] | null ,
6463) : boolean {
6564 if ( value ) {
@@ -105,6 +104,11 @@ export interface RangePickerSharedProps<DateType> {
105104 ) => void ;
106105 onFocus ?: React . FocusEventHandler < HTMLInputElement > ;
107106 onBlur ?: React . FocusEventHandler < HTMLInputElement > ;
107+
108+ /** @private Internal usage. Do not use in your production env */
109+ components ?: {
110+ button : React . ComponentType ;
111+ } ;
108112}
109113
110114type OmitPickerProps < Props > = Omit <
@@ -202,6 +206,7 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
202206 onCalendarChange,
203207 onFocus,
204208 onBlur,
209+ components,
205210 } = props as MergedRangePickerProps < DateType > ;
206211
207212 const containerRef = React . useRef < HTMLDivElement > ( null ) ;
@@ -415,18 +420,8 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
415420 onCalendarChange ( values , [ startStr , endStr ] ) ;
416421 }
417422
418- const canStartValueTrigger = canValueTrigger (
419- startValue ,
420- 0 ,
421- mergedDisabled ,
422- allowEmpty ,
423- ) ;
424- const canEndValueTrigger = canValueTrigger (
425- endValue ,
426- 1 ,
427- mergedDisabled ,
428- allowEmpty ,
429- ) ;
423+ const canStartValueTrigger = canValueTrigger ( startValue , 0 , allowEmpty ) ;
424+ const canEndValueTrigger = canValueTrigger ( endValue , 1 , allowEmpty ) ;
430425
431426 const canTrigger =
432427 values === null || ( canStartValueTrigger && canEndValueTrigger ) ;
@@ -485,7 +480,16 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
485480 // Let popup panel handle keyboard
486481 return operationRef . current . onKeyDown ( e ) ;
487482 }
488- return false ;
483+
484+ /* istanbul ignore next */
485+ /* eslint-disable no-lone-blocks */
486+ {
487+ warning (
488+ false ,
489+ 'Picker not correct forward KeyDown operation. Please help to fire issue about this.' ,
490+ ) ;
491+ return false ;
492+ }
489493 } ;
490494
491495 // ============================= Text ==============================
@@ -803,13 +807,15 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
803807 }
804808
805809 let rangesNode : React . ReactNode ;
806- if ( ranges ) {
807- const rangeList = Object . keys ( ranges ) ;
810+ if ( ranges || showTime ) {
811+ const mergedRanges = ranges || { } ;
812+ const rangeList = Object . keys ( mergedRanges ) ;
813+ const Button = ( components && components . button ) || 'button' ;
808814
809815 rangesNode = (
810816 < ul className = { `${ prefixCls } -ranges` } >
811817 { rangeList . map ( label => {
812- const range = ranges [ label ] ;
818+ const range = mergedRanges [ label ] ;
813819
814820 return (
815821 < li
@@ -823,6 +829,19 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
823829 </ li >
824830 ) ;
825831 } ) }
832+
833+ { showTime && (
834+ < li
835+ className = { `${ prefixCls } -ok` }
836+ onClick = { ( ) => {
837+ triggerChange ( selectedValue ) ;
838+ } }
839+ >
840+ < Button disabled = { ! getValue ( selectedValue , activePickerIndex ) } >
841+ { locale . ok }
842+ </ Button >
843+ </ li >
844+ ) }
826845 </ ul >
827846 ) ;
828847 }
@@ -854,6 +873,7 @@ function InnerRangePicker<DateType>(props: RangePickerProps<DateType>) {
854873 </ div >
855874 ) ;
856875
876+ // ============================= Icons =============================
857877 let suffixNode : React . ReactNode ;
858878 if ( suffixIcon ) {
859879 suffixNode = < span className = { `${ prefixCls } -suffix` } > { suffixIcon } </ span > ;
0 commit comments