Skip to content

Commit

Permalink
fix: quick jump render logic (#553)
Browse files Browse the repository at this point in the history
* test: add unit test case

* fix: quick jump render logic

ref: ant-design/ant-design#46671

* test: fix demo test error

* chore: update demo

* chore: update snap

* test: add unit test case

* fix: simple quick jumper custom goButton bug
  • Loading branch information
Wxh16144 committed Dec 28, 2023
1 parent 455c92a commit ba13760
Show file tree
Hide file tree
Showing 6 changed files with 3,598 additions and 1,036 deletions.
12 changes: 12 additions & 0 deletions docs/examples/simple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ export default () => {
showSizeChanger
selectComponentClass={Select}
/>
<hr />
<a href="https://github.com/ant-design/ant-design/issues/46671">
Antd #46671
</a>
<Pagination
simple
defaultCurrent={1}
total={50}
showSizeChanger
showQuickJumper
selectComponentClass={Select}
/>
</>
);
};
39 changes: 22 additions & 17 deletions src/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -348,27 +348,32 @@ const Pagination: React.FC<PaginationProps> = (props) => {
let simplePager: React.ReactNode = null;

if (simple) {
if (typeof goButton === 'boolean') {
// ====== Simple quick jump ======
if (goButton) {
if (typeof goButton === 'boolean') {
gotoButton = (
<button type="button" onClick={handleGoTO} onKeyUp={handleGoTO}>
{locale.jump_to_confirm}
</button>
);
} else {
gotoButton = (
<span onClick={handleGoTO} onKeyUp={handleGoTO}>
{goButton}
</span>
);
}

gotoButton = (
<button type="button" onClick={handleGoTO} onKeyUp={handleGoTO}>
{locale.jump_to_confirm}
</button>
<li
title={showTitle ? `${locale.jump_to}${current}/${allPages}` : null}
className={`${prefixCls}-simple-pager`}
>
{gotoButton}
</li>
);
} else {
<span onClick={handleGoTO} onKeyUp={handleGoTO}>
{goButton}
</span>;
}

gotoButton = (
<li
title={showTitle ? `${locale.jump_to}${current}/${allPages}` : null}
className={`${prefixCls}-simple-pager`}
>
{gotoButton}
</li>
);

simplePager = (
<li
title={showTitle ? `${current}/${allPages}` : null}
Expand Down

1 comment on commit ba13760

@vercel
Copy link

@vercel vercel bot commented on ba13760 Dec 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.