mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-11 23:00:20 +08:00
87882e1db6
* fix(style): Virtual table style lead on none virtual table render used as a nested table. * fix(test): Update test for virtual table with fix nested table inside. --------- Co-authored-by: ykryshtal <ykryshtal@magnite.com> Co-authored-by: Eugene <Jeka1.1@mail.ru>
76 lines
2.2 KiB
TypeScript
76 lines
2.2 KiB
TypeScript
import { unit, type CSSObject } from '@ant-design/cssinjs';
|
|
|
|
import type { GenerateStyle } from '../../theme/internal';
|
|
import type { TableToken } from './index';
|
|
|
|
const genVirtualStyle: GenerateStyle<TableToken, CSSObject> = (token) => {
|
|
const { componentCls, motionDurationMid, lineWidth, lineType, tableBorderColor, calc } = token;
|
|
|
|
const tableBorder = `${unit(lineWidth)} ${lineType} ${tableBorderColor}`;
|
|
|
|
const rowCellCls = `${componentCls}-expanded-row-cell`;
|
|
|
|
return {
|
|
[`${componentCls}-wrapper`]: {
|
|
// ========================== Row ==========================
|
|
[`${componentCls}-tbody-virtual`]: {
|
|
[`${componentCls}-row:not(tr)`]: {
|
|
display: 'flex',
|
|
boxSizing: 'border-box',
|
|
width: '100%',
|
|
},
|
|
|
|
[`${componentCls}-cell`]: {
|
|
borderBottom: tableBorder,
|
|
transition: `background ${motionDurationMid}`,
|
|
},
|
|
|
|
[`${componentCls}-expanded-row`]: {
|
|
[`${rowCellCls}${rowCellCls}-fixed`]: {
|
|
position: 'sticky',
|
|
insetInlineStart: 0,
|
|
overflow: 'hidden',
|
|
width: `calc(var(--virtual-width) - ${unit(lineWidth)})`,
|
|
borderInlineEnd: 'none',
|
|
},
|
|
},
|
|
},
|
|
|
|
// ======================== Border =========================
|
|
[`${componentCls}-bordered`]: {
|
|
[`${componentCls}-tbody-virtual`]: {
|
|
'&:after': {
|
|
content: '""',
|
|
insetInline: 0,
|
|
bottom: 0,
|
|
borderBottom: tableBorder,
|
|
position: 'absolute',
|
|
},
|
|
|
|
[`${componentCls}-cell`]: {
|
|
borderInlineEnd: tableBorder,
|
|
|
|
[`&${componentCls}-cell-fix-right-first:before`]: {
|
|
content: '""',
|
|
position: 'absolute',
|
|
insetBlock: 0,
|
|
insetInlineStart: calc(lineWidth).mul(-1).equal(),
|
|
borderInlineStart: tableBorder,
|
|
},
|
|
},
|
|
},
|
|
|
|
// Empty placeholder
|
|
[`&${componentCls}-virtual`]: {
|
|
[`${componentCls}-placeholder ${componentCls}-cell`]: {
|
|
borderInlineEnd: tableBorder,
|
|
borderBottom: tableBorder,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
};
|
|
|
|
export default genVirtualStyle;
|