From 61df5e656f3daf6f5187bbde9e2e18cd4cb8df68 Mon Sep 17 00:00:00 2001 From: Konv Suu <2583695112@qq.com> Date: Tue, 22 Aug 2023 10:45:40 +0800 Subject: [PATCH] fix(input-group): layout style (#6866) * fix(input-group): layout style * tests: update snapshot --- .../__tests__/__snapshots__/demo.test.js.snap | 56 +++++++++++++------ components/input/style/index.ts | 48 +++++++++++++--- 2 files changed, 79 insertions(+), 25 deletions(-) diff --git a/components/input/__tests__/__snapshots__/demo.test.js.snap b/components/input/__tests__/__snapshots__/demo.test.js.snap index 416dd244c..fc988d258 100644 --- a/components/input/__tests__/__snapshots__/demo.test.js.snap +++ b/components/input/__tests__/__snapshots__/demo.test.js.snap @@ -50,26 +50,37 @@ exports[`renders ./components/input/demo/basic.vue correctly 1`] = ` exports[`renders ./components/input/demo/borderless.vue correctly 1`] = ``; exports[`renders ./components/input/demo/group.vue correctly 1`] = ` -


Zhejiang +
+
+ +
+ +
Zhejiang + +
+ + +
+ +
Option1
-

Option1 - -
- - -

- +
+
+ +
-

Option1-1 +
+
Option1-1 +
@@ -83,14 +94,18 @@ exports[`renders ./components/input/demo/group.vue correctly 1`] = ` -

Between +
+
Between +
-

Sign Up +
+
Sign Up +
@@ -104,8 +119,10 @@ exports[`renders ./components/input/demo/group.vue correctly 1`] = ` -

Home +
+
Home +
@@ -119,8 +136,15 @@ exports[`renders ./components/input/demo/group.vue correctly 1`] = ` -


-
+
+ +
+ +
+ +
+ +
`; exports[`renders ./components/input/demo/password-input.vue correctly 1`] = ` @@ -152,7 +176,7 @@ exports[`renders ./components/input/demo/password-input.vue correctly 1`] = ` `; exports[`renders ./components/input/demo/presuffix.vue correctly 1`] = ` -
+


RMB
diff --git a/components/input/style/index.ts b/components/input/style/index.ts index f3d37358b..7653f7870 100644 --- a/components/input/style/index.ts +++ b/components/input/style/index.ts @@ -230,15 +230,6 @@ export const genInputGroupStyle = (token: InputToken): CSSObject => { ...genInputSmallStyle(token), }, - // Fix https://github.com/ant-design/ant-design/issues/5754 - [`&-lg ${antCls}-select-single ${antCls}-select-selector`]: { - height: token.controlHeightLG, - }, - - [`&-sm ${antCls}-select-single ${antCls}-select-selector`]: { - height: token.controlHeightSM, - }, - [`> ${componentCls}`]: { display: 'table-cell', @@ -501,6 +492,45 @@ export const genInputGroupStyle = (token: InputToken): CSSObject => { }, }, }, + + [`&&-sm ${antCls}-btn`]: { + fontSize: token.fontSizeSM, + height: token.controlHeightSM, + lineHeight: 'normal', + }, + + [`&&-lg ${antCls}-btn`]: { + fontSize: token.fontSizeLG, + height: token.controlHeightLG, + lineHeight: 'normal', + }, + + // Fix https://github.com/ant-design/ant-design/issues/5754 + [`&&-lg ${antCls}-select-single ${antCls}-select-selector`]: { + height: `${token.controlHeightLG}px`, + + [`${antCls}-select-selection-item, ${antCls}-select-selection-placeholder`]: { + // -2 is for the border size & override default + lineHeight: `${token.controlHeightLG - 2}px`, + }, + + [`${antCls}-select-selection-search-input`]: { + height: `${token.controlHeightLG}px`, + }, + }, + + [`&&-sm ${antCls}-select-single ${antCls}-select-selector`]: { + height: `${token.controlHeightSM}px`, + + [`${antCls}-select-selection-item, ${antCls}-select-selection-placeholder`]: { + // -2 is for the border size & override default + lineHeight: `${token.controlHeightSM - 2}px`, + }, + + [`${antCls}-select-selection-search-input`]: { + height: `${token.controlHeightSM}px`, + }, + }, }; };