Skip to content
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's pageSizeOptions Select component's showSearch props handled dynamically. #554

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ ReactDOM.render(<Pagination />, container);
| showSizeChanger | show pageSize changer | Bool | `false` when total less then `totalBoundaryShowSizeChanger`, `true` when otherwise |
| totalBoundaryShowSizeChanger | when total larger than it, `showSizeChanger` will be true | number | 50 |
| pageSizeOptions | specify the sizeChanger selections | Array<String> | ['10', '20', '50', '100'] |
| showSizeOptionsSearch | show the pageSizeOptions Select component search | Bool | Default value is `false`. `false` when pageSizeOptions Select component disabled the showSearch, `true` when pageSizeOptions Select component enabled the showSearch |
| onShowSizeChange | pageSize change callback | Function(current, size) | - |
| hideOnSinglePage | hide on single page | Bool | false |
| showPrevNextJumpers | show jump-prev, jump-next | Bool | true |
Expand Down
2 changes: 2 additions & 0 deletions docs/examples/jumper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const App = () => (
total={8}
/>
<br />
<h3>Page options showSizeOptionsSearch is enabled</h3>
<Pagination
selectComponentClass={Select}
showQuickJumper
Expand All @@ -58,6 +59,7 @@ const App = () => (
onChange={onChange}
pageSize={10}
total={8}
showSizeOptionsSearch={true}
/>
</>
);
Expand Down
4 changes: 3 additions & 1 deletion src/Options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface OptionsProps {
selectComponentClass: React.ComponentType<Partial<InternalSelectProps>> & {
Option?: React.ComponentType<Partial<OptionProps>>;
};
showSizeOptionsSearch?: boolean;
}

const defaultPageSizeOptions = ['10', '20', '50', '100'];
Expand All @@ -42,6 +43,7 @@ const Options: React.FC<OptionsProps> = (props) => {
selectPrefixCls,
disabled,
buildOptionText,
showSizeOptionsSearch
} = props;

const [goInputText, setGoInputText] = React.useState('');
Expand Down Expand Up @@ -128,7 +130,7 @@ const Options: React.FC<OptionsProps> = (props) => {
<Select
disabled={disabled}
prefixCls={selectPrefixCls}
showSearch={false}
showSearch={showSizeOptionsSearch}
className={`${prefixCls}-size-changer`}
optionLabelProp="children"
popupMatchSelectWidth={false}
Expand Down
2 changes: 2 additions & 0 deletions src/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const Pagination: React.FC<PaginationProps> = (props) => {
showTotal,
showSizeChanger: showSizeChangerProp,
pageSizeOptions,
showSizeOptionsSearch = false,

// render
itemRender = defaultItemRender,
Expand Down Expand Up @@ -582,6 +583,7 @@ const Pagination: React.FC<PaginationProps> = (props) => {
pageSizeOptions={pageSizeOptions}
quickGo={shouldDisplayQuickJumper ? handleChange : null}
goButton={gotoButton}
showSizeOptionsSearch={showSizeOptionsSearch}
/>
</ul>
);
Expand Down
1 change: 1 addition & 0 deletions src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface PaginationData {
showTitle: boolean;
simple: boolean;
disabled: boolean;
showSizeOptionsSearch: boolean;

locale: PaginationLocale;

Expand Down
Loading