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

[Table] Improve RTL virtualized demo support #18038

Merged
merged 4 commits into from
Oct 27, 2019
Merged
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
12 changes: 12 additions & 0 deletions docs/src/pages/components/tables/ReactVirtualizedTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ const styles = theme => ({
alignItems: 'center',
boxSizing: 'border-box',
},
table: {
// temporary right-to-left patch, waiting for
// https://github.com/bvaughn/react-virtualized/issues/454
'& .ReactVirtualized__Table__headerRow': {
flip: false,
paddingRight: theme.direction === 'rtl' ? '0px !important' : undefined,
},
},
tableRow: {
cursor: 'pointer',
},
Expand Down Expand Up @@ -84,7 +92,11 @@ class MuiVirtualizedTable extends React.PureComponent {
height={height}
width={width}
rowHeight={rowHeight}
gridStyle={{
direction: 'inherit',
}}
headerHeight={headerHeight}
className={classes.table}
{...tableProps}
rowClassName={this.getRowClassName}
>
Expand Down
22 changes: 22 additions & 0 deletions docs/src/pages/components/tables/ReactVirtualizedTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,31 @@ import TableCell from '@material-ui/core/TableCell';
import Paper from '@material-ui/core/Paper';
import { AutoSizer, Column, Table, TableCellRenderer, TableHeaderProps } from 'react-virtualized';

declare module '@material-ui/core/styles/withStyles' {
// Augment the BaseCSSProperties so that we can control jss-rtl
interface BaseCSSProperties {
/*
* Used to control if the rule-set should be affected by rtl transformation
*/
flip?: boolean;
}
}

const styles = (theme: Theme) =>
createStyles({
flexContainer: {
display: 'flex',
alignItems: 'center',
boxSizing: 'border-box',
},
table: {
// temporary right-to-left patch, waiting for
// https://github.com/bvaughn/react-virtualized/issues/454
'& .ReactVirtualized__Table__headerRow': {
flip: false,
paddingRight: theme.direction === 'rtl' ? '0px !important' : undefined,
},
},
tableRow: {
cursor: 'pointer',
},
Expand Down Expand Up @@ -104,7 +122,11 @@ class MuiVirtualizedTable extends React.PureComponent<MuiVirtualizedTableProps>
height={height}
width={width}
rowHeight={rowHeight!}
gridStyle={{
direction: 'inherit',
}}
headerHeight={headerHeight!}
className={classes.table}
{...tableProps}
rowClassName={this.getRowClassName}
>
Expand Down