@@ -4,7 +4,7 @@ import type { DFormControl } from '../form';
44import type { DTimePickerProps } from '../time-picker' ;
55import type { DPanelPrivateProps as DTimePickerPanelPrivateProps } from '../time-picker/Panel' ;
66
7- import { isBoolean , isUndefined } from 'lodash' ;
7+ import { isArray , isBoolean , isUndefined } from 'lodash' ;
88import React , { useRef } from 'react' ;
99
1010import { CalendarOutlined } from '@react-devui/icons' ;
@@ -139,7 +139,7 @@ function DatePicker(props: DDatePickerProps, ref: React.ForwardedRef<DDateInputR
139139 afterVisibleChange = { afterVisibleChange }
140140 onClear = { onClear }
141141 >
142- { ( { date, isFocus, changeDate, renderPopup } ) => {
142+ { ( { date, isFocus, changeDate, enter , renderPopup } ) => {
143143 const index = isFocus [ 0 ] ? 0 : 1 ;
144144 const position = isFocus [ 0 ] ? 'start' : 'end' ;
145145
@@ -152,9 +152,8 @@ function DatePicker(props: DDatePickerProps, ref: React.ForwardedRef<DDateInputR
152152 dConfigDate = { dConfigDate ? ( ...args ) => dConfigDate ( ...args , position , date ) : undefined }
153153 onDateChange = { ( date ) => {
154154 changeDate ( date ) ;
155-
156155 if ( ! dShowTime ) {
157- changeVisible ( false ) ;
156+ enter ( ) ;
158157 }
159158 } }
160159 > </ DPanel >
@@ -182,10 +181,13 @@ function DatePicker(props: DDatePickerProps, ref: React.ForwardedRef<DDateInputR
182181 const handleClick = ( ) => {
183182 const d = dPresetDate [ name ] ( ) ;
184183 changeDate ( d ) ;
184+ if ( dRange && isArray ( d ) ) {
185+ changeVisible ( false ) ;
186+ } else {
187+ enter ( ) ;
188+ }
185189 updatePanelRef . current ?.( d [ index ] ) ;
186190 updateTimePickerPanelRef . current ?.( d [ index ] ) ;
187-
188- changeVisible ( false ) ;
189191 } ;
190192
191193 return (
@@ -205,10 +207,9 @@ function DatePicker(props: DDatePickerProps, ref: React.ForwardedRef<DDateInputR
205207 onClick = { ( ) => {
206208 const now = new Date ( ) ;
207209 changeDate ( now ) ;
210+ enter ( ) ;
208211 updatePanelRef . current ?.( now ) ;
209212 updateTimePickerPanelRef . current ?.( now ) ;
210-
211- changeVisible ( false ) ;
212213 } }
213214 dType = "link"
214215 >
0 commit comments