ant-design/components/table/style/sticky.ts
lijianan a1f77f3694
feat: Table support cssVar (#45856)
* feat: Table support cssVar

* fix: fix

* fix: fix

* Update check-cssinjs.tsx

Signed-off-by: lijianan <574980606@qq.com>

* Update components/table/style/fixed.ts

Co-authored-by: MadCcc <madccc@foxmail.com>
Signed-off-by: lijianan <574980606@qq.com>

* fix: fix

* fix: fix

* fix: fix

* fix: fix

* fix: fix

* fix: fix

* fix: fix

* fix: fix

* feat: optimize token

* chore: update

---------

Signed-off-by: lijianan <574980606@qq.com>
Co-authored-by: MadCcc <madccc@foxmail.com>
Co-authored-by: MadCcc <1075746765@qq.com>
2023-11-17 13:46:41 +08:00

65 lines
1.7 KiB
TypeScript

import { unit, type CSSObject } from '@ant-design/cssinjs';
import type { GenerateStyle } from '../../theme/internal';
import type { TableToken } from './index';
const genStickyStyle: GenerateStyle<TableToken, CSSObject> = (token) => {
const {
componentCls,
opacityLoading,
tableScrollThumbBg,
tableScrollThumbBgHover,
tableScrollThumbSize,
tableScrollBg,
zIndexTableSticky,
stickyScrollBarBorderRadius,
lineWidth,
lineType,
tableBorderColor,
} = token;
const tableBorder = `${unit(lineWidth)} ${lineType} ${tableBorderColor}`;
return {
[`${componentCls}-wrapper`]: {
[`${componentCls}-sticky`]: {
'&-holder': {
position: 'sticky',
zIndex: zIndexTableSticky,
background: token.colorBgContainer,
},
'&-scroll': {
position: 'sticky',
bottom: 0,
height: `${unit(tableScrollThumbSize)} !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: stickyScrollBarBorderRadius,
transition: `all ${token.motionDurationSlow}, transform none`,
position: 'absolute',
bottom: 0,
'&:hover, &-active': {
backgroundColor: tableScrollThumbBgHover,
},
},
},
},
},
};
};
export default genStickyStyle;