2023-11-17 13:46:41 +08:00
|
|
|
import { unit, 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 genRadiusStyle: GenerateStyle<TableToken, CSSObject> = (token) => {
|
2022-06-02 18:47:14 +08:00
|
|
|
const { componentCls, tableRadius } = token;
|
2022-05-31 10:10:35 +08:00
|
|
|
return {
|
|
|
|
[`${componentCls}-wrapper`]: {
|
|
|
|
[componentCls]: {
|
2022-12-22 16:51:09 +08:00
|
|
|
// https://github.com/ant-design/ant-design/issues/39115#issuecomment-1362314574
|
|
|
|
[`${componentCls}-title, ${componentCls}-header`]: {
|
2023-11-17 13:46:41 +08:00
|
|
|
borderRadius: `${unit(tableRadius)} ${unit(tableRadius)} 0 0`,
|
2022-05-31 10:10:35 +08:00
|
|
|
},
|
|
|
|
|
2022-09-02 20:57:53 +08:00
|
|
|
[`${componentCls}-title + ${componentCls}-container`]: {
|
2022-05-31 10:10:35 +08:00
|
|
|
borderStartStartRadius: 0,
|
|
|
|
borderStartEndRadius: 0,
|
|
|
|
|
2023-04-25 23:17:20 +08:00
|
|
|
// https://github.com/ant-design/ant-design/issues/41975
|
|
|
|
[`${componentCls}-header, table`]: {
|
2022-07-29 15:56:11 +08:00
|
|
|
borderRadius: 0,
|
2023-04-25 23:17:20 +08:00
|
|
|
},
|
2022-05-31 10:10:35 +08:00
|
|
|
|
2023-04-25 23:17:20 +08:00
|
|
|
'table > thead > tr:first-child': {
|
|
|
|
'th:first-child, th:last-child, td:first-child, td:last-child': {
|
|
|
|
borderRadius: 0,
|
2022-05-31 10:10:35 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
'&-container': {
|
2022-06-02 18:47:14 +08:00
|
|
|
borderStartStartRadius: tableRadius,
|
|
|
|
borderStartEndRadius: tableRadius,
|
2022-05-31 10:10:35 +08:00
|
|
|
|
|
|
|
'table > thead > tr:first-child': {
|
2022-12-24 14:14:07 +08:00
|
|
|
'> *:first-child': {
|
2022-06-02 18:47:14 +08:00
|
|
|
borderStartStartRadius: tableRadius,
|
2022-05-31 10:10:35 +08:00
|
|
|
},
|
|
|
|
|
2022-12-24 14:14:07 +08:00
|
|
|
'> *:last-child': {
|
2022-06-02 18:47:14 +08:00
|
|
|
borderStartEndRadius: tableRadius,
|
2022-05-31 10:10:35 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
'&-footer': {
|
2023-11-17 13:46:41 +08:00
|
|
|
borderRadius: `0 0 ${unit(tableRadius)} ${unit(tableRadius)}`,
|
2022-05-31 10:10:35 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export default genRadiusStyle;
|