@@ -19,6 +19,7 @@ import TimePickerPanel from './panel/TimePickerPanel';
1919import type { FC } from 'react' ;
2020import type { StyledProps } from '../common' ;
2121import type { RangeInputPopupProps , RangeInputPosition } from '../range-input' ;
22+ import type { TimePickerPanelProps } from './panel/TimePickerPanel' ;
2223import type { TdTimeRangePickerProps , TimeRangePickerPartial , TimeRangeValue } from './type' ;
2324
2425export interface TimeRangePickerProps extends TdTimeRangePickerProps , StyledProps { }
@@ -57,7 +58,7 @@ const TimeRangePicker: FC<TimeRangePickerProps> = (originalProps) => {
5758 const { TimeIcon } = useGlobalIcon ( {
5859 TimeIcon : TdTimeIcon ,
5960 } ) ;
60- const [ isPanelShowed , setPanelShow ] = useState ( false ) ;
61+ const [ isPanelShowed , setIsPanelShowed ] = useState ( false ) ;
6162 const [ currentPanelIdx , setCurrentPanelIdx ] = useState ( undefined ) ;
6263 const [ currentValue , setCurrentValue ] = useState ( [ '' , '' ] ) ;
6364
@@ -69,10 +70,10 @@ const TimeRangePicker: FC<TimeRangePickerProps> = (originalProps) => {
6970
7071 const handleShowPopup : RangeInputPopupProps [ 'onPopupVisibleChange' ] = ( visible , { trigger } ) => {
7172 if ( trigger === 'trigger-element-click' ) {
72- setPanelShow ( true ) ;
73+ setIsPanelShowed ( true ) ;
7374 return ;
7475 }
75- setPanelShow ( visible ) ;
76+ setIsPanelShowed ( visible ) ;
7677 } ;
7778
7879 function handlePickerValue ( pickValue : string | string [ ] , currentValue : string [ ] ) {
@@ -105,10 +106,10 @@ const TimeRangePicker: FC<TimeRangePickerProps> = (originalProps) => {
105106 setCurrentPanelIdx ( position === 'first' ? 0 : 1 ) ;
106107 } ;
107108
108- const handleTimeChange = ( newValue : string | string [ ] , context : { e : React . MouseEvent } ) => {
109+ const handleTimeChange = ( newValue : string | string [ ] , e ?: MouseEvent | UIEvent ) => {
109110 const nextCurrentValue = handlePickerValue ( newValue , currentValue ) ;
110111 setCurrentValue ( nextCurrentValue ) ;
111- handleOnPick ( nextCurrentValue , context ) ;
112+ handleOnPick ( nextCurrentValue , { e : e as unknown as React . MouseEvent } ) ;
112113 } ;
113114
114115 const autoSwapTime = ( valueBeforeConfirm : Array < string > ) => {
@@ -145,7 +146,7 @@ const TimeRangePicker: FC<TimeRangePickerProps> = (originalProps) => {
145146 const handleClickConfirm = ( ) => {
146147 const isValidTime = ! currentValue . find ( ( v ) => ! validateInputValue ( v , format ) ) ;
147148 if ( isValidTime ) onChange ( props . autoSwap ? autoSwapTime ( currentValue ) : currentValue ) ;
148- setPanelShow ( false ) ;
149+ setIsPanelShowed ( false ) ;
149150 } ;
150151
151152 const handleFocus = (
@@ -206,7 +207,7 @@ const TimeRangePicker: FC<TimeRangePickerProps> = (originalProps) => {
206207 hideDisabledTime = { hideDisabledTime }
207208 isFooterDisplay = { true }
208209 value = { currentValue [ currentPanelIdx || 0 ] }
209- onChange = { handleTimeChange }
210+ onChange = { handleTimeChange as TimePickerPanelProps [ 'onChange' ] }
210211 handleConfirmClick = { handleClickConfirm }
211212 position = { currentPanelIdx === 0 ? 'start' : 'end' }
212213 activeIndex = { currentPanelIdx }
0 commit comments