mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-15 13:38:29 +02:00
fix(Space.Compact):Border cropping issue (#54596)
Co-authored-by: liuqiang <qiang.liu@xinjifamily.com>
This commit is contained in:
parent
5f75711a80
commit
81a86966d2
2 changed files with 22 additions and 8 deletions
|
@ -1,17 +1,25 @@
|
|||
import type { CSSInterpolation, CSSObject } from '@ant-design/cssinjs';
|
||||
|
||||
import type { AliasToken, FullToken, OverrideComponent, CSSUtil } from '../theme/internal';
|
||||
import type { AliasToken, CSSUtil, FullToken, OverrideComponent } from '../theme/internal';
|
||||
|
||||
function compactItemVerticalBorder(token: AliasToken & CSSUtil, parentCls: string): CSSObject {
|
||||
function compactItemVerticalBorder(
|
||||
token: AliasToken & CSSUtil,
|
||||
parentCls: string,
|
||||
prefixCls: string,
|
||||
): CSSObject {
|
||||
return {
|
||||
// border collapse
|
||||
[`&-item:not(${parentCls}-last-item)`]: {
|
||||
marginBottom: token.calc(token.lineWidth).mul(-1).equal(),
|
||||
},
|
||||
|
||||
[`&-item:not(${prefixCls}-status-success)`]: {
|
||||
zIndex: 2,
|
||||
},
|
||||
|
||||
'&-item': {
|
||||
'&:hover,&:focus,&:active': {
|
||||
zIndex: 2,
|
||||
zIndex: 3,
|
||||
},
|
||||
|
||||
'&[disabled]': {
|
||||
|
@ -50,7 +58,7 @@ export function genCompactItemVerticalStyle<T extends OverrideComponent>(
|
|||
|
||||
return {
|
||||
[compactCls]: {
|
||||
...compactItemVerticalBorder(token, compactCls),
|
||||
...compactItemVerticalBorder(token, compactCls, token.componentCls),
|
||||
...compactItemBorderVerticalRadius(token.componentCls, compactCls),
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { CSSInterpolation, CSSObject } from '@ant-design/cssinjs';
|
||||
|
||||
import type { AliasToken, FullToken, OverrideComponent, CSSUtil } from '../theme/internal';
|
||||
import type { AliasToken, CSSUtil, FullToken, OverrideComponent } from '../theme/internal';
|
||||
|
||||
interface CompactItemOptions {
|
||||
focus?: boolean;
|
||||
|
@ -21,6 +21,7 @@ function compactItemBorder(
|
|||
token: AliasToken & CSSUtil,
|
||||
parentCls: string,
|
||||
options: CompactItemOptions,
|
||||
prefixCls: string,
|
||||
): CSSObject {
|
||||
const { focusElCls, focus, borderElCls } = options;
|
||||
const childCombinator = borderElCls ? '> *' : '';
|
||||
|
@ -28,20 +29,25 @@ function compactItemBorder(
|
|||
.filter(Boolean)
|
||||
.map((n) => `&:${n} ${childCombinator}`)
|
||||
.join(',');
|
||||
|
||||
return {
|
||||
[`&-item:not(${parentCls}-last-item)`]: {
|
||||
marginInlineEnd: token.calc(token.lineWidth).mul(-1).equal(),
|
||||
},
|
||||
|
||||
[`&-item:not(${prefixCls}-status-success)`]: {
|
||||
zIndex: 2,
|
||||
},
|
||||
|
||||
'&-item': {
|
||||
[hoverEffects]: {
|
||||
zIndex: 2,
|
||||
zIndex: 3,
|
||||
},
|
||||
|
||||
...(focusElCls
|
||||
? {
|
||||
[`&${focusElCls}`]: {
|
||||
zIndex: 2,
|
||||
zIndex: 3,
|
||||
},
|
||||
}
|
||||
: {}),
|
||||
|
@ -95,7 +101,7 @@ export function genCompactItemStyle<T extends OverrideComponent>(
|
|||
|
||||
return {
|
||||
[compactCls]: {
|
||||
...compactItemBorder(token, compactCls, options),
|
||||
...compactItemBorder(token, compactCls, options, componentCls),
|
||||
...compactItemBorderRadius(componentCls, compactCls, options),
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue