fix: InputNumber handleVisible token should work as expected (#51728)

This commit is contained in:
诸岳 2024-11-28 16:12:25 +08:00 committed by GitHub
parent 9cc7dc1e15
commit c3b75819a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -250,7 +250,7 @@ const genInputNumberStyles: GenerateStyle<InputNumberToken> = (token: InputNumbe
position: 'absolute',
insetBlockStart: 0,
insetInlineEnd: 0,
width: 0,
width: token.handleVisibleWidth,
opacity: handleOpacity,
height: '100%',
borderStartStartRadius: 0,

View File

@ -55,17 +55,22 @@ export interface ComponentToken extends SharedComponentToken {
* @internal
*/
handleOpacity: number;
/**
* @internal
*/
handleVisibleWidth: number;
}
export type InputNumberToken = FullToken<'InputNumber'> & SharedInputToken;
export const prepareComponentToken: GetDefaultToken<'InputNumber'> = (token) => {
const handleVisible = token.handleVisible ?? 'auto';
const handleWidth = token.controlHeightSM - token.lineWidth * 2;
return {
...initComponentToken(token),
controlWidth: 90,
handleWidth: token.controlHeightSM - token.lineWidth * 2,
handleWidth,
handleFontSize: token.fontSize / 2,
handleVisible,
handleActiveBg: token.colorFillAlter,
@ -76,5 +81,6 @@ export const prepareComponentToken: GetDefaultToken<'InputNumber'> = (token) =>
handleHoverColor: token.colorPrimary,
handleBorderColor: token.colorBorder,
handleOpacity: handleVisible === true ? 1 : 0,
handleVisibleWidth: handleVisible === true ? handleWidth : 0,
};
};