-
Notifications
You must be signed in to change notification settings - Fork 330
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
Pagination size selector props are grouped with the pageSizeChanger
prop on rc-pagination
#597
base: master
Are you sure you want to change the base?
Conversation
… showSearch, size options, and onChange together.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Waiting for the code review of this pull request. This pull request depends on fixing the Ant Design pagination issue |
docs/examples/pageSizeChanger.tsx
Outdated
showSizeChanger | ||
pageSizeChanger={{ | ||
options: [10, 25, 50, 75, 100], | ||
showSearch: false, | ||
onChange: pageSizeOnChange, | ||
}} |
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.
showSizeChanger | |
pageSizeChanger={{ | |
options: [10, 25, 50, 75, 100], | |
showSearch: false, | |
onChange: pageSizeOnChange, | |
}} | |
showSizeChanger={{ | |
options: [10, 25, 50, 75, 100], | |
showSearch: false, | |
onChange: pageSizeOnChange, | |
}} |
Instead of adding a new pageSizeChanger
prop, we could reuse the showSizeChanger
prop for accepting object value too.
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.
@afc163 Will change and update this pull request as soon as possible.
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 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.
…nt/pageSizeChanger-option-for-pagination
…Changer-option-for-pagination Fixed for test cases coverage failed on the GitHub actions
@afc163 Code review changes have been addressed. Please review these changes. |
quickGo={shouldDisplayQuickJumper ? handleChange : null} | ||
goButton={gotoButton} | ||
onChange={typeof showSizeChanger === 'object' && showSizeChanger?.onChange} |
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.
changeSize and onChange is basicly same function, we should unify them to one
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.
@afc163 Can I remove onChange from showSizeChanger?
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.
LGTM, Pagination's onChange
could be enough in most cases.
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.
Ok I will remove it
@@ -588,9 +588,11 @@ const Pagination: React.FC<PaginationProps> = (props) => { | |||
selectPrefixCls={selectPrefixCls} | |||
changeSize={showSizeChanger ? changePageSize : null} | |||
pageSize={pageSize} | |||
pageSizeOptions={pageSizeOptions} | |||
pageSizeOptions={(typeof showSizeChanger === 'object' && showSizeChanger?.options) || pageSizeOptions} |
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.
showSizeChanger
should be assigned to a default object value if showSizeChanger={true}
. Then we don't need typeof showSizeChanger
here.
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.
ping
changeSize?.(Number(value)); | ||
if (onChange && typeof onChange === 'function') { | ||
onChange?.(Number(value)); | ||
} |
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.
changeSize
and onChange
is basicly same function, we should unify them to one.
@@ -128,7 +135,7 @@ const Options: React.FC<OptionsProps> = (props) => { | |||
<Select | |||
disabled={disabled} | |||
prefixCls={selectPrefixCls} | |||
showSearch={false} | |||
showSearch={showSearch} | |||
className={`${prefixCls}-size-changer`} | |||
optionLabelProp="children" | |||
popupMatchSelectWidth={false} |
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.
Could we pass the whole showSizeChanger object to Select? That we could customize Select as needed.
showSizeChanger={{
disabled: true,
className: 'xxx',
style={{ width: 300 }}
popupMatchSelectWidth: 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.
@afc163 Will address these changes next commit
Ant Design Pagination enhanced feature added in ant-design/ant-design#46757 depends on this PR changes