You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
2.6 KiB
102 lines
2.6 KiB
3 years ago
|
import type { CSSObject } from '@ant-design/cssinjs';
|
||
2 years ago
|
import type { GenerateStyle } from '../../theme/internal';
|
||
3 years ago
|
import type { TableToken } from './index';
|
||
|
|
||
2 years ago
|
const genSorterStyle: GenerateStyle<TableToken, CSSObject> = (token) => {
|
||
3 years ago
|
const { componentCls, marginXXS, fontSizeIcon, tableHeaderIconColor, tableHeaderIconColorHover } =
|
||
|
token;
|
||
3 years ago
|
return {
|
||
|
[`${componentCls}-wrapper`]: {
|
||
|
[`${componentCls}-thead th${componentCls}-column-has-sorters`]: {
|
||
|
outline: 'none',
|
||
|
cursor: 'pointer',
|
||
|
transition: `all ${token.motionDurationSlow}`,
|
||
|
|
||
|
'&:hover': {
|
||
|
background: token.tableHeaderSortHoverBg,
|
||
|
|
||
|
'&::before': {
|
||
|
backgroundColor: 'transparent !important',
|
||
|
},
|
||
|
},
|
||
|
|
||
|
'&:focus-visible': {
|
||
|
color: token.colorPrimary,
|
||
|
},
|
||
|
|
||
|
// https://github.com/ant-design/ant-design/issues/30969
|
||
|
[`
|
||
|
&${componentCls}-cell-fix-left:hover,
|
||
|
&${componentCls}-cell-fix-right:hover
|
||
|
`]: {
|
||
|
background: token.tableFixedHeaderSortActiveBg,
|
||
|
},
|
||
|
},
|
||
|
|
||
|
[`${componentCls}-thead th${componentCls}-column-sort`]: {
|
||
|
background: token.tableHeaderSortBg,
|
||
|
|
||
|
'&::before': {
|
||
|
backgroundColor: 'transparent !important',
|
||
|
},
|
||
|
},
|
||
|
|
||
|
[`td${componentCls}-column-sort`]: {
|
||
|
background: token.tableBodySortBg,
|
||
|
},
|
||
|
|
||
|
[`${componentCls}-column-title`]: {
|
||
|
position: 'relative',
|
||
|
zIndex: 1,
|
||
|
flex: 1,
|
||
|
},
|
||
|
|
||
|
[`${componentCls}-column-sorters`]: {
|
||
|
display: 'flex',
|
||
|
flex: 'auto',
|
||
|
alignItems: 'center',
|
||
|
justifyContent: 'space-between',
|
||
|
|
||
|
'&::after': {
|
||
|
position: 'absolute',
|
||
3 years ago
|
inset: 0,
|
||
3 years ago
|
width: '100%',
|
||
|
height: '100%',
|
||
|
content: '""',
|
||
|
},
|
||
|
},
|
||
|
|
||
|
[`${componentCls}-column-sorter`]: {
|
||
3 years ago
|
marginInlineStart: marginXXS,
|
||
|
color: tableHeaderIconColor,
|
||
3 years ago
|
fontSize: 0,
|
||
|
transition: `color ${token.motionDurationSlow}`,
|
||
|
|
||
|
'&-inner': {
|
||
|
display: 'inline-flex',
|
||
|
flexDirection: 'column',
|
||
|
alignItems: 'center',
|
||
|
},
|
||
|
|
||
|
'&-up, &-down': {
|
||
3 years ago
|
fontSize: fontSizeIcon,
|
||
3 years ago
|
|
||
|
'&.active': {
|
||
|
color: token.colorPrimary,
|
||
|
},
|
||
|
},
|
||
|
|
||
|
[`${componentCls}-column-sorter-up + ${componentCls}-column-sorter-down`]: {
|
||
|
marginTop: '-0.3em',
|
||
|
},
|
||
|
},
|
||
|
|
||
|
[`${componentCls}-column-sorters:hover ${componentCls}-column-sorter`]: {
|
||
3 years ago
|
color: tableHeaderIconColorHover,
|
||
3 years ago
|
},
|
||
|
},
|
||
|
};
|
||
|
};
|
||
|
|
||
|
export default genSorterStyle;
|