@@ -17,6 +17,7 @@ import { commonProps, datePickerProps } from './props';
1717import devWarning from '../../vc-util/devWarning' ;
1818import { FormItemInputContext , useInjectFormItemContext } from '../../form/FormItemContext' ;
1919import { getMergedStatus , getStatusClassNames } from '../../_util/statusUtils' ;
20+ import { useCompactItemContext } from '../../space/Compact' ;
2021
2122//CSSINJS
2223import useStyle from '../style' ;
@@ -55,22 +56,36 @@ export default function generateSinglePicker<DateType, ExtraProps = {}>(
5556 ExtraProps ;
5657 const formItemContext = useInjectFormItemContext ( ) ;
5758 const formItemInputContext = FormItemInputContext . useInject ( ) ;
58- devWarning (
59- ! ( props . monthCellContentRender || slots . monthCellContentRender ) ,
60- 'DatePicker' ,
61- '`monthCellContentRender` is deprecated. Please use `monthCellRender"` instead.' ,
62- ) ;
59+ // =================== Warning =====================
60+ if ( process . env . NODE_ENV !== 'production' ) {
61+ devWarning (
62+ picker !== 'quarter' ,
63+ displayName || 'DatePicker' ,
64+ `DatePicker.${ displayName } is legacy usage. Please use DatePicker[picker='${ picker } '] directly.` ,
65+ ) ;
6366
64- devWarning (
65- ! attrs . getCalendarContainer ,
66- 'DatePicker' ,
67- '`getCalendarContainer` is deprecated. Please use `getPopupContainer"` instead.' ,
68- ) ;
69- const { prefixCls, direction, getPopupContainer, size, rootPrefixCls } = useConfigInject (
70- 'picker' ,
71- props ,
72- ) ;
67+ devWarning (
68+ ! props . dropdownClassName ,
69+ displayName || 'DatePicker' ,
70+ '`dropdownClassName` is deprecated. Please use `popupClassName` instead.' ,
71+ ) ;
72+ devWarning (
73+ ! ( props . monthCellContentRender || slots . monthCellContentRender ) ,
74+ displayName || 'DatePicker' ,
75+ '`monthCellContentRender` is deprecated. Please use `monthCellRender"` instead.' ,
76+ ) ;
7377
78+ devWarning (
79+ ! attrs . getCalendarContainer ,
80+ displayName || 'DatePicker' ,
81+ '`getCalendarContainer` is deprecated. Please use `getPopupContainer"` instead.' ,
82+ ) ;
83+ }
84+
85+ const { prefixCls, direction, getPopupContainer, size, rootPrefixCls, disabled } =
86+ useConfigInject ( 'picker' , props ) ;
87+ const { compactSize, compactItemClassnames } = useCompactItemContext ( prefixCls , direction ) ;
88+ const mergedSize = computed ( ( ) => compactSize . value || size . value ) ;
7489 // style
7590 const [ wrapSSR , hashId ] = useStyle ( prefixCls ) ;
7691
@@ -198,7 +213,7 @@ export default function generateSinglePicker<DateType, ExtraProps = {}>(
198213 dateRender = { dateRender }
199214 renderExtraFooter = { renderExtraFooter }
200215 ref = { pickerRef }
201- placeholder = { getPlaceholder ( mergedPicker , locale , placeholder ) }
216+ placeholder = { getPlaceholder ( locale , mergedPicker , placeholder ) }
202217 suffixIcon = { suffixNode }
203218 dropdownAlign = { transPlacement2DropdownAlign ( direction . value , props . placement ) }
204219 clearIcon = { clearIcon || < CloseCircleFilled /> }
@@ -215,7 +230,7 @@ export default function generateSinglePicker<DateType, ExtraProps = {}>(
215230 locale = { locale ! . lang }
216231 class = { classNames (
217232 {
218- [ `${ pre } -${ size . value } ` ] : size . value ,
233+ [ `${ pre } -${ mergedSize . value } ` ] : mergedSize . value ,
219234 [ `${ pre } -borderless` ] : ! bordered ,
220235 } ,
221236 getStatusClassNames (
@@ -225,7 +240,9 @@ export default function generateSinglePicker<DateType, ExtraProps = {}>(
225240 ) ,
226241 attrs . class ,
227242 hashId . value ,
243+ compactItemClassnames . value ,
228244 ) }
245+ disabled = { disabled . value }
229246 prefixCls = { pre }
230247 getPopupContainer = { attrs . getCalendarContainer || getPopupContainer . value }
231248 generateConfig = { generateConfig }
@@ -235,7 +252,11 @@ export default function generateSinglePicker<DateType, ExtraProps = {}>(
235252 superNextIcon = { slots . superNextIcon ?.( ) || < span class = { `${ pre } -super-next-icon` } /> }
236253 components = { Components }
237254 direction = { direction . value }
238- dropdownClassName = { classNames ( hashId . value ) }
255+ dropdownClassName = { classNames (
256+ hashId . value ,
257+ props . popupClassName ,
258+ props . dropdownClassName ,
259+ ) }
239260 onChange = { onChange }
240261 onOpenChange = { onOpenChange }
241262 onFocus = { onFocus }
0 commit comments