2022-05-31 10:10:35 +08:00
|
|
|
import type { CSSObject } from '@ant-design/cssinjs';
|
2022-11-23 20:22:38 +08:00
|
|
|
import type { GenerateStyle } from '../../theme/internal';
|
2022-05-31 10:10:35 +08:00
|
|
|
import type { TableToken } from './index';
|
|
|
|
|
2022-11-19 13:47:33 +08:00
|
|
|
const genSelectionStyle: GenerateStyle<TableToken, CSSObject> = (token) => {
|
2022-06-02 18:47:14 +08:00
|
|
|
const {
|
|
|
|
componentCls,
|
|
|
|
antCls,
|
|
|
|
iconCls,
|
|
|
|
fontSizeIcon,
|
2023-04-06 17:16:27 +08:00
|
|
|
padding,
|
2022-06-02 18:47:14 +08:00
|
|
|
paddingXS,
|
|
|
|
tableHeaderIconColor,
|
|
|
|
tableHeaderIconColorHover,
|
2023-04-06 17:16:27 +08:00
|
|
|
tableSelectionColumnWidth,
|
2022-06-02 18:47:14 +08:00
|
|
|
} = token;
|
2023-04-06 17:16:27 +08:00
|
|
|
|
2022-05-31 10:10:35 +08:00
|
|
|
return {
|
|
|
|
[`${componentCls}-wrapper`]: {
|
|
|
|
// ========================== Selections ==========================
|
|
|
|
[`${componentCls}-selection-col`]: {
|
2023-04-06 17:16:27 +08:00
|
|
|
width: tableSelectionColumnWidth,
|
|
|
|
[`&${componentCls}-selection-col-with-dropdown`]: {
|
|
|
|
width: tableSelectionColumnWidth + fontSizeIcon + padding / 4,
|
|
|
|
},
|
2022-05-31 10:10:35 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-bordered ${componentCls}-selection-col`]: {
|
2023-04-06 17:16:27 +08:00
|
|
|
width: tableSelectionColumnWidth + paddingXS * 2,
|
|
|
|
[`&${componentCls}-selection-col-with-dropdown`]: {
|
|
|
|
width: tableSelectionColumnWidth + fontSizeIcon + padding / 4 + paddingXS * 2,
|
|
|
|
},
|
2022-05-31 10:10:35 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`
|
|
|
|
table tr th${componentCls}-selection-column,
|
|
|
|
table tr td${componentCls}-selection-column
|
|
|
|
`]: {
|
|
|
|
paddingInlineEnd: token.paddingXS,
|
|
|
|
paddingInlineStart: token.paddingXS,
|
|
|
|
textAlign: 'center',
|
|
|
|
|
|
|
|
[`${antCls}-radio-wrapper`]: {
|
|
|
|
marginInlineEnd: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`table tr th${componentCls}-selection-column${componentCls}-cell-fix-left`]: {
|
2022-12-31 19:38:47 +08:00
|
|
|
zIndex: token.zIndexTableFixed + 1,
|
2022-05-31 10:10:35 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`table tr th${componentCls}-selection-column::after`]: {
|
|
|
|
backgroundColor: 'transparent !important',
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-selection`]: {
|
|
|
|
position: 'relative',
|
|
|
|
display: 'inline-flex',
|
|
|
|
flexDirection: 'column',
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-selection-extra`]: {
|
|
|
|
position: 'absolute',
|
|
|
|
top: 0,
|
|
|
|
zIndex: 1,
|
|
|
|
cursor: 'pointer',
|
|
|
|
transition: `all ${token.motionDurationSlow}`,
|
|
|
|
marginInlineStart: '100%',
|
|
|
|
paddingInlineStart: `${token.tablePaddingHorizontal / 4}px`,
|
|
|
|
|
|
|
|
[iconCls]: {
|
2022-06-02 18:47:14 +08:00
|
|
|
color: tableHeaderIconColor,
|
|
|
|
fontSize: fontSizeIcon,
|
2022-05-31 10:10:35 +08:00
|
|
|
verticalAlign: 'baseline',
|
|
|
|
|
|
|
|
'&:hover': {
|
2022-06-02 18:47:14 +08:00
|
|
|
color: tableHeaderIconColorHover,
|
2022-05-31 10:10:35 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export default genSelectionStyle;
|