Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Input): props show-count param display incorrect in space compact mode #47112

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions components/input/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,15 @@ const genGroupStyle: GenerateStyle<InputToken> = (token: InputToken) => {
borderEndStartRadius: 0,
},
},

// Fix the issue of input use show-count param in space compact mode
// https://github.com/ant-design/ant-design/issues/46872
[`&:not(${componentCls}-compact-last-item)${componentCls}-compact-item`]: {
[`${componentCls}-affix-wrapper`]: {
borderStartEndRadius: 0,
borderEndEndRadius: 0,
},
},
},
},
};
Expand Down
132 changes: 132 additions & 0 deletions components/space/__tests__/__snapshots__/demo-extend.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10665,6 +10665,138 @@ exports[`renders components/space/demo/compact-debug.tsx extend context correctl
</button>
</div>
</div>
<div
class="ant-space-item"
>
<div
class="ant-space-compact"
>
<span
class="ant-input-group-wrapper ant-input-group-wrapper-outlined ant-input-compact-item ant-input-compact-first-item"
>
<span
class="ant-input-wrapper ant-input-group"
>
<span
class="ant-input-group-addon"
>
Prefix
</span>
<span
class="ant-input-affix-wrapper ant-input-outlined"
>
<input
class="ant-input"
type="text"
value="mysite"
/>
<span
class="ant-input-suffix"
>
<span
class="ant-input-show-count-suffix"
>
6
</span>
</span>
</span>
</span>
</span>
<button
class="ant-btn ant-btn-primary ant-btn-compact-item"
type="button"
>
<span>
Submit
</span>
</button>
<span
class="ant-input-group-wrapper ant-input-group-wrapper-outlined ant-input-compact-item"
>
<span
class="ant-input-wrapper ant-input-group"
>
<span
class="ant-input-group-addon"
>
Prefix
</span>
<span
class="ant-input-affix-wrapper ant-input-outlined"
>
<input
class="ant-input"
type="text"
value="mysite"
/>
<span
class="ant-input-suffix"
>
<span
class="ant-input-show-count-suffix"
>
6
</span>
</span>
</span>
<span
class="ant-input-group-addon"
>
<span
aria-label="setting"
class="anticon anticon-setting"
role="img"
>
<svg
aria-hidden="true"
data-icon="setting"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"
/>
</svg>
</span>
</span>
</span>
</span>
<span
class="ant-input-group-wrapper ant-input-group-wrapper-outlined ant-input-compact-item ant-input-compact-last-item"
>
<span
class="ant-input-wrapper ant-input-group"
>
<span
class="ant-input-group-addon"
>
Prefix
</span>
<span
class="ant-input-affix-wrapper ant-input-outlined"
>
<input
class="ant-input"
type="text"
value="mysite"
/>
<span
class="ant-input-suffix"
>
<span
class="ant-input-show-count-suffix"
>
6
</span>
</span>
</span>
</span>
</span>
</div>
</div>
<div
class="ant-space-item"
>
Expand Down
132 changes: 132 additions & 0 deletions components/space/__tests__/__snapshots__/demo.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3180,6 +3180,138 @@ exports[`renders components/space/demo/compact-debug.tsx correctly 1`] = `
</button>
</div>
</div>
<div
class="ant-space-item"
>
<div
class="ant-space-compact"
>
<span
class="ant-input-group-wrapper ant-input-group-wrapper-outlined ant-input-compact-item ant-input-compact-first-item"
>
<span
class="ant-input-wrapper ant-input-group"
>
<span
class="ant-input-group-addon"
>
Prefix
</span>
<span
class="ant-input-affix-wrapper ant-input-outlined"
>
<input
class="ant-input"
type="text"
value="mysite"
/>
<span
class="ant-input-suffix"
>
<span
class="ant-input-show-count-suffix"
>
6
</span>
</span>
</span>
</span>
</span>
<button
class="ant-btn ant-btn-primary ant-btn-compact-item"
type="button"
>
<span>
Submit
</span>
</button>
<span
class="ant-input-group-wrapper ant-input-group-wrapper-outlined ant-input-compact-item"
>
<span
class="ant-input-wrapper ant-input-group"
>
<span
class="ant-input-group-addon"
>
Prefix
</span>
<span
class="ant-input-affix-wrapper ant-input-outlined"
>
<input
class="ant-input"
type="text"
value="mysite"
/>
<span
class="ant-input-suffix"
>
<span
class="ant-input-show-count-suffix"
>
6
</span>
</span>
</span>
<span
class="ant-input-group-addon"
>
<span
aria-label="setting"
class="anticon anticon-setting"
role="img"
>
<svg
aria-hidden="true"
data-icon="setting"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M924.8 625.7l-65.5-56c3.1-19 4.7-38.4 4.7-57.8s-1.6-38.8-4.7-57.8l65.5-56a32.03 32.03 0 009.3-35.2l-.9-2.6a443.74 443.74 0 00-79.7-137.9l-1.8-2.1a32.12 32.12 0 00-35.1-9.5l-81.3 28.9c-30-24.6-63.5-44-99.7-57.6l-15.7-85a32.05 32.05 0 00-25.8-25.7l-2.7-.5c-52.1-9.4-106.9-9.4-159 0l-2.7.5a32.05 32.05 0 00-25.8 25.7l-15.8 85.4a351.86 351.86 0 00-99 57.4l-81.9-29.1a32 32 0 00-35.1 9.5l-1.8 2.1a446.02 446.02 0 00-79.7 137.9l-.9 2.6c-4.5 12.5-.8 26.5 9.3 35.2l66.3 56.6c-3.1 18.8-4.6 38-4.6 57.1 0 19.2 1.5 38.4 4.6 57.1L99 625.5a32.03 32.03 0 00-9.3 35.2l.9 2.6c18.1 50.4 44.9 96.9 79.7 137.9l1.8 2.1a32.12 32.12 0 0035.1 9.5l81.9-29.1c29.8 24.5 63.1 43.9 99 57.4l15.8 85.4a32.05 32.05 0 0025.8 25.7l2.7.5a449.4 449.4 0 00159 0l2.7-.5a32.05 32.05 0 0025.8-25.7l15.7-85a350 350 0 0099.7-57.6l81.3 28.9a32 32 0 0035.1-9.5l1.8-2.1c34.8-41.1 61.6-87.5 79.7-137.9l.9-2.6c4.5-12.3.8-26.3-9.3-35zM788.3 465.9c2.5 15.1 3.8 30.6 3.8 46.1s-1.3 31-3.8 46.1l-6.6 40.1 74.7 63.9a370.03 370.03 0 01-42.6 73.6L721 702.8l-31.4 25.8c-23.9 19.6-50.5 35-79.3 45.8l-38.1 14.3-17.9 97a377.5 377.5 0 01-85 0l-17.9-97.2-37.8-14.5c-28.5-10.8-55-26.2-78.7-45.7l-31.4-25.9-93.4 33.2c-17-22.9-31.2-47.6-42.6-73.6l75.5-64.5-6.5-40c-2.4-14.9-3.7-30.3-3.7-45.5 0-15.3 1.2-30.6 3.7-45.5l6.5-40-75.5-64.5c11.3-26.1 25.6-50.7 42.6-73.6l93.4 33.2 31.4-25.9c23.7-19.5 50.2-34.9 78.7-45.7l37.9-14.3 17.9-97.2c28.1-3.2 56.8-3.2 85 0l17.9 97 38.1 14.3c28.7 10.8 55.4 26.2 79.3 45.8l31.4 25.8 92.8-32.9c17 22.9 31.2 47.6 42.6 73.6L781.8 426l6.5 39.9zM512 326c-97.2 0-176 78.8-176 176s78.8 176 176 176 176-78.8 176-176-78.8-176-176-176zm79.2 255.2A111.6 111.6 0 01512 614c-29.9 0-58-11.7-79.2-32.8A111.6 111.6 0 01400 502c0-29.9 11.7-58 32.8-79.2C454 401.6 482.1 390 512 390c29.9 0 58 11.6 79.2 32.8A111.6 111.6 0 01624 502c0 29.9-11.7 58-32.8 79.2z"
/>
</svg>
</span>
</span>
</span>
</span>
<span
class="ant-input-group-wrapper ant-input-group-wrapper-outlined ant-input-compact-item ant-input-compact-last-item"
>
<span
class="ant-input-wrapper ant-input-group"
>
<span
class="ant-input-group-addon"
>
Prefix
</span>
<span
class="ant-input-affix-wrapper ant-input-outlined"
>
<input
class="ant-input"
type="text"
value="mysite"
/>
<span
class="ant-input-suffix"
>
<span
class="ant-input-show-count-suffix"
>
6
</span>
</span>
</span>
</span>
</span>
</div>
</div>
<div
class="ant-space-item"
>
Expand Down
11 changes: 11 additions & 0 deletions components/space/demo/compact-debug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ const App: React.FC = () => {
/>
<Button type="primary">Submit</Button>
</Space.Compact>
<Space.Compact>
<Input addonBefore="Prefix" defaultValue="mysite" showCount />
<Button type="primary">Submit</Button>
<Input
addonBefore="Prefix"
defaultValue="mysite"
showCount
addonAfter={<SettingOutlined />}
/>
<Input addonBefore="Prefix" defaultValue="mysite" showCount />
</Space.Compact>
<br />
<Space.Compact>
<Button onClick={() => setShowModal(true)}>debug Modal context</Button>
Expand Down