fix: Image operation can not hide & export default seedToken (#38494)

* chore: export defaultSeed

* fix: image motion operation miss
This commit is contained in:
二货爱吃白萝卜 2022-11-10 21:27:37 +08:00 committed by GitHub
parent e130dc105f
commit 0741f59216
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 32 deletions

View File

@ -279,7 +279,7 @@ const genPreviewMotion: GenerateStyle<ImageToken> = token => {
return { return {
[`${previewCls}-root`]: initZoomMotion(token, 'zoom'), [`${previewCls}-root`]: initZoomMotion(token, 'zoom'),
'&': initFadeMotion(token), [`&`]: initFadeMotion(token, true),
}; };
}; };

View File

@ -22,22 +22,26 @@ export const fadeOut = new Keyframes('antFadeOut', {
}, },
}); });
export const initFadeMotion = (token: TokenWithCommonCls<AliasToken>): CSSInterpolation => { export const initFadeMotion = (
token: TokenWithCommonCls<AliasToken>,
sameLevel = false,
): CSSInterpolation => {
const { antCls } = token; const { antCls } = token;
const motionCls = `${antCls}-fade`; const motionCls = `${antCls}-fade`;
const sameLevelPrefix = sameLevel ? '&' : '';
return [ return [
initMotion(motionCls, fadeIn, fadeOut, token.motionDurationMid), initMotion(motionCls, fadeIn, fadeOut, token.motionDurationMid, sameLevel),
{ {
[` [`
${motionCls}-enter, ${sameLevelPrefix}${motionCls}-enter,
${motionCls}-appear ${sameLevelPrefix}${motionCls}-appear
`]: { `]: {
opacity: 0, opacity: 0,
animationTimingFunction: 'linear', animationTimingFunction: 'linear',
}, },
[`${motionCls}-leave`]: { [`${sameLevelPrefix}${motionCls}-leave`]: {
animationTimingFunction: 'linear', animationTimingFunction: 'linear',
}, },
}, },

View File

@ -17,31 +17,36 @@ export const initMotion = (
inKeyframes: Keyframes, inKeyframes: Keyframes,
outKeyframes: Keyframes, outKeyframes: Keyframes,
duration: string, duration: string,
): CSSObject => ({ sameLevel = false,
): CSSObject => {
const sameLevelPrefix = sameLevel ? '&' : '';
return {
[` [`
${motionCls}-enter, ${sameLevelPrefix}${motionCls}-enter,
${motionCls}-appear ${sameLevelPrefix}${motionCls}-appear
`]: { `]: {
...initMotionCommon(duration), ...initMotionCommon(duration),
animationPlayState: 'paused', animationPlayState: 'paused',
}, },
[`${motionCls}-leave`]: { [`${sameLevelPrefix}${motionCls}-leave`]: {
...initMotionCommonLeave(duration), ...initMotionCommonLeave(duration),
animationPlayState: 'paused', animationPlayState: 'paused',
}, },
[` [`
${motionCls}-enter${motionCls}-enter-active, ${sameLevelPrefix}${motionCls}-enter${motionCls}-enter-active,
${motionCls}-appear${motionCls}-appear-active ${sameLevelPrefix}${motionCls}-appear${motionCls}-appear-active
`]: { `]: {
animationName: inKeyframes, animationName: inKeyframes,
animationPlayState: 'running', animationPlayState: 'running',
}, },
[`${motionCls}-leave${motionCls}-leave-active`]: { [`${sameLevelPrefix}${motionCls}-leave${motionCls}-leave-active`]: {
animationName: outKeyframes, animationName: outKeyframes,
animationPlayState: 'running', animationPlayState: 'running',
pointerEvents: 'none', pointerEvents: 'none',
}, },
}); };
};

View File

@ -18,6 +18,9 @@ export default {
/** @private Test Usage. Do not use in production. */ /** @private Test Usage. Do not use in production. */
defaultConfig, defaultConfig,
/** Default seedToken */
defaultSeed: defaultConfig.token,
useToken, useToken,
defaultAlgorithm, defaultAlgorithm,
darkAlgorithm, darkAlgorithm,

View File

@ -126,7 +126,7 @@
"rc-drawer": "~6.0.0", "rc-drawer": "~6.0.0",
"rc-dropdown": "~4.0.0", "rc-dropdown": "~4.0.0",
"rc-field-form": "~1.27.0", "rc-field-form": "~1.27.0",
"rc-image": "~5.10.2", "rc-image": "~5.11.0",
"rc-input": "~0.1.4", "rc-input": "~0.1.4",
"rc-input-number": "~7.3.9", "rc-input-number": "~7.3.9",
"rc-mentions": "~1.10.0", "rc-mentions": "~1.10.0",