mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-05 05:28:20 +08:00
8e4f1c6836
* refactor: token update * chore: add js doc * test: fix lint * test: update test
60 lines
1.6 KiB
TypeScript
60 lines
1.6 KiB
TypeScript
import type { CSSObject } from '@ant-design/cssinjs';
|
|
import type { GenerateStyle } from '../../theme';
|
|
import type { TableToken } from './index';
|
|
|
|
const genStickyStyle: GenerateStyle<TableToken, CSSObject> = token => {
|
|
const {
|
|
componentCls,
|
|
opacityLoading,
|
|
tableScrollThumbBg,
|
|
tableScrollThumbBgHover,
|
|
tableScrollThumbSize,
|
|
tableScrollBg,
|
|
zIndexTableSticky,
|
|
} = token;
|
|
const tableBorder = `${token.controlLineWidth}px ${token.controlLineType} ${token.tableBorderColor}`;
|
|
return {
|
|
[`${componentCls}-wrapper`]: {
|
|
[`${componentCls}-sticky`]: {
|
|
'&-holder': {
|
|
position: 'sticky',
|
|
zIndex: zIndexTableSticky,
|
|
background: token.colorBgContainer,
|
|
},
|
|
|
|
'&-scroll': {
|
|
position: 'sticky',
|
|
bottom: 0,
|
|
height: `${tableScrollThumbSize}px !important`,
|
|
zIndex: zIndexTableSticky,
|
|
display: 'flex',
|
|
alignItems: 'center',
|
|
background: tableScrollBg,
|
|
borderTop: tableBorder,
|
|
opacity: opacityLoading,
|
|
|
|
'&:hover': {
|
|
transformOrigin: 'center bottom',
|
|
},
|
|
|
|
// fake scrollbar style of sticky
|
|
'&-bar': {
|
|
height: tableScrollThumbSize,
|
|
backgroundColor: tableScrollThumbBg,
|
|
borderRadius: 100,
|
|
transition: `all ${token.motionDurationSlow}, transform none`,
|
|
position: 'absolute',
|
|
bottom: 0,
|
|
|
|
'&:hover, &-active': {
|
|
backgroundColor: tableScrollThumbBgHover,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|
|
};
|
|
|
|
export default genStickyStyle;
|