-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Table] Add a TableFooter for pagination (#8254)
* [TableFooter] Add a TableFooter component * [TableFooter] Add a footer for pagination to the enhanced table demo This also adds more demo data, and yes, the nutrition information of Marshmallow, Nougat and Oreo is actually real. * Lint the code * [EnhancedTable] Fix checkbox in table header, small code changes according to the review * [TableFooter] Add tests * [EnhancedTable] Fix sorting * [TablePagination] Add a TablePagination component, lint the code and fix the sorting order in the EnhancedTable demo * increase size-limit * some changes * remove div * [EnhancedTable] Fix table not being sorted initially * [TablePagination] Add more tests, handle too high page number after changing the rows per page, lint the code * [TablePagination] Add typings * Update the list of supported components
- Loading branch information
1 parent
58d2ff9
commit 35989a9
Showing
20 changed files
with
749 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -176,7 +176,7 @@ | |
"size-limit": [ | ||
{ | ||
"path": "build/index.js", | ||
"limit": "90 KB" | ||
"limit": "91 KB" | ||
} | ||
], | ||
"nyc": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// @flow | ||
|
||
import React from 'react'; | ||
import withRoot from 'docs/src/modules/components/withRoot'; | ||
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs'; | ||
import markdown from './table-footer.md'; | ||
|
||
function Page() { | ||
return <MarkdownDocs markdown={markdown} />; | ||
} | ||
|
||
export default withRoot(Page); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!--- This documentation is automatically generated, do not try to edit it. --> | ||
|
||
# TableFooter | ||
|
||
|
||
|
||
## Props | ||
| Name | Type | Default | Description | | ||
|:-----|:-----|:--------|:------------| | ||
| children | Node | | The content of the component, normally `TableRow`. | | ||
| classes | Object | | Useful to extend the style applied to components. | | ||
| component | union: string<br> ComponentType<*><br> | 'tfoot' | The component used for the root node. Either a string to use a DOM element or a component. | | ||
|
||
Any other properties supplied will be [spread to the root element](/customization/api#spread). | ||
|
||
## CSS API | ||
|
||
You can override all the class names injected by Material-UI thanks to the `classes` property. | ||
This property accepts the following keys: | ||
- `root` | ||
|
||
Have a look at [overriding with classes](/customization/overrides#overriding-with-classes) | ||
section for more detail. | ||
|
||
If using the `overrides` key of the theme as documented | ||
[here](/customization/themes#customizing-all-instances-of-a-component-type), | ||
you need to use the following style sheet name: `MuiTableFooter`. | ||
|
||
## Demos | ||
|
||
- [Tables](/demos/tables) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// @flow | ||
|
||
import React from 'react'; | ||
import withRoot from 'docs/src/modules/components/withRoot'; | ||
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs'; | ||
import markdown from './table-pagination.md'; | ||
|
||
function Page() { | ||
return <MarkdownDocs markdown={markdown} />; | ||
} | ||
|
||
export default withRoot(Page); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!--- This documentation is automatically generated, do not try to edit it. --> | ||
|
||
# TablePagination | ||
|
||
A `TableRow` based component for placing inside `TableFooter` for pagination. | ||
|
||
## Props | ||
| Name | Type | Default | Description | | ||
|:-----|:-----|:--------|:------------| | ||
| classes | Object | | Useful to extend the style applied to components. | | ||
| <span style="color: #31a148">count *</span> | number | | The total number of rows. | | ||
| labelDisplayedRows | signature | ({ from, to, count }) => `${from}-${to} of ${count}` | Useful to customize the displayed rows label. | | ||
| labelRowsPerPage | Node | 'Rows per page:' | Useful to customize the rows per page label. Invoked with a `{ from, to, count, page }` object. | | ||
| <span style="color: #31a148">onChangePage *</span> | signature | | Callback fired when the page is changed. Invoked with two arguments: the event and the page to show. | | ||
| <span style="color: #31a148">onChangeRowsPerPage *</span> | signature | | Callback fired when the number of rows per page is changed. Invoked with two arguments: the event. | | ||
| <span style="color: #31a148">page *</span> | number | | The zero-based index of the current page. | | ||
| <span style="color: #31a148">rowsPerPage *</span> | number | | The number of rows per page. | | ||
| rowsPerPageOptions | unknown | [5, 10, 25] | Customizes the options of the rows per page select field. | | ||
|
||
Any other properties supplied will be [spread to the root element](/customization/api#spread). | ||
|
||
## CSS API | ||
|
||
You can override all the class names injected by Material-UI thanks to the `classes` property. | ||
This property accepts the following keys: | ||
- `cell` | ||
- `toolbar` | ||
- `spacer` | ||
- `select` | ||
- `selectRoot` | ||
- `actions` | ||
|
||
Have a look at [overriding with classes](/customization/overrides#overriding-with-classes) | ||
section for more detail. | ||
|
||
If using the `overrides` key of the theme as documented | ||
[here](/customization/themes#customizing-all-instances-of-a-component-type), | ||
you need to use the following style sheet name: `MuiTablePagination`. | ||
|
||
## Demos | ||
|
||
- [Tables](/demos/tables) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as React from 'react'; | ||
import { StyledComponent } from '..'; | ||
|
||
export interface TableFooterProps | ||
extends React.HTMLAttributes<HTMLTableSectionElement> {} | ||
|
||
export default class TableFooter extends StyledComponent<TableFooterProps> {} |
Oops, something went wrong.