1
- import { warning } from 'rc-util' ;
2
- import pickAttrs from 'rc-util/lib/pickAttrs' ;
1
+ import { warning } from '@ rc-component/ util' ;
2
+ import pickAttrs from '@ rc-component/ util/lib/pickAttrs' ;
3
3
import * as React from 'react' ;
4
4
import type { SelectorProps } from '../../../interface' ;
5
5
import { formatValue } from '../../../utils/dateUtil' ;
@@ -86,12 +86,7 @@ export default function useInputProps<DateType extends object = any>(
86
86
const firstFormat = format [ 0 ] ;
87
87
88
88
const getText = React . useCallback (
89
- ( date : DateType ) =>
90
- formatValue ( date , {
91
- locale,
92
- format : firstFormat ,
93
- generateConfig,
94
- } ) ,
89
+ ( date : DateType ) => formatValue ( date , { locale, format : firstFormat , generateConfig } ) ,
95
90
[ locale , generateConfig , firstFormat ] ,
96
91
) ;
97
92
@@ -131,10 +126,7 @@ export default function useInputProps<DateType extends object = any>(
131
126
return index !== undefined ? propValue [ index ] : propValue ;
132
127
}
133
128
134
- const pickedAttrs = pickAttrs ( props , {
135
- aria : true ,
136
- data : true ,
137
- } ) ;
129
+ const pickedAttrs = pickAttrs ( props , { aria : true , data : true } ) ;
138
130
139
131
const inputProps = {
140
132
...pickedAttrs ,
@@ -198,9 +190,7 @@ export default function useInputProps<DateType extends object = any>(
198
190
onInvalid ( ! ! text , index ) ;
199
191
} ,
200
192
onHelp : ( ) => {
201
- onOpenChange ( true , {
202
- index,
203
- } ) ;
193
+ onOpenChange ( true , { index } ) ;
204
194
} ,
205
195
onKeyDown : ( event : React . KeyboardEvent < HTMLDivElement > ) => {
206
196
let prevented = false ;
@@ -218,9 +208,7 @@ export default function useInputProps<DateType extends object = any>(
218
208
if ( ! event . defaultPrevented && ! prevented ) {
219
209
switch ( event . key ) {
220
210
case 'Escape' :
221
- onOpenChange ( false , {
222
- index,
223
- } ) ;
211
+ onOpenChange ( false , { index } ) ;
224
212
break ;
225
213
case 'Enter' :
226
214
if ( ! open ) {
@@ -232,9 +220,7 @@ export default function useInputProps<DateType extends object = any>(
232
220
} ,
233
221
234
222
// ============ Post Props ============
235
- ...postProps ?.( {
236
- valueTexts,
237
- } ) ,
223
+ ...postProps ?.( { valueTexts } ) ,
238
224
} ;
239
225
240
226
// ============== Clean Up ==============
0 commit comments