Merge pull request #38540 from ant-design/fix-picker

fix: picker missing motion
This commit is contained in:
二货爱吃白萝卜 2022-11-14 14:47:12 +08:00 committed by GitHub
commit 3e3a3a0ed8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,7 +7,14 @@ import {
genHoverStyle,
initInputToken,
} from '../../input/style';
import { slideDownIn, slideDownOut, slideUpIn, slideUpOut } from '../../style/motion';
import {
initSlideMotion,
initMoveMotion,
slideDownIn,
slideDownOut,
slideUpIn,
slideUpOut,
} from '../../style/motion';
import type { FullToken, GenerateStyle } from '../../theme';
import { genComponentStyleHook, mergeToken } from '../../theme';
import type { GlobalToken } from '../../theme/interface';
@ -848,7 +855,7 @@ export const genPanelStyle = (token: SharedPickerToken): CSSObject => {
};
};
const genPickerStatusStyle: GenerateStyle<PickerToken> = token => {
const genPickerStatusStyle: GenerateStyle<PickerToken> = (token) => {
const {
componentCls,
colorBgContainer,
@ -905,7 +912,7 @@ const genPickerStatusStyle: GenerateStyle<PickerToken> = token => {
};
};
const genPickerStyle: GenerateStyle<PickerToken> = token => {
const genPickerStyle: GenerateStyle<PickerToken> = (token) => {
const {
componentCls,
antCls,
@ -952,7 +959,8 @@ const genPickerStyle: GenerateStyle<PickerToken> = token => {
presetsMaxWidth,
} = token;
return {
return [
{
[componentCls]: {
...resetComponent(token),
...genPikerPadding(token, controlHeight, fontSize, inputPaddingHorizontal),
@ -1373,7 +1381,14 @@ const genPickerStyle: GenerateStyle<PickerToken> = token => {
},
},
},
};
},
// Follow code may reuse in other components
initSlideMotion(token, 'slide-up'),
initSlideMotion(token, 'slide-down'),
initMoveMotion(token, 'move-up'),
initMoveMotion(token, 'move-down'),
];
};
export const initPickerPanelToken = (token: TokenWithCommonCls<GlobalToken>): PickerPanelToken => {
@ -1403,14 +1418,14 @@ export const initPickerPanelToken = (token: TokenWithCommonCls<GlobalToken>): Pi
// ============================== Export ==============================
export default genComponentStyleHook(
'DatePicker',
token => {
(token) => {
const pickerToken = mergeToken<PickerToken>(
initInputToken<FullToken<'DatePicker'>>(token),
initPickerPanelToken(token),
);
return [genPickerStyle(pickerToken), genPickerStatusStyle(pickerToken)];
},
token => ({
(token) => ({
presetsWidth: 120,
presetsMaxWidth: 200,
zIndexPopup: token.zIndexPopupBase + 50,