@@ -3,7 +3,6 @@ import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
3
3
import omit from 'rc-util/lib/omit' ;
4
4
import pickAttrs from 'rc-util/lib/pickAttrs' ;
5
5
import * as React from 'react' ;
6
- import useLocale from '../hooks/useLocale' ;
7
6
import useTimeConfig from '../hooks/useTimeConfig' ;
8
7
import type {
9
8
BaseInfo ,
@@ -22,6 +21,7 @@ import PickerContext from './context';
22
21
import useCellRender from './hooks/useCellRender' ;
23
22
import useDisabledBoundary from './hooks/useDisabledBoundary' ;
24
23
import { useFieldFormat } from './hooks/useFieldFormat' ;
24
+ import useFilledProps from './hooks/useFilledProps' ;
25
25
import useRangeValue , { useInnerValue } from './hooks/useFlexibleValue' ;
26
26
import useInputReadOnly from './hooks/useInputReadOnly' ;
27
27
import useInvalidate from './hooks/useInvalidate' ;
@@ -101,11 +101,14 @@ function Picker<DateType extends object = any>(
101
101
props : PickerProps < DateType > ,
102
102
ref : React . Ref < PickerRef > ,
103
103
) {
104
+ // ========================= Prop =========================
105
+ const filledProps = useFilledProps ( props ) ;
106
+
104
107
const {
105
108
// Style
106
- prefixCls = 'rc-picker' ,
107
- styles = { } ,
108
- classNames = { } ,
109
+ prefixCls,
110
+ styles,
111
+ classNames,
109
112
110
113
// Value
111
114
defaultValue,
@@ -128,7 +131,7 @@ function Picker<DateType extends object = any>(
128
131
// Picker
129
132
locale,
130
133
generateConfig,
131
- picker = 'date' ,
134
+ picker,
132
135
showNow,
133
136
showToday,
134
137
@@ -164,34 +167,21 @@ function Picker<DateType extends object = any>(
164
167
clearIcon,
165
168
166
169
// Render
167
- components = { } ,
170
+ components,
168
171
cellRender,
169
172
dateRender,
170
173
monthCellRender,
171
174
172
175
// Native
173
176
onClick,
174
- } = props ;
177
+ } = filledProps ;
175
178
176
179
// ========================= Refs =========================
177
180
const selectorRef = usePickerRef ( ref ) ;
178
181
179
- // ======================== Locale ========================
180
- const filledLocale = useLocale ( locale ) ;
181
-
182
182
// ========================= Icon =========================
183
183
const mergedClearIcon = useClearIcon ( prefixCls , allowClear , clearIcon ) ;
184
184
185
- // ========================= Prop =========================
186
- const filledProps = React . useMemo (
187
- ( ) => ( {
188
- ...props ,
189
- locale : filledLocale ,
190
- picker,
191
- } ) ,
192
- [ props ] ,
193
- ) ;
194
-
195
185
// ======================= ShowTime =======================
196
186
const mergedShowTime = useTimeConfig ( filledProps ) ;
197
187
@@ -209,7 +199,7 @@ function Picker<DateType extends object = any>(
209
199
const mergedNeedConfirm = needConfirm ?? complexPicker ;
210
200
211
201
// ======================== Format ========================
212
- const [ formatList , maskFormat ] = useFieldFormat ( internalPicker , filledLocale , format ) ;
202
+ const [ formatList , maskFormat ] = useFieldFormat ( internalPicker , locale , format ) ;
213
203
214
204
// ======================== Values ========================
215
205
const [ mergedValue , setInnerValue , getCalendarValue , triggerCalendarChange ] = useInnerValue (
@@ -345,7 +335,7 @@ function Picker<DateType extends object = any>(
345
335
// ===================== Picker Value =====================
346
336
const [ currentPickerValue , setCurrentPickerValue ] = useRangePickerValue (
347
337
generateConfig ,
348
- filledLocale ,
338
+ locale ,
349
339
calendarValue ,
350
340
mergedOpen ,
351
341
activeIndex ,
@@ -613,12 +603,12 @@ function Picker<DateType extends object = any>(
613
603
const context = React . useMemo (
614
604
( ) => ( {
615
605
prefixCls,
616
- locale : filledLocale ,
606
+ locale,
617
607
generateConfig,
618
608
button : components . button ,
619
609
input : components . input ,
620
610
} ) ,
621
- [ prefixCls , filledLocale , generateConfig , components . button , components . input ] ,
611
+ [ prefixCls , locale , generateConfig , components . button , components . input ] ,
622
612
) ;
623
613
624
614
// ======================== Effect ========================
0 commit comments