Add an option to disable table pagination WIP

This commit is contained in:
Mikhail Mikheev 2019-09-04 12:42:44 +04:00
parent 5bc5cea43e
commit 4dc756398f
6 changed files with 47 additions and 31 deletions

View File

@ -23,6 +23,8 @@
"import/no-extraneous-dependencies": 0,
"import/extensions": 0,
"import/prefer-default-export": 0,
"react/default-props-match-prop-types": ["error", { "allowRequiredDefaults": true }],
// https://github.com/yannickcr/eslint-plugin-react/issues/1593 ^
"jsx-a11y/label-has-for": 0,
"indent": ["error", 2, { "SwitchCase": 1 }],
"no-console": ["error", { "allow": ["warn", "error"] }],

View File

@ -93,7 +93,7 @@
"@storybook/addon-knobs": "5.1.11",
"@storybook/addon-links": "5.1.11",
"@storybook/react": "5.1.11",
"@testing-library/react": "9.1.3",
"@testing-library/react": "9.1.4",
"autoprefixer": "9.6.1",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "10.0.3",
@ -107,7 +107,7 @@
"detect-port": "^1.2.2",
"eslint": "5.16.0",
"eslint-config-airbnb": "18.0.1",
"eslint-plugin-flowtype": "4.2.0",
"eslint-plugin-flowtype": "4.3.0",
"eslint-plugin-import": "2.18.2",
"eslint-plugin-jest": "22.16.0",
"eslint-plugin-jsx-a11y": "6.2.3",

View File

@ -20,9 +20,10 @@ type Props<K> = {
classes: Object,
children: Function,
size: number,
defaultFixed?: boolean,
defaultOrder?: 'desc' | 'asc',
defaultFixed: boolean,
defaultOrder: 'desc' | 'asc',
noBorder: boolean,
disablePagination: boolean,
}
type State = {
@ -142,6 +143,7 @@ class GnoTable<K> extends React.Component<Props<K>, State> {
classes,
children,
size,
disablePagination,
defaultOrderBy,
defaultOrder,
defaultFixed,
@ -184,18 +186,20 @@ class GnoTable<K> extends React.Component<Props<K>, State> {
<CircularProgress size={60} />
</Row>
)}
<TablePagination
component="div"
count={size}
rowsPerPage={rowsPerPage}
rowsPerPageOptions={[5, 10, 25, 50, 100]}
page={page}
backIconButtonProps={backProps}
nextIconButtonProps={nextProps}
onChangePage={this.handleChangePage}
onChangeRowsPerPage={this.handleChangeRowsPerPage}
classes={paginationClasses}
/>
{!disablePagination && (
<TablePagination
component="div"
count={size}
rowsPerPage={rowsPerPage}
rowsPerPageOptions={[5, 10, 25, 50, 100]}
page={page}
backIconButtonProps={backProps}
nextIconButtonProps={nextProps}
onChangePage={this.handleChangePage}
onChangeRowsPerPage={this.handleChangeRowsPerPage}
classes={paginationClasses}
/>
)}
</>
)
}
@ -203,6 +207,7 @@ class GnoTable<K> extends React.Component<Props<K>, State> {
GnoTable.defaultProps = {
defaultOrder: 'asc',
disablePagination: false,
}
export default withStyles(styles)(GnoTable)

View File

@ -150,6 +150,7 @@ class ManageOwners extends React.Component<Props, State> {
columns={columns}
data={ownerData}
size={ownerData.size}
disablePagination
defaultFixed
noBorder
>

View File

@ -21,7 +21,7 @@ type Props = {
classes: Object,
createTransaction: Function,
safeAddress: string,
granted: Boolean,
granted: boolean,
}
const ThresholdSettings = ({

View File

@ -2255,13 +2255,14 @@
dependencies:
defer-to-connect "^1.0.1"
"@testing-library/dom@^6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-6.0.0.tgz#34e28e69e49bd6347fc64a5dde4c4f9aabbd17d3"
integrity sha512-B5XTz3uMsbqbdR9CZlnwpZjTE3fCWuqRkz/zvDc2Ej/vuHmTM0Ur2v0XPwr7usWfGIBsahEK5HL1E91+4IFiBg==
"@testing-library/dom@^6.1.0":
version "6.1.0"
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-6.1.0.tgz#8d5a954158e81ecd7c994907f4ec240296ed823b"
integrity sha512-qivqFvnbVIH3DyArFofEU/jlOhkGIioIemOy9A9M/NQTpPyDDQmtVkAfoB18RKN581f0s/RJMRBbq9WfMIhFTw==
dependencies:
"@babel/runtime" "^7.5.5"
"@sheerun/mutationobserver-shim" "^0.3.2"
"@types/testing-library__dom" "^6.0.0"
aria-query "3.0.0"
pretty-format "^24.8.0"
wait-for-expect "^1.3.0"
@ -2281,13 +2282,13 @@
pretty-format "^24.0.0"
redent "^3.0.0"
"@testing-library/react@9.1.3":
version "9.1.3"
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-9.1.3.tgz#3fb495227322ea36cd817532441dabb552e0d6ce"
integrity sha512-qFVo6TsEbpEFpOmKjIxMHDujOKVdvVpcYFcUfJeWBqMO8eja5pN9SZnt6W6AzW3a1MRvRfw3X0Fhx3eXnBJxjA==
"@testing-library/react@9.1.4":
version "9.1.4"
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-9.1.4.tgz#4cc1a228a944c0f468ee501e7da1651d8bbd9902"
integrity sha512-fQ/PXZoLcmnS1W5ZiM3P7XBy2x6Hm9cJAT/ZDuZKzJ1fS1rN3j31p7ReAqUe3N1kJ46sNot0n1oiGbz7FPU+FA==
dependencies:
"@babel/runtime" "^7.5.5"
"@testing-library/dom" "^6.0.0"
"@testing-library/dom" "^6.1.0"
"@types/testing-library__react" "^9.1.0"
"@truffle/blockchain-utils@^0.0.11":
@ -2462,6 +2463,13 @@
dependencies:
"@types/pretty-format" "*"
"@types/testing-library__dom@^6.0.0":
version "6.0.2"
resolved "https://registry.yarnpkg.com/@types/testing-library__dom/-/testing-library__dom-6.0.2.tgz#1e40c5f12671b98e86706f6c9ba55eaab3461edc"
integrity sha512-p5Jjm2kaHpee2rMartE3F2vg4rosMoAc1KVr4+WPz1TOc4B8A6EO5oLJUZvuRyiT3pFy/WO77kn40qp51DF3Sg==
dependencies:
pretty-format "^24.3.0"
"@types/testing-library__react@^9.1.0":
version "9.1.1"
resolved "https://registry.yarnpkg.com/@types/testing-library__react/-/testing-library__react-9.1.1.tgz#4bcb8bba54b07fbb6c084f2f00e7f9410e587c10"
@ -6997,10 +7005,10 @@ eslint-module-utils@^2.4.0:
debug "^2.6.8"
pkg-dir "^2.0.0"
eslint-plugin-flowtype@4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-4.2.0.tgz#a89ac991eef6753226eb8871261e266645aca4b9"
integrity sha512-mqf6AbQCP6N8Bk+ryXYwxt6sj3RT7i3kt8JOOx7WOQNlZtsLxqvnkXRRrToFHcN52E5W9c/p3UfNxCMsfENIJA==
eslint-plugin-flowtype@4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-4.3.0.tgz#06d0837ac341caf369e7e6dbb112dd7fd21acf17"
integrity sha512-elvqoadMHnYqSYN1YXn02DR7SFW8Kc2CLe8na3m2GdQPQhIY+BgCd2quVJ1AbW3aO0zcyE9loVJ7Szy8A/xlMA==
dependencies:
lodash "^4.17.15"
@ -13860,7 +13868,7 @@ pretty-format@^24.0.0, pretty-format@^24.8.0:
ansi-styles "^3.2.0"
react-is "^16.8.4"
pretty-format@^24.9.0:
pretty-format@^24.3.0, pretty-format@^24.9.0:
version "24.9.0"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9"
integrity sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA==