2022-05-31 10:10:35 +08:00
|
|
|
import type { CSSObject } from '@ant-design/cssinjs';
|
2022-06-27 14:25:59 +08:00
|
|
|
import type { GenerateStyle } from '../../theme';
|
2022-05-31 10:10:35 +08:00
|
|
|
import type { TableToken } from './index';
|
|
|
|
|
|
|
|
const genFixedStyle: GenerateStyle<TableToken, CSSObject> = token => {
|
2022-06-02 18:47:14 +08:00
|
|
|
const { componentCls, lineWidth, colorSplit, motionDurationSlow, zIndexTableFixed, tableBg } =
|
|
|
|
token;
|
|
|
|
|
|
|
|
const shadowColor = colorSplit;
|
|
|
|
|
|
|
|
// Follow style is magic of shadow which should not follow token:
|
2022-05-31 10:10:35 +08:00
|
|
|
return {
|
|
|
|
[`${componentCls}-wrapper`]: {
|
|
|
|
[`
|
|
|
|
${componentCls}-cell-fix-left,
|
|
|
|
${componentCls}-cell-fix-right
|
|
|
|
`]: {
|
|
|
|
position: 'sticky !important' as 'sticky',
|
2022-06-02 18:47:14 +08:00
|
|
|
zIndex: zIndexTableFixed,
|
|
|
|
background: tableBg,
|
2022-05-31 10:10:35 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`
|
|
|
|
${componentCls}-cell-fix-left-first::after,
|
|
|
|
${componentCls}-cell-fix-left-last::after
|
|
|
|
`]: {
|
|
|
|
position: 'absolute',
|
|
|
|
top: 0,
|
|
|
|
right: {
|
|
|
|
_skip_check_: true,
|
|
|
|
value: 0,
|
|
|
|
},
|
2022-06-02 18:47:14 +08:00
|
|
|
bottom: -lineWidth,
|
2022-05-31 10:10:35 +08:00
|
|
|
width: 30,
|
|
|
|
transform: 'translateX(100%)',
|
2022-06-02 18:47:14 +08:00
|
|
|
transition: `box-shadow ${motionDurationSlow}`,
|
2022-05-31 10:10:35 +08:00
|
|
|
content: '""',
|
|
|
|
pointerEvents: 'none',
|
|
|
|
},
|
|
|
|
|
|
|
|
[`
|
|
|
|
${componentCls}-cell-fix-right-first::after,
|
|
|
|
${componentCls}-cell-fix-right-last::after
|
|
|
|
`]: {
|
|
|
|
position: 'absolute',
|
|
|
|
top: 0,
|
2022-06-02 18:47:14 +08:00
|
|
|
bottom: -lineWidth,
|
2022-05-31 10:10:35 +08:00
|
|
|
left: {
|
|
|
|
_skip_check_: true,
|
|
|
|
value: 0,
|
|
|
|
},
|
|
|
|
width: 30,
|
|
|
|
transform: 'translateX(-100%)',
|
2022-06-02 18:47:14 +08:00
|
|
|
transition: `box-shadow ${motionDurationSlow}`,
|
2022-05-31 10:10:35 +08:00
|
|
|
content: '""',
|
|
|
|
pointerEvents: 'none',
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-container`]: {
|
|
|
|
'&::before, &::after': {
|
|
|
|
position: 'absolute',
|
|
|
|
top: 0,
|
|
|
|
bottom: 0,
|
2022-07-08 11:24:57 +08:00
|
|
|
zIndex: zIndexTableFixed,
|
2022-05-31 10:10:35 +08:00
|
|
|
width: 30,
|
2022-06-02 18:47:14 +08:00
|
|
|
transition: `box-shadow ${motionDurationSlow}`,
|
2022-05-31 10:10:35 +08:00
|
|
|
content: '""',
|
|
|
|
pointerEvents: 'none',
|
|
|
|
},
|
|
|
|
|
|
|
|
'&::before': {
|
|
|
|
insetInlineStart: 0,
|
|
|
|
},
|
|
|
|
|
|
|
|
'&::after': {
|
|
|
|
insetInlineEnd: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-ping-left`]: {
|
|
|
|
[`&:not(${componentCls}-has-fix-left) ${componentCls}-container`]: {
|
|
|
|
position: 'relative',
|
|
|
|
|
|
|
|
'&::before': {
|
|
|
|
boxShadow: `inset 10px 0 8px -8px ${shadowColor}`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`
|
|
|
|
${componentCls}-cell-fix-left-first::after,
|
|
|
|
${componentCls}-cell-fix-left-last::after
|
|
|
|
`]: {
|
|
|
|
boxShadow: `inset 10px 0 8px -8px ${shadowColor}`,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-cell-fix-left-last::before`]: {
|
|
|
|
backgroundColor: 'transparent !important',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-ping-right`]: {
|
|
|
|
[`&:not(${componentCls}-has-fix-right) ${componentCls}-container`]: {
|
|
|
|
position: 'relative',
|
|
|
|
|
|
|
|
'&::after': {
|
|
|
|
boxShadow: `inset -10px 0 8px -8px ${shadowColor}`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`
|
|
|
|
${componentCls}-cell-fix-right-first::after,
|
|
|
|
${componentCls}-cell-fix-right-last::after
|
|
|
|
`]: {
|
|
|
|
boxShadow: `inset -10px 0 8px -8px ${shadowColor}`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export default genFixedStyle;
|