@@ -42,7 +42,7 @@ export interface DDateInputProps extends Omit<React.HTMLAttributes<HTMLDivElemen
4242 dFormControl : DFormControl | undefined ;
4343 dModel : Date | null | [ Date , Date ] | undefined ;
4444 dFormat : string ;
45- dVisible : boolean | undefined ;
45+ dVisible : boolean ;
4646 dPlacement : 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' ;
4747 dOrder : ( date : [ Date , Date ] ) => boolean ;
4848 dPlaceholder : [ string , string ] ;
@@ -55,7 +55,7 @@ export interface DDateInputProps extends Omit<React.HTMLAttributes<HTMLDivElemen
5555 | [ DCloneHTMLElement < React . InputHTMLAttributes < HTMLInputElement > > ?, DCloneHTMLElement < React . InputHTMLAttributes < HTMLInputElement > > ?]
5656 | undefined ;
5757 onModelChange : ( ( date : any ) => void ) | undefined ;
58- onVisibleChange : ( ( visible : boolean ) => void ) | undefined ;
58+ onVisibleChange : ( visible : boolean ) => void ;
5959 onUpdatePanel : ( ( date : Date ) => void ) | undefined ;
6060 afterVisibleChange : ( ( visible : boolean ) => void ) | undefined ;
6161 onClear : ( ( ) => void ) | undefined ;
@@ -129,8 +129,6 @@ function DateInput(props: DDateInputProps, ref: React.ForwardedRef<DDateInputRef
129129 const [ t ] = useTranslation ( ) ;
130130 const forceUpdate = useForceUpdate ( ) ;
131131
132- const [ visible , changeVisible ] = useDValue < boolean > ( false , dVisible , onVisibleChange ) ;
133-
134132 const formControlInject = useFormControl ( dFormControl ) ;
135133 const [ _value , _changeValue ] = useDValue < Date | null | [ Date , Date ] > (
136134 null ,
@@ -159,7 +157,7 @@ function DateInput(props: DDateInputProps, ref: React.ForwardedRef<DDateInputRef
159157 } ) ;
160158 } else {
161159 dataRef . current . clearTid = async . setTimeout ( ( ) => {
162- changeVisible ( false ) ;
160+ onVisibleChange ( false ) ;
163161 setIsFocus ( [ false , false ] ) ;
164162 } , 20 ) ;
165163 }
@@ -202,17 +200,17 @@ function DateInput(props: DDateInputProps, ref: React.ForwardedRef<DDateInputRef
202200 forceUpdate ( ) ;
203201 } ;
204202
205- const clearable = dClearable && ! isNull ( _value ) && ! visible && ! dDisabled ;
203+ const clearable = dClearable && ! isNull ( _value ) && ! dVisible && ! dDisabled ;
206204
207- const maxZIndex = useMaxIndex ( visible ) ;
205+ const maxZIndex = useMaxIndex ( dVisible ) ;
208206
209207 const [ popupPositionStyle , setPopupPositionStyle ] = useState < React . CSSProperties > ( {
210208 top : '-200vh' ,
211209 left : '-200vw' ,
212210 } ) ;
213211 const [ transformOrigin , setTransformOrigin ] = useState < string > ( ) ;
214212 const updatePosition = useEventCallback ( ( ) => {
215- if ( visible && boxRef . current && popupRef . current ) {
213+ if ( dVisible && boxRef . current && popupRef . current ) {
216214 const height = popupRef . current . offsetHeight ;
217215 const maxWidth = window . innerWidth - WINDOW_SPACE * 2 ;
218216 const width = Math . min ( popupRef . current . scrollWidth , maxWidth ) ;
@@ -233,12 +231,12 @@ function DateInput(props: DDateInputProps, ref: React.ForwardedRef<DDateInputRef
233231 }
234232 } ) ;
235233
236- const globalScroll = useGlobalScroll ( updatePosition , ! visible ) ;
237- useEvent ( dPageScrollRef , 'scroll' , updatePosition , { passive : true } , ! visible || globalScroll ) ;
234+ const globalScroll = useGlobalScroll ( updatePosition , ! dVisible ) ;
235+ useEvent ( dPageScrollRef , 'scroll' , updatePosition , { passive : true } , ! dVisible || globalScroll ) ;
238236
239- useResize ( boxRef , updatePosition , ! visible ) ;
240- useResize ( popupRef , updatePosition , ! visible ) ;
241- useResize ( dContentResizeRef , updatePosition , ! visible ) ;
237+ useResize ( boxRef , updatePosition , ! dVisible ) ;
238+ useResize ( popupRef , updatePosition , ! dVisible ) ;
239+ useResize ( dContentResizeRef , updatePosition , ! dVisible ) ;
242240
243241 useEffect ( ( ) => {
244242 if ( boxRef . current && indicatorRef . current ) {
@@ -290,10 +288,10 @@ function DateInput(props: DDateInputProps, ref: React.ForwardedRef<DDateInputRef
290288
291289 const getInputNode = ( isLeft : boolean ) => (
292290 < DComboboxKeyboard
293- dVisible = { visible }
291+ dVisible = { dVisible }
294292 dEditable
295293 dHasSub = { false }
296- onVisibleChange = { changeVisible }
294+ onVisibleChange = { onVisibleChange }
297295 onFocusChange = { ( ) => {
298296 // Only for popup open/close
299297 } }
@@ -331,10 +329,10 @@ function DateInput(props: DDateInputProps, ref: React.ForwardedRef<DDateInputRef
331329 if ( isNull ( isLeft ? valueRight : valueLeft ) ) {
332330 dataRef . current . focusAnother = true ;
333331 } else {
334- changeVisible ( false ) ;
332+ onVisibleChange ( false ) ;
335333 }
336334 } else {
337- changeVisible ( false ) ;
335+ onVisibleChange ( false ) ;
338336 }
339337 } else {
340338 dataRef . current . inputValue [ index ] = isNull ( value ) ? '' : dayjs ( value ) . format ( dFormat ) ;
@@ -378,7 +376,7 @@ function DateInput(props: DDateInputProps, ref: React.ForwardedRef<DDateInputRef
378376 renderBaseDesign (
379377 < div
380378 { ...restProps }
381- { ...{ [ ESC_CLOSABLE_DATA ] : visible } }
379+ { ...{ [ ESC_CLOSABLE_DATA ] : dVisible } }
382380 ref = { boxRef }
383381 className = { getClassName ( restProps . className , prefix , {
384382 [ `${ prefix } --${ dSize } ` ] : dSize ,
@@ -398,7 +396,7 @@ function DateInput(props: DDateInputProps, ref: React.ForwardedRef<DDateInputRef
398396 onClick = { ( e ) => {
399397 restProps . onClick ?.( e ) ;
400398
401- changeVisible ( true ) ;
399+ onVisibleChange ( true ) ;
402400 if ( ! hasFocus ) {
403401 inputLeftRef . current ?. focus ( { preventScroll : true } ) ;
404402 }
@@ -439,7 +437,7 @@ function DateInput(props: DDateInputProps, ref: React.ForwardedRef<DDateInputRef
439437 { containerRef . current &&
440438 ReactDOM . createPortal (
441439 < DTransition
442- dIn = { visible }
440+ dIn = { dVisible }
443441 dDuring = { TTANSITION_DURING_POPUP }
444442 onEnter = { updatePosition }
445443 afterEnter = { ( ) => {
0 commit comments