-
Notifications
You must be signed in to change notification settings - Fork 209
feat: implement jump to page #4113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
4a1ead1 to
ab579b4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To update snapshots: npm run build && npx jest -c jest.unit.config.js -u documenter test-util
src/input/internal.tsx
Outdated
| }, | ||
| }; | ||
|
|
||
| const renderMainInput = () => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const renderMainInput = <WithNativeAttributes....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
| margin-block-start: calc(awsui.$space-scaled-xs * -1); | ||
| } | ||
|
|
||
| .inline-label { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this to mixin so it can be reused between select and input, probably move to https://github.com/cloudscape-design/components/blob/main/src/internal/styles/forms/mixins.scss
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved
src/pagination/internal.tsx
Outdated
| }; | ||
|
|
||
| const defaultI18nStrings: Required<PaginationProps.I18nStrings> = { | ||
| jumpToPageLabel: 'Page', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove hardcoded strings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
src/pagination/interfaces.ts
Outdated
| loading?: boolean; | ||
| } | ||
|
|
||
| export interface JumpToPageRef { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name Ref
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
src/pagination/internal.tsx
Outdated
| type InternalPaginationProps = PaginationProps & InternalBaseComponentProps; | ||
| type InternalPaginationProps = PaginationProps & | ||
| InternalBaseComponentProps & { | ||
| jumpToPageRef?: React.Ref<PaginationProps.JumpToPageRef>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use forwardRef on the internal component as well, rather than manually adding it to the props
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
src/pagination/internal.tsx
Outdated
| function handleJumpToPageClick(requestedPageIndex: number) { | ||
| if (requestedPageIndex < 1) { | ||
| // Out of range lower bound - navigate to first page | ||
| setJumpToPageValue('1'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace these 3 lines with handlePageClick(1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
src/pagination/internal.tsx
Outdated
| handlePageClick(requestedPageIndex); | ||
| } else { | ||
| // Out of range - set error and navigate to last page | ||
| setHasError(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use handlePageClick here (with additional param for error state)
src/pagination/internal.tsx
Outdated
| tableComponentContext.paginationRef.current.openEnd = openEnd; | ||
| } | ||
|
|
||
| const renderJumpToPageButton = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plain value rather than function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
| /** | ||
| * Returns the error popover for jump to page. | ||
| */ | ||
| findPopover(): PopoverWrapper | null { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
findJumpToPagePopover
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Andrei Zhaleznichenka <zhalea@amazon.de>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are some unrelated changes in the i18n folder, can you remove them? (I've just merged the latest from main into this PR branch, so there should no longer be any changes within the i18n folder needed at all)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did I do it? I did git checkout upstream/main -- src/i18n but diff shows the new jump to page strings removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nvm, forgot to fetch :) done
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4113 +/- ##
==========================================
- Coverage 97.15% 97.14% -0.01%
==========================================
Files 875 878 +3
Lines 25673 25796 +123
Branches 9293 9334 +41
==========================================
+ Hits 24942 25060 +118
- Misses 684 688 +4
- Partials 47 48 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
The current pagination component forces users to navigate sequentially through pages, creating poor user experience for large datasets. Users frequently need to access specific pages (e.g., jumping from page 1 to page 50) but must click through each intermediate page, leading to time-consuming navigation for large datasets. This change proposes additional options for user to navigate to a specific page.
How has this been tested?
Added examples of open-ended and closed-ended scenarios under tables pages
Review checklist
The following items are to be evaluated by the author(s) and the reviewer(s).
Correctness
CONTRIBUTING.md.CONTRIBUTING.md.Security
checkSafeUrlfunction.Testing
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.