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', position: 'absolute',
insetBlockStart: 0, insetBlockStart: 0,
insetInlineEnd: 0, insetInlineEnd: 0,
width: 0, width: token.handleVisibleWidth,
opacity: handleOpacity, opacity: handleOpacity,
height: '100%', height: '100%',
borderStartStartRadius: 0, borderStartStartRadius: 0,

View File

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