mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-15 01:11:26 +08:00
a268fdde8f
* Add the rowScope style * doc(table): add demo about rowScope * update snapshot --------- Co-authored-by: Yuiai01 <dujiaqi@kezaihui.com> Co-authored-by: muxinFeng <434980373@qq.com>
70 lines
2.0 KiB
TypeScript
70 lines
2.0 KiB
TypeScript
import type { CSSObject } from '@ant-design/cssinjs';
|
|
import type { GenerateStyle } from '../../theme/internal';
|
|
import type { TableToken } from './index';
|
|
|
|
const genSizeStyle: GenerateStyle<TableToken, CSSObject> = (token) => {
|
|
const { componentCls } = token;
|
|
const getSizeStyle = (
|
|
size: 'small' | 'middle',
|
|
paddingVertical: number,
|
|
paddingHorizontal: number,
|
|
fontSize: number,
|
|
) => ({
|
|
[`${componentCls}${componentCls}-${size}`]: {
|
|
fontSize,
|
|
[`
|
|
${componentCls}-title,
|
|
${componentCls}-footer,
|
|
${componentCls}-thead > tr > th,
|
|
${componentCls}-tbody > tr > th,
|
|
${componentCls}-tbody > tr > td,
|
|
tfoot > tr > th,
|
|
tfoot > tr > td
|
|
`]: {
|
|
padding: `${paddingVertical}px ${paddingHorizontal}px`,
|
|
},
|
|
|
|
[`${componentCls}-filter-trigger`]: {
|
|
marginInlineEnd: `-${paddingHorizontal / 2}px`,
|
|
},
|
|
|
|
[`${componentCls}-expanded-row-fixed`]: {
|
|
margin: `-${paddingVertical}px -${paddingHorizontal}px`,
|
|
},
|
|
|
|
[`${componentCls}-tbody`]: {
|
|
// ========================= Nest Table ===========================
|
|
[`${componentCls}-wrapper:only-child ${componentCls}`]: {
|
|
marginBlock: `-${paddingVertical}px`,
|
|
marginInline: `${
|
|
token.tableExpandColumnWidth - paddingHorizontal
|
|
}px -${paddingHorizontal}px`,
|
|
},
|
|
},
|
|
|
|
// https://github.com/ant-design/ant-design/issues/35167
|
|
[`${componentCls}-selection-column`]: {
|
|
paddingInlineStart: `${paddingHorizontal / 4}px`,
|
|
},
|
|
},
|
|
});
|
|
return {
|
|
[`${componentCls}-wrapper`]: {
|
|
...getSizeStyle(
|
|
'middle',
|
|
token.tablePaddingVerticalMiddle,
|
|
token.tablePaddingHorizontalMiddle,
|
|
token.tableFontSizeMiddle,
|
|
),
|
|
...getSizeStyle(
|
|
'small',
|
|
token.tablePaddingVerticalSmall,
|
|
token.tablePaddingHorizontalSmall,
|
|
token.tableFontSizeSmall,
|
|
),
|
|
},
|
|
};
|
|
};
|
|
|
|
export default genSizeStyle;
|