update react-paginate

This commit is contained in:
yasupeke
2018-08-09 21:30:43 +09:00
parent 5ead03ec10
commit 9b8b697b90
7 changed files with 202 additions and 16 deletions

View File

@@ -1,11 +1,8 @@
// Type definitions for react-paginate 4.3
// Type definitions for react-paginate 5.2
// Project: https://github.com/AdeleD/react-paginate
// Definitions by: Simon Hartcher <https://github.com/deevus>
// Wouter Hardeman <https://github.com/wouterhardeman>
// pegel03 <https://github.com/pegel03>
// Simon Archer <https://github.com/archy-bold>
// Definitions by: Yasunori Ohoka <https://github.com/yasupeke>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// TypeScript Version: 2.9
import * as React from 'react';
@@ -48,7 +45,7 @@ interface ReactPaginateProps {
/**
* The method to call when a page is clicked. Exposes the current page object as an argument.
*/
onPageChange?(selectedItem: {selected: number}): void;
onPageChange?(selectedItem: { selected: number }): void;
/**
* The initial page selected.
@@ -122,4 +119,4 @@ interface ReactPaginateProps {
}
declare const ReactPaginate: React.ComponentClass<ReactPaginateProps>;
export = ReactPaginate;
export default ReactPaginate;

View File

@@ -1,5 +1,5 @@
import * as React from "react";
import ReactPaginate = require("react-paginate");
import * as React from 'react';
import ReactPaginate from 'react-paginate';
class Test extends React.Component {
render() {

View File

@@ -1,8 +1,4 @@
{
"files": [
"index.d.ts",
"react-paginate-tests.tsx"
],
"compilerOptions": {
"module": "commonjs",
"lib": [
@@ -21,5 +17,9 @@
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react"
}
}
},
"files": [
"index.d.ts",
"react-paginate-tests.tsx"
]
}

125
types/react-paginate/v4/index.d.ts vendored Normal file
View File

@@ -0,0 +1,125 @@
// Type definitions for react-paginate 4.3
// Project: https://github.com/AdeleD/react-paginate
// Definitions by: Simon Hartcher <https://github.com/deevus>
// Wouter Hardeman <https://github.com/wouterhardeman>
// pegel03 <https://github.com/pegel03>
// Simon Archer <https://github.com/archy-bold>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
interface ReactPaginateProps {
/**
* The total number of pages.
*/
pageCount: number;
/**
* The range of pages displayed.
*/
pageRangeDisplayed: number;
/**
* The number of pages to display for margins.
*/
marginPagesDisplayed: number;
/**
* Label for the `previous` button.
*/
previousLabel?: string | JSX.Element;
/**
* Label for the `next` button.
*/
nextLabel?: string | JSX.Element;
/**
* Label for ellipsis.
*/
breakLabel?: string | JSX.Element;
/**
* The classname on tag `li` of the ellipsis element.
*/
breakClassName?: string | JSX.Element;
/**
* The method to call when a page is clicked. Exposes the current page object as an argument.
*/
onPageChange?(selectedItem: { selected: number }): void;
/**
* The initial page selected.
*/
initialPage?: number;
/**
* To override selected page with parent prop.
*/
forcePage?: number;
/**
* Disable onPageChange callback with initial page. Default: false
*/
disableInitialCallback?: boolean;
/**
* The classname of the pagination container.
*/
containerClassName?: string;
/**
* The classname on tag `li` of each page element.
*/
pageClassName?: string;
/**
* The classname on tag `a` of each page element.
*/
pageLinkClassName?: string;
/**
* The classname for the active page.
*/
activeClassName?: string;
/**
* The classname on tag `li` of the `previous` button.
*/
previousClassName?: string;
/**
* The classname on tag `li` of the `next` button.
*/
nextClassName?: string;
/**
* The classname on tag `a` of the `previous` button.
*/
previousLinkClassName?: string;
/**
* The classname on tag `a` of the `next` button.
*/
nextLinkClassName?: string;
/**
* 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?(pageIndex: number): void;
/**
* Extra context to add to the aria-label HTML attribute.
*/
extraAriaContext?: string;
}
declare const ReactPaginate: React.ComponentClass<ReactPaginateProps>;
export = ReactPaginate;

View File

@@ -0,0 +1,33 @@
import * as React from 'react';
import ReactPaginate = require('react-paginate');
class Test extends React.Component {
render() {
return (
<ReactPaginate
pageCount={1}
pageRangeDisplayed={10}
marginPagesDisplayed={2}
previousLabel={'previous'}
nextLabel={'next'}
breakLabel={'break-me'}
breakClassName={'break-class'}
onPageChange={(selectedItem: {selected: number}) => null}
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={(pageIndex: number) => null}
extraAriaContext={'aria'}
/>
);
}
}

View File

@@ -0,0 +1,30 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"paths": {
"react-paginate": [
"react-paginate/v4"
]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react"
},
"files": [
"index.d.ts",
"react-paginate-tests.tsx"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }