2022-05-09 22:20:07 +08:00
|
|
|
import type { CSSObject } from '@ant-design/cssinjs';
|
2022-03-30 13:54:21 +08:00
|
|
|
import {
|
|
|
|
genBasicInputStyle,
|
|
|
|
genInputSmallStyle,
|
2022-06-02 17:31:46 +08:00
|
|
|
initInputToken,
|
2022-03-30 13:54:21 +08:00
|
|
|
type InputToken,
|
|
|
|
} from '../../input/style';
|
2022-11-23 20:22:38 +08:00
|
|
|
import type { FullToken, GenerateStyle } from '../../theme/internal';
|
|
|
|
import { genComponentStyleHook, mergeToken } from '../../theme/internal';
|
2022-09-09 10:53:03 +08:00
|
|
|
import { genFocusOutline, genFocusStyle, resetComponent } from '../../style';
|
2022-04-06 21:49:30 +08:00
|
|
|
|
|
|
|
interface PaginationToken extends InputToken<FullToken<'Pagination'>> {
|
|
|
|
paginationItemSize: number;
|
2022-03-30 13:54:21 +08:00
|
|
|
paginationFontFamily: string;
|
|
|
|
paginationItemBg: string;
|
|
|
|
paginationItemBgActive: string;
|
|
|
|
paginationFontWeightActive: number;
|
|
|
|
paginationItemSizeSM: number;
|
2022-04-06 21:49:30 +08:00
|
|
|
paginationItemInputBg: string;
|
2022-03-30 13:54:21 +08:00
|
|
|
paginationMiniOptionsSizeChangerTop: number;
|
|
|
|
paginationItemDisabledBgActive: string;
|
|
|
|
paginationItemDisabledColorActive: string;
|
|
|
|
paginationItemLinkBg: string;
|
|
|
|
inputOutlineOffset: string;
|
2022-06-02 19:27:31 +08:00
|
|
|
paginationMiniOptionsMarginInlineStart: number;
|
|
|
|
paginationMiniQuickJumperInputWidth: number;
|
|
|
|
paginationItemPaddingInline: number;
|
|
|
|
paginationEllipsisLetterSpacing: number;
|
|
|
|
paginationEllipsisTextIndent: string;
|
|
|
|
paginationSlashMarginInlineStart: number;
|
|
|
|
paginationSlashMarginInlineEnd: number;
|
2022-03-30 13:54:21 +08:00
|
|
|
}
|
|
|
|
|
2022-11-17 23:31:41 +08:00
|
|
|
const genPaginationDisabledStyle: GenerateStyle<PaginationToken, CSSObject> = (token) => {
|
2022-04-06 21:49:30 +08:00
|
|
|
const { componentCls } = token;
|
2022-03-30 13:54:21 +08:00
|
|
|
|
|
|
|
return {
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-disabled`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
'&, &:hover': {
|
|
|
|
cursor: 'not-allowed',
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-item-link`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
color: token.colorTextDisabled,
|
|
|
|
cursor: 'not-allowed',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
'&:focus-visible': {
|
|
|
|
cursor: 'not-allowed',
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-item-link`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
color: token.colorTextDisabled,
|
|
|
|
cursor: 'not-allowed',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`&${componentCls}-disabled`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
cursor: 'not-allowed',
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-item`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
cursor: 'not-allowed',
|
|
|
|
|
2022-09-20 21:50:36 +08:00
|
|
|
'&:hover, &:active': {
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
},
|
|
|
|
|
2022-03-30 13:54:21 +08:00
|
|
|
a: {
|
|
|
|
color: token.colorTextDisabled,
|
2022-09-20 21:50:36 +08:00
|
|
|
backgroundColor: 'transparent',
|
2022-03-30 13:54:21 +08:00
|
|
|
border: 'none',
|
|
|
|
cursor: 'not-allowed',
|
|
|
|
},
|
|
|
|
|
|
|
|
'&-active': {
|
2022-09-07 17:00:21 +08:00
|
|
|
borderColor: token.colorBorder,
|
2022-09-20 21:50:36 +08:00
|
|
|
backgroundColor: token.paginationItemDisabledBgActive,
|
|
|
|
|
|
|
|
'&:hover, &:active': {
|
|
|
|
backgroundColor: token.paginationItemDisabledBgActive,
|
|
|
|
},
|
2022-03-30 13:54:21 +08:00
|
|
|
|
|
|
|
a: {
|
|
|
|
color: token.paginationItemDisabledColorActive,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-item-link`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
color: token.colorTextDisabled,
|
|
|
|
cursor: 'not-allowed',
|
|
|
|
|
2022-09-20 21:50:36 +08:00
|
|
|
'&:hover, &:active': {
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-simple&`]: {
|
2022-09-20 21:50:36 +08:00
|
|
|
backgroundColor: 'transparent',
|
2022-03-30 13:54:21 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-item-link-icon`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
opacity: 0,
|
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-item-ellipsis`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
opacity: 1,
|
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-simple-pager`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
color: token.colorTextDisabled,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-11-17 23:31:41 +08:00
|
|
|
const genPaginationMiniStyle: GenerateStyle<PaginationToken, CSSObject> = (token) => {
|
2022-04-06 21:49:30 +08:00
|
|
|
const { componentCls } = token;
|
2022-03-30 13:54:21 +08:00
|
|
|
|
|
|
|
return {
|
2022-06-02 17:31:46 +08:00
|
|
|
[`&&-mini ${componentCls}-total-text, &&-mini ${componentCls}-simple-pager`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
height: token.paginationItemSizeSM,
|
|
|
|
lineHeight: `${token.paginationItemSizeSM}px`,
|
|
|
|
},
|
|
|
|
|
2022-06-02 17:31:46 +08:00
|
|
|
[`&&-mini ${componentCls}-item`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
minWidth: token.paginationItemSizeSM,
|
|
|
|
height: token.paginationItemSizeSM,
|
|
|
|
margin: 0,
|
|
|
|
lineHeight: `${token.paginationItemSizeSM - 2}px`,
|
|
|
|
},
|
|
|
|
|
2022-06-02 17:31:46 +08:00
|
|
|
[`&&-mini ${componentCls}-item:not(${componentCls}-item-active)`]: {
|
2022-09-20 21:50:36 +08:00
|
|
|
backgroundColor: 'transparent',
|
2022-03-30 13:54:21 +08:00
|
|
|
borderColor: 'transparent',
|
|
|
|
},
|
|
|
|
|
2022-06-02 17:31:46 +08:00
|
|
|
[`&&-mini ${componentCls}-prev, &&-mini ${componentCls}-next`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
minWidth: token.paginationItemSizeSM,
|
|
|
|
height: token.paginationItemSizeSM,
|
|
|
|
margin: 0,
|
|
|
|
lineHeight: `${token.paginationItemSizeSM}px`,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`
|
2022-06-02 17:31:46 +08:00
|
|
|
&&-mini ${componentCls}-prev ${componentCls}-item-link,
|
|
|
|
&&-mini ${componentCls}-next ${componentCls}-item-link
|
2022-03-30 13:54:21 +08:00
|
|
|
`]: {
|
2022-09-20 21:50:36 +08:00
|
|
|
backgroundColor: 'transparent',
|
2022-03-30 13:54:21 +08:00
|
|
|
borderColor: 'transparent',
|
|
|
|
|
|
|
|
'&::after': {
|
|
|
|
height: token.paginationItemSizeSM,
|
|
|
|
lineHeight: `${token.paginationItemSizeSM}px`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-06-02 17:31:46 +08:00
|
|
|
[`&&-mini ${componentCls}-jump-prev, &&-mini ${componentCls}-jump-next`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
height: token.paginationItemSizeSM,
|
|
|
|
marginInlineEnd: 0,
|
|
|
|
lineHeight: `${token.paginationItemSizeSM}px`,
|
|
|
|
},
|
|
|
|
|
2022-06-02 17:31:46 +08:00
|
|
|
[`&&-mini ${componentCls}-options`]: {
|
2022-06-02 19:27:31 +08:00
|
|
|
marginInlineStart: token.paginationMiniOptionsMarginInlineStart,
|
2022-03-30 13:54:21 +08:00
|
|
|
|
|
|
|
[`&-size-changer`]: {
|
|
|
|
top: token.paginationMiniOptionsSizeChangerTop,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&-quick-jumper`]: {
|
|
|
|
height: token.paginationItemSizeSM,
|
|
|
|
lineHeight: `${token.paginationItemSizeSM}px`,
|
|
|
|
|
|
|
|
input: {
|
2022-04-06 21:49:30 +08:00
|
|
|
...genInputSmallStyle(token),
|
2022-03-30 13:54:21 +08:00
|
|
|
|
2022-06-02 19:27:31 +08:00
|
|
|
width: token.paginationMiniQuickJumperInputWidth,
|
2022-03-30 13:54:21 +08:00
|
|
|
height: token.controlHeightSM,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-11-17 23:31:41 +08:00
|
|
|
const genPaginationSimpleStyle: GenerateStyle<PaginationToken, CSSObject> = (token) => {
|
2022-04-06 21:49:30 +08:00
|
|
|
const { componentCls } = token;
|
2022-03-30 13:54:21 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
[`
|
2022-04-06 21:49:30 +08:00
|
|
|
&${componentCls}-simple ${componentCls}-prev,
|
|
|
|
&${componentCls}-simple ${componentCls}-next
|
2022-03-30 13:54:21 +08:00
|
|
|
`]: {
|
|
|
|
height: token.paginationItemSizeSM,
|
|
|
|
lineHeight: `${token.paginationItemSizeSM}px`,
|
|
|
|
verticalAlign: 'top',
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-item-link`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
height: token.paginationItemSizeSM,
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
border: 0,
|
|
|
|
|
|
|
|
'&::after': {
|
|
|
|
height: token.paginationItemSizeSM,
|
|
|
|
lineHeight: `${token.paginationItemSizeSM}px`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`&${componentCls}-simple ${componentCls}-simple-pager`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
display: 'inline-block',
|
|
|
|
height: token.paginationItemSizeSM,
|
|
|
|
marginInlineEnd: token.marginXS,
|
|
|
|
|
|
|
|
input: {
|
|
|
|
boxSizing: 'border-box',
|
|
|
|
height: '100%',
|
|
|
|
marginInlineEnd: token.marginXS,
|
2022-06-02 19:27:31 +08:00
|
|
|
padding: `0 ${token.paginationItemPaddingInline}px`,
|
2022-03-30 13:54:21 +08:00
|
|
|
textAlign: 'center',
|
2022-04-06 21:49:30 +08:00
|
|
|
backgroundColor: token.paginationItemInputBg,
|
2022-11-01 15:06:38 +08:00
|
|
|
border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`,
|
|
|
|
borderRadius: token.borderRadius,
|
2022-03-30 13:54:21 +08:00
|
|
|
outline: 'none',
|
2022-11-17 23:31:41 +08:00
|
|
|
transition: `border-color ${token.motionDurationMid}`,
|
2022-11-25 12:26:04 +08:00
|
|
|
color: 'inherit',
|
2022-03-30 13:54:21 +08:00
|
|
|
|
|
|
|
'&:hover': {
|
|
|
|
borderColor: token.colorPrimary,
|
|
|
|
},
|
|
|
|
|
|
|
|
'&:focus': {
|
|
|
|
borderColor: token.colorPrimaryHover,
|
2022-09-09 10:53:03 +08:00
|
|
|
boxShadow: `${token.inputOutlineOffset}px 0 ${token.controlOutlineWidth}px ${token.controlOutline}`,
|
2022-03-30 13:54:21 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
'&[disabled]': {
|
|
|
|
color: token.colorTextDisabled,
|
2022-09-20 21:50:36 +08:00
|
|
|
backgroundColor: token.colorBgContainerDisabled,
|
2022-03-30 13:54:21 +08:00
|
|
|
borderColor: token.colorBorder,
|
|
|
|
cursor: 'not-allowed',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-11-17 23:31:41 +08:00
|
|
|
const genPaginationJumpStyle: GenerateStyle<PaginationToken, CSSObject> = (token) => {
|
2022-04-06 21:49:30 +08:00
|
|
|
const { componentCls } = token;
|
2022-03-30 13:54:21 +08:00
|
|
|
|
|
|
|
return {
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-jump-prev, ${componentCls}-jump-next`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
outline: 0,
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-item-container`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
position: 'relative',
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-item-link-icon`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
color: token.colorPrimary,
|
|
|
|
fontSize: token.fontSizeSM,
|
|
|
|
opacity: 0,
|
|
|
|
transition: `all ${token.motionDurationMid}`,
|
|
|
|
|
|
|
|
'&-svg': {
|
|
|
|
top: 0,
|
|
|
|
insetInlineEnd: 0,
|
|
|
|
bottom: 0,
|
|
|
|
insetInlineStart: 0,
|
|
|
|
margin: 'auto',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-item-ellipsis`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
position: 'absolute',
|
|
|
|
top: 0,
|
|
|
|
insetInlineEnd: 0,
|
|
|
|
bottom: 0,
|
|
|
|
insetInlineStart: 0,
|
|
|
|
display: 'block',
|
|
|
|
margin: 'auto',
|
|
|
|
color: token.colorTextDisabled,
|
|
|
|
fontFamily: 'Arial, Helvetica, sans-serif',
|
2022-06-02 19:27:31 +08:00
|
|
|
letterSpacing: token.paginationEllipsisLetterSpacing,
|
2022-03-30 13:54:21 +08:00
|
|
|
textAlign: 'center',
|
2022-06-02 19:27:31 +08:00
|
|
|
textIndent: token.paginationEllipsisTextIndent,
|
2022-03-30 13:54:21 +08:00
|
|
|
opacity: 1,
|
|
|
|
transition: `all ${token.motionDurationMid}`,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
'&:hover': {
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-item-link-icon`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
opacity: 1,
|
|
|
|
},
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-item-ellipsis`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
opacity: 0,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
'&:focus-visible': {
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-item-link-icon`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
opacity: 1,
|
|
|
|
},
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-item-ellipsis`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
opacity: 0,
|
|
|
|
},
|
2022-09-09 10:53:03 +08:00
|
|
|
...genFocusOutline(token),
|
2022-03-30 13:54:21 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`
|
2022-04-06 21:49:30 +08:00
|
|
|
${componentCls}-prev,
|
|
|
|
${componentCls}-jump-prev,
|
|
|
|
${componentCls}-jump-next
|
2022-03-30 13:54:21 +08:00
|
|
|
`]: {
|
|
|
|
marginInlineEnd: token.marginXS,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`
|
2022-04-06 21:49:30 +08:00
|
|
|
${componentCls}-prev,
|
|
|
|
${componentCls}-next,
|
|
|
|
${componentCls}-jump-prev,
|
|
|
|
${componentCls}-jump-next
|
2022-03-30 13:54:21 +08:00
|
|
|
`]: {
|
|
|
|
display: 'inline-block',
|
2022-04-06 21:49:30 +08:00
|
|
|
minWidth: token.paginationItemSize,
|
|
|
|
height: token.paginationItemSize,
|
2022-03-30 13:54:21 +08:00
|
|
|
color: token.colorText,
|
|
|
|
fontFamily: token.paginationFontFamily,
|
2022-04-06 21:49:30 +08:00
|
|
|
lineHeight: `${token.paginationItemSize}px`,
|
2022-03-30 13:54:21 +08:00
|
|
|
textAlign: 'center',
|
|
|
|
verticalAlign: 'middle',
|
|
|
|
listStyle: 'none',
|
2022-11-01 15:06:38 +08:00
|
|
|
borderRadius: token.borderRadius,
|
2022-03-30 13:54:21 +08:00
|
|
|
cursor: 'pointer',
|
2022-11-17 23:31:41 +08:00
|
|
|
transition: `all ${token.motionDurationMid}`,
|
2022-03-30 13:54:21 +08:00
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-prev, ${componentCls}-next`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
fontFamily: 'Arial, Helvetica, sans-serif',
|
|
|
|
outline: 0,
|
|
|
|
|
|
|
|
button: {
|
|
|
|
color: token.colorText,
|
|
|
|
cursor: 'pointer',
|
|
|
|
userSelect: 'none',
|
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-item-link`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
display: 'block',
|
|
|
|
width: '100%',
|
|
|
|
height: '100%',
|
|
|
|
padding: 0,
|
|
|
|
fontSize: token.fontSizeSM,
|
|
|
|
textAlign: 'center',
|
2022-09-07 17:00:21 +08:00
|
|
|
backgroundColor: 'transparent',
|
2022-11-01 15:06:38 +08:00
|
|
|
border: `${token.lineWidth}px ${token.lineType} transparent`,
|
|
|
|
borderRadius: token.borderRadius,
|
2022-03-30 13:54:21 +08:00
|
|
|
outline: 'none',
|
2022-11-17 23:31:41 +08:00
|
|
|
transition: `border ${token.motionDurationMid}`,
|
2022-03-30 13:54:21 +08:00
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`&:focus-visible ${componentCls}-item-link`]: {
|
2022-09-09 10:53:03 +08:00
|
|
|
...genFocusOutline(token),
|
2022-03-30 13:54:21 +08:00
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`&:hover ${componentCls}-item-link`]: {
|
2022-09-20 21:50:36 +08:00
|
|
|
backgroundColor: token.colorBgTextHover,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&:active ${componentCls}-item-link`]: {
|
|
|
|
backgroundColor: token.colorBgTextActive,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&${componentCls}-disabled:hover`]: {
|
|
|
|
[`${componentCls}-item-link`]: {
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
},
|
2022-03-30 13:54:21 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-slash`]: {
|
2022-06-02 19:27:31 +08:00
|
|
|
marginInlineEnd: token.paginationSlashMarginInlineEnd,
|
|
|
|
marginInlineStart: token.paginationSlashMarginInlineStart,
|
2022-03-30 13:54:21 +08:00
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-options`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
display: 'inline-block',
|
|
|
|
marginInlineStart: token.margin,
|
|
|
|
verticalAlign: 'middle',
|
|
|
|
|
|
|
|
'&-size-changer.-select': {
|
|
|
|
display: 'inline-block',
|
|
|
|
width: 'auto',
|
|
|
|
},
|
|
|
|
|
|
|
|
'&-quick-jumper': {
|
|
|
|
display: 'inline-block',
|
|
|
|
height: token.controlHeight,
|
|
|
|
marginInlineStart: token.marginXS,
|
|
|
|
lineHeight: `${token.controlHeight}px`,
|
|
|
|
verticalAlign: 'top',
|
|
|
|
|
|
|
|
input: {
|
2022-04-06 21:49:30 +08:00
|
|
|
...genBasicInputStyle(token),
|
2022-03-30 13:54:21 +08:00
|
|
|
|
2022-06-02 19:27:31 +08:00
|
|
|
width: token.controlHeightLG * 1.25,
|
2022-03-30 13:54:21 +08:00
|
|
|
height: token.controlHeight,
|
2022-11-17 22:20:08 +08:00
|
|
|
boxSizing: 'border-box',
|
2022-03-30 13:54:21 +08:00
|
|
|
margin: 0,
|
|
|
|
marginInlineStart: token.marginXS,
|
|
|
|
marginInlineEnd: token.marginXS,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-11-17 23:31:41 +08:00
|
|
|
const genPaginationItemStyle: GenerateStyle<PaginationToken, CSSObject> = (token) => {
|
2022-04-06 21:49:30 +08:00
|
|
|
const { componentCls } = token;
|
2022-03-30 13:54:21 +08:00
|
|
|
|
|
|
|
return {
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-item`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
display: 'inline-block',
|
2022-04-06 21:49:30 +08:00
|
|
|
minWidth: token.paginationItemSize,
|
|
|
|
height: token.paginationItemSize,
|
2022-03-30 13:54:21 +08:00
|
|
|
marginInlineEnd: token.marginXS,
|
|
|
|
fontFamily: token.paginationFontFamily,
|
2022-04-06 21:49:30 +08:00
|
|
|
lineHeight: `${token.paginationItemSize - 2}px`,
|
2022-03-30 13:54:21 +08:00
|
|
|
textAlign: 'center',
|
|
|
|
verticalAlign: 'middle',
|
|
|
|
listStyle: 'none',
|
2022-09-07 17:00:21 +08:00
|
|
|
backgroundColor: 'transparent',
|
2022-11-01 15:06:38 +08:00
|
|
|
border: `${token.lineWidth}px ${token.lineType} transparent`,
|
|
|
|
borderRadius: token.borderRadius,
|
2022-03-30 13:54:21 +08:00
|
|
|
outline: 0,
|
|
|
|
cursor: 'pointer',
|
|
|
|
userSelect: 'none',
|
|
|
|
|
|
|
|
a: {
|
|
|
|
display: 'block',
|
2022-06-02 19:27:31 +08:00
|
|
|
padding: `0 ${token.paginationItemPaddingInline}px`,
|
2022-03-30 13:54:21 +08:00
|
|
|
color: token.colorText,
|
|
|
|
transition: 'none',
|
|
|
|
|
|
|
|
'&:hover': {
|
|
|
|
textDecoration: 'none',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-09-20 21:50:36 +08:00
|
|
|
[`&:not(${componentCls}-item-active)`]: {
|
|
|
|
'&:hover': {
|
2022-11-17 23:31:41 +08:00
|
|
|
transition: `all ${token.motionDurationMid}`,
|
2022-09-20 21:50:36 +08:00
|
|
|
backgroundColor: token.colorBgTextHover,
|
|
|
|
},
|
2022-03-30 13:54:21 +08:00
|
|
|
|
2022-09-20 21:50:36 +08:00
|
|
|
'&:active': {
|
|
|
|
backgroundColor: token.colorBgTextActive,
|
2022-03-30 13:54:21 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// cannot merge with `&:hover`
|
|
|
|
// see https://github.com/ant-design/ant-design/pull/34002
|
2022-09-09 10:53:03 +08:00
|
|
|
...genFocusStyle(token),
|
2022-03-30 13:54:21 +08:00
|
|
|
|
|
|
|
'&-active': {
|
|
|
|
fontWeight: token.paginationFontWeightActive,
|
2022-09-20 21:50:36 +08:00
|
|
|
backgroundColor: token.paginationItemBgActive,
|
2022-03-30 13:54:21 +08:00
|
|
|
borderColor: token.colorPrimary,
|
|
|
|
|
|
|
|
a: {
|
|
|
|
color: token.colorPrimary,
|
|
|
|
},
|
|
|
|
|
|
|
|
'&:hover': {
|
|
|
|
borderColor: token.colorPrimaryHover,
|
|
|
|
},
|
|
|
|
|
|
|
|
'&:hover a': {
|
|
|
|
color: token.colorPrimaryHover,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-11-17 23:31:41 +08:00
|
|
|
const genPaginationStyle: GenerateStyle<PaginationToken, CSSObject> = (token) => {
|
2022-04-06 21:49:30 +08:00
|
|
|
const { componentCls } = token;
|
2022-03-30 13:54:21 +08:00
|
|
|
|
|
|
|
return {
|
2022-04-06 21:49:30 +08:00
|
|
|
[componentCls]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
...resetComponent(token),
|
|
|
|
|
|
|
|
'ul, ol': {
|
|
|
|
margin: 0,
|
|
|
|
padding: 0,
|
|
|
|
listStyle: 'none',
|
|
|
|
},
|
|
|
|
|
|
|
|
'&::after': {
|
|
|
|
display: 'block',
|
|
|
|
clear: 'both',
|
|
|
|
height: 0,
|
|
|
|
overflow: 'hidden',
|
|
|
|
visibility: 'hidden',
|
|
|
|
content: '""',
|
|
|
|
},
|
|
|
|
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-total-text`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
display: 'inline-block',
|
2022-04-06 21:49:30 +08:00
|
|
|
height: token.paginationItemSize,
|
2022-03-30 13:54:21 +08:00
|
|
|
marginInlineEnd: token.marginXS,
|
2022-04-06 21:49:30 +08:00
|
|
|
lineHeight: `${token.paginationItemSize - 2}px`,
|
2022-03-30 13:54:21 +08:00
|
|
|
verticalAlign: 'middle',
|
|
|
|
},
|
|
|
|
|
|
|
|
// item style
|
|
|
|
...genPaginationItemStyle(token),
|
|
|
|
|
|
|
|
// jump btn style
|
|
|
|
...genPaginationJumpStyle(token),
|
|
|
|
|
|
|
|
// simple style
|
|
|
|
...genPaginationSimpleStyle(token),
|
|
|
|
|
|
|
|
// mini style
|
|
|
|
...genPaginationMiniStyle(token),
|
|
|
|
|
|
|
|
// disabled style
|
|
|
|
...genPaginationDisabledStyle(token),
|
|
|
|
|
|
|
|
// media query style
|
|
|
|
[`@media only screen and (max-width: ${token.screenLG}px)`]: {
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-item`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
'&-after-jump-prev, &-before-jump-next': {
|
|
|
|
display: 'none',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`@media only screen and (max-width: ${token.screenSM}px)`]: {
|
2022-04-06 21:49:30 +08:00
|
|
|
[`${componentCls}-options`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
display: 'none',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
// rtl style
|
2022-04-06 21:49:30 +08:00
|
|
|
[`&${token.componentCls}-rtl`]: {
|
2022-03-30 13:54:21 +08:00
|
|
|
direction: 'rtl',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-11-17 23:31:41 +08:00
|
|
|
const genBorderedStyle: GenerateStyle<PaginationToken> = (token) => {
|
2022-09-13 11:52:56 +08:00
|
|
|
const { componentCls } = token;
|
|
|
|
|
|
|
|
return {
|
2022-09-20 21:50:36 +08:00
|
|
|
[`${componentCls}${componentCls}-disabled`]: {
|
2022-09-13 11:52:56 +08:00
|
|
|
'&, &:hover': {
|
|
|
|
[`${componentCls}-item-link`]: {
|
|
|
|
borderColor: token.colorBorder,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
'&:focus-visible': {
|
|
|
|
[`${componentCls}-item-link`]: {
|
|
|
|
borderColor: token.colorBorder,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2022-09-20 21:50:36 +08:00
|
|
|
[`${componentCls}-item, ${componentCls}-item-link`]: {
|
|
|
|
backgroundColor: token.colorBgContainerDisabled,
|
2022-09-13 11:52:56 +08:00
|
|
|
borderColor: token.colorBorder,
|
2022-09-20 21:50:36 +08:00
|
|
|
|
|
|
|
[`&:hover:not(${componentCls}-item-active)`]: {
|
|
|
|
backgroundColor: token.colorBgContainerDisabled,
|
|
|
|
borderColor: token.colorBorder,
|
|
|
|
|
|
|
|
a: {
|
|
|
|
color: token.colorTextDisabled,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&${componentCls}-item-active`]: {
|
|
|
|
backgroundColor: token.paginationItemDisabledBgActive,
|
|
|
|
},
|
2022-09-13 11:52:56 +08:00
|
|
|
},
|
|
|
|
|
2022-09-20 21:50:36 +08:00
|
|
|
[`${componentCls}-prev, ${componentCls}-next`]: {
|
|
|
|
'&:hover button': {
|
|
|
|
backgroundColor: token.colorBgContainerDisabled,
|
|
|
|
borderColor: token.colorBorder,
|
|
|
|
color: token.colorTextDisabled,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-item-link`]: {
|
|
|
|
backgroundColor: token.colorBgContainerDisabled,
|
|
|
|
borderColor: token.colorBorder,
|
|
|
|
},
|
2022-09-13 11:52:56 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[componentCls]: {
|
|
|
|
[`${componentCls}-prev, ${componentCls}-next`]: {
|
|
|
|
'&:hover button': {
|
|
|
|
borderColor: token.colorPrimaryHover,
|
2022-09-20 21:50:36 +08:00
|
|
|
backgroundColor: token.paginationItemBg,
|
2022-09-13 11:52:56 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-item-link`]: {
|
|
|
|
backgroundColor: token.paginationItemLinkBg,
|
|
|
|
borderColor: token.colorBorder,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&:hover ${componentCls}-item-link`]: {
|
|
|
|
borderColor: token.colorPrimary,
|
2022-09-20 21:50:36 +08:00
|
|
|
backgroundColor: token.paginationItemBg,
|
|
|
|
color: token.colorPrimary,
|
|
|
|
},
|
|
|
|
|
|
|
|
[`&${componentCls}-disabled`]: {
|
|
|
|
[`${componentCls}-item-link`]: {
|
|
|
|
borderColor: token.colorBorder,
|
|
|
|
color: token.colorTextDisabled,
|
|
|
|
},
|
2022-09-13 11:52:56 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
[`${componentCls}-item`]: {
|
|
|
|
backgroundColor: token.paginationItemBg,
|
2022-11-01 15:06:38 +08:00
|
|
|
border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`,
|
2022-09-13 11:52:56 +08:00
|
|
|
|
2022-09-20 21:50:36 +08:00
|
|
|
[`&:hover:not(${componentCls}-item-active)`]: {
|
2022-09-13 11:52:56 +08:00
|
|
|
borderColor: token.colorPrimary,
|
2022-09-20 21:50:36 +08:00
|
|
|
backgroundColor: token.paginationItemBg,
|
|
|
|
|
|
|
|
a: {
|
|
|
|
color: token.colorPrimary,
|
|
|
|
},
|
2022-09-13 11:52:56 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
'&-active': {
|
|
|
|
borderColor: token.colorPrimary,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2022-03-30 13:54:21 +08:00
|
|
|
// ============================== Export ==============================
|
2022-11-17 23:31:41 +08:00
|
|
|
export default genComponentStyleHook('Pagination', (token) => {
|
2022-04-11 16:04:00 +08:00
|
|
|
const paginationToken = mergeToken<PaginationToken>(
|
|
|
|
token,
|
|
|
|
{
|
|
|
|
paginationItemSize: token.controlHeight,
|
|
|
|
paginationFontFamily: token.fontFamily,
|
2022-06-28 20:33:01 +08:00
|
|
|
paginationItemBg: token.colorBgContainer,
|
|
|
|
paginationItemBgActive: token.colorBgContainer,
|
2022-06-02 19:27:31 +08:00
|
|
|
paginationFontWeightActive: token.fontWeightStrong,
|
|
|
|
paginationItemSizeSM: token.controlHeightSM,
|
2022-06-28 20:33:01 +08:00
|
|
|
paginationItemInputBg: token.colorBgContainer,
|
2022-04-11 16:04:00 +08:00
|
|
|
paginationMiniOptionsSizeChangerTop: 0,
|
2022-06-02 19:27:31 +08:00
|
|
|
paginationItemDisabledBgActive: token.controlItemBgActiveDisabled,
|
2022-04-11 16:04:00 +08:00
|
|
|
paginationItemDisabledColorActive: token.colorTextDisabled,
|
2022-06-28 20:33:01 +08:00
|
|
|
paginationItemLinkBg: token.colorBgContainer,
|
2022-04-11 16:04:00 +08:00
|
|
|
inputOutlineOffset: '0 0',
|
2022-06-02 19:27:31 +08:00
|
|
|
paginationMiniOptionsMarginInlineStart: token.marginXXS / 2,
|
|
|
|
paginationMiniQuickJumperInputWidth: token.controlHeightLG * 1.1,
|
|
|
|
paginationItemPaddingInline: token.marginXXS * 1.5,
|
|
|
|
paginationEllipsisLetterSpacing: token.marginXXS / 2,
|
|
|
|
paginationSlashMarginInlineStart: token.marginXXS,
|
|
|
|
paginationSlashMarginInlineEnd: token.marginSM,
|
|
|
|
paginationEllipsisTextIndent: '0.13em', // magic for ui experience
|
2022-04-11 16:04:00 +08:00
|
|
|
},
|
|
|
|
initInputToken(token),
|
|
|
|
);
|
2022-09-13 11:52:56 +08:00
|
|
|
return [
|
|
|
|
genPaginationStyle(paginationToken),
|
|
|
|
token.wireframe && genBorderedStyle(paginationToken),
|
|
|
|
];
|
2022-04-06 21:49:30 +08:00
|
|
|
});
|