diff --git a/components/pagination/Pagination.tsx b/components/pagination/Pagination.tsx index 114043017..ab497023d 100644 --- a/components/pagination/Pagination.tsx +++ b/components/pagination/Pagination.tsx @@ -82,7 +82,7 @@ export default defineComponent({ props: paginationProps(), // emits: ['change', 'showSizeChange', 'update:current', 'update:pageSize'], setup(props, { slots, attrs }) { - const { prefixCls, configProvider, direction } = useConfigInject('pagination', props); + const { prefixCls, configProvider, direction, size } = useConfigInject('pagination', props); // style const [wrapSSR, hashId] = useStyle(prefixCls); @@ -94,50 +94,45 @@ export default defineComponent({ const [locale] = useLocaleReceiver('Pagination', enUS, toRef(props, 'locale')); const getIconsProps = (pre: string) => { const ellipsis = •••; - let prevIcon = ( + const prevIcon = ( ); - let nextIcon = ( + const nextIcon = ( ); - let jumpPrevIcon = ( + const jumpPrevIcon = ( - {/* You can use transition effects in the container :) */}
- + {direction.value === 'rtl' ? ( + + ) : ( + + )} {ellipsis}
); - let jumpNextIcon = ( + const jumpNextIcon = ( - {/* You can use transition effects in the container :) */}
- + {direction.value === 'rtl' ? ( + + ) : ( + + )} {ellipsis}
); - // change arrows direction in right-to-left direction - if (direction.value === 'rtl') { - [prevIcon, nextIcon] = [nextIcon, prevIcon]; - [jumpPrevIcon, jumpNextIcon] = [jumpNextIcon, jumpPrevIcon]; - } - return { - prevIcon, - nextIcon, - jumpPrevIcon, - jumpNextIcon, - }; + return { prevIcon, nextIcon, jumpPrevIcon, jumpNextIcon }; }; return () => { const { - size, itemRender = slots.itemRender, buildOptionText = slots.buildOptionText, selectComponentClass, @@ -145,7 +140,8 @@ export default defineComponent({ ...restProps } = props; - const isSmall = size === 'small' || !!(breakpoint.value?.xs && !size && responsive); + const isSmall = + size.value === 'small' || !!(breakpoint.value?.xs && !size.value && responsive); const paginationProps = { ...restProps, ...getIconsProps(prefixCls.value), @@ -156,7 +152,10 @@ export default defineComponent({ buildOptionText, ...attrs, class: classNames( - { mini: isSmall, [`${prefixCls.value}-rtl`]: direction.value === 'rtl' }, + { + [`${prefixCls.value}-mini`]: isSmall, + [`${prefixCls.value}-rtl`]: direction.value === 'rtl', + }, attrs.class, hashId.value, ), diff --git a/components/pagination/style/index.tsx b/components/pagination/style/index.tsx index 83d9df2c0..b0502b454 100644 --- a/components/pagination/style/index.tsx +++ b/components/pagination/style/index.tsx @@ -57,7 +57,16 @@ const genPaginationDisabledStyle: GenerateStyle = to [`&${componentCls}-disabled`]: { cursor: 'not-allowed', - + [`&${componentCls}-mini`]: { + [` + &:hover ${componentCls}-item:not(${componentCls}-item-active), + &:active ${componentCls}-item:not(${componentCls}-item-active), + &:hover ${componentCls}-item-link, + &:active ${componentCls}-item-link + `]: { + backgroundColor: 'transparent', + }, + }, [`${componentCls}-item`]: { cursor: 'not-allowed', @@ -89,27 +98,39 @@ const genPaginationDisabledStyle: GenerateStyle = to [`${componentCls}-item-link`]: { color: token.colorTextDisabled, cursor: 'not-allowed', - '&:hover, &:active': { backgroundColor: 'transparent', }, - [`${componentCls}-simple&`]: { backgroundColor: 'transparent', + '&:hover, &:active': { + backgroundColor: 'transparent', + }, }, }, - [`${componentCls}-item-link-icon`]: { - opacity: 0, - }, - - [`${componentCls}-item-ellipsis`]: { - opacity: 1, - }, - [`${componentCls}-simple-pager`]: { color: token.colorTextDisabled, }, + + [`${componentCls}-jump-prev, ${componentCls}-jump-next`]: { + [`${componentCls}-item-link-icon`]: { + opacity: 0, + }, + + [`${componentCls}-item-ellipsis`]: { + opacity: 1, + }, + }, + }, + [`&${componentCls}-simple`]: { + [`${componentCls}-prev, ${componentCls}-next`]: { + [`&${componentCls}-disabled ${componentCls}-item-link`]: { + '&:hover, &:active': { + backgroundColor: 'transparent', + }, + }, + }, }, }; }; @@ -134,6 +155,12 @@ const genPaginationMiniStyle: GenerateStyle = token [`&${componentCls}-mini ${componentCls}-item:not(${componentCls}-item-active)`]: { backgroundColor: 'transparent', borderColor: 'transparent', + '&:hover': { + backgroundColor: token.colorBgTextHover, + }, + '&:active': { + backgroundColor: token.colorBgTextActive, + }, }, [`&${componentCls}-mini ${componentCls}-prev, &${componentCls}-mini ${componentCls}-next`]: { @@ -141,6 +168,15 @@ const genPaginationMiniStyle: GenerateStyle = token height: token.paginationItemSizeSM, margin: 0, lineHeight: `${token.paginationItemSizeSM}px`, + [`&:hover ${componentCls}-item-link`]: { + backgroundColor: token.colorBgTextHover, + }, + [`&:active ${componentCls}-item-link`]: { + backgroundColor: token.colorBgTextActive, + }, + [`&${componentCls}-disabled:hover ${componentCls}-item-link`]: { + backgroundColor: 'transparent', + }, }, [` @@ -200,7 +236,12 @@ const genPaginationSimpleStyle: GenerateStyle = toke height: token.paginationItemSizeSM, backgroundColor: 'transparent', border: 0, - + '&:hover': { + backgroundColor: token.colorBgTextHover, + }, + '&:active': { + backgroundColor: token.colorBgTextActive, + }, '&::after': { height: token.paginationItemSizeSM, lineHeight: `${token.paginationItemSizeSM}px`,