Added typings for latest version 4.2.0

This commit is contained in:
Peter Glas
2017-03-16 13:37:11 +01:00
parent c96d70aa35
commit 2468af34fb
2 changed files with 52 additions and 19 deletions
+28 -18
View File
@@ -1,6 +1,6 @@
// Type definitions for react-paginate 2.1.3
// Type definitions for react-paginate 4.2.0
// Project: https://github.com/AdeleD/react-paginate
// Definitions by: Simon Hartcher <https://github.com/deevus>
// Definitions by: pegel03 <https://github.com/pegel03>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
@@ -10,7 +10,7 @@ interface ReactPaginateProps {
/**
* The total number of pages.
*/
pageNum: number;
pageCount: number;
/**
* The range of pages displayed.
@@ -23,12 +23,12 @@ interface ReactPaginateProps {
marginPagesDisplayed: number;
/**
* Label for the `previous` button.
* Label for the previous button.
*/
previousLabel?: string | JSX.Element;
/**
* Label for the `next` button.
* Label for the next button.
*/
nextLabel?: string | JSX.Element;
@@ -38,24 +38,29 @@ interface ReactPaginateProps {
breakLabel?: string | JSX.Element;
/**
* The classname on tag `li` of the ellipsis element.
* The classname on tag li of the ellipsis element.
*/
breakClassName?: string | JSX.Element;
breakClassName?: string;
/**
* The method to call when a page is clicked.
* The method to call when a page is clicked. Exposes the current page object as an argument.
*/
clickCallback?: Function;
onPageChange?: Function;
/**
* The initial page selected.
*/
initialSelected?: number;
initialPage?: number;
/**
* To override selected page with parent prop.
*/
forceSelected?: number;
forcePage?: number;
/**
* Disable onPageChange callback with initial page. Default: false
*/
disableInitialCallback?: boolean;
/**
* The classname of the pagination container.
@@ -63,12 +68,12 @@ interface ReactPaginateProps {
containerClassName?: string;
/**
* The classname on tag `li` of each page element.
* The classname on tag li of each page element.
*/
pageClassName?: string;
/**
* The classname on tag `a` of each page element.
* The classname on tag a of each page element.
*/
pageLinkClassName?: string;
@@ -78,29 +83,34 @@ interface ReactPaginateProps {
activeClassName?: string;
/**
* The classname on tag `li` of the `previous` button.
* The classname on tag li of the previous button.
*/
previousClassName?: string;
/**
* The classname on tag `li` of the `next` button.
* The classname on tag li of the next button.
*/
nextClassName?: string;
/**
* The classname on tag `a` of the `previous` button.
* The classname on tag a of the previous button.
*/
previousLinkClassName?: string;
/**
* The classname on tag `a` of the `next` button.
* The classname on tag a of the next button.
*/
nextLinkClassName?: string;
/**
* The classname for disabled `previous` and `next` buttons.
* The classname for disabled previous and next buttons.
*/
disabledClassName?: string;
/**
* The method is called to generate the href attribute value on tag a of each page element.
*/
hrefBuilder?: Function;
}
declare const ReactPaginate: React.ComponentClass<ReactPaginateProps>;
+24 -1
View File
@@ -2,12 +2,35 @@ import * as React from "react";
import ReactPaginate = require("react-paginate");
class Test extends React.Component<{}, {}> {
private onClick(obj: any): void {
//
}
public render() {
return (
<ReactPaginate
pageNum={1}
pageCount={1}
pageRangeDisplayed={10}
marginPagesDisplayed={2}
previousLabel={'previous'}
nextLabel={'next'}
breakLabel={'break-me'}
breakClassName={'break-class'}
onPageChange={(nr: number) => this.onClick(nr)}
initialPage={2}
forcePage={3}
disableInitialCallback={false}
containerClassName={'container'}
pageClassName={'page-li'}
pageLinkClassName={'page-a'}
activeClassName={'active'}
previousClassName={'previous-li'}
nextClassName={'next-li'}
previousLinkClassName={'previous-a'}
nextLinkClassName={'next-a'}
disabledClassName={'disabled'}
hrefBuilder={(a: string) => this.onClick(a)}
/>
);
}