-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(react-grid): support stretching virtual table to parent element (#…
- Loading branch information
1 parent
dc6114b
commit ded7357
Showing
24 changed files
with
216 additions
and
38 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
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 |
---|---|---|
@@ -1,21 +1,25 @@ | ||
import * as React from 'react'; | ||
import * as PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
|
||
export const Root = ({ children, ...restProps }) => ( | ||
export const Root = ({ children, className, ...restProps }) => ( | ||
<div | ||
className={classNames('d-flex flex-column', className)} | ||
{...restProps} | ||
> | ||
{children} | ||
</div> | ||
); | ||
|
||
Root.propTypes = { | ||
className: PropTypes.string, | ||
children: PropTypes.oneOfType([ | ||
PropTypes.node, | ||
PropTypes.arrayOf(PropTypes.node), | ||
]), | ||
}; | ||
|
||
Root.defaultProps = { | ||
className: undefined, | ||
children: undefined, | ||
}; |
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
53 changes: 53 additions & 0 deletions
53
...eact-grid-demos/src/demo-sources/grid-virtual-scrolling/stretching-to-parent-element.jsxt
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,53 @@ | ||
import * as React from 'react';<%&additionalImports%> | ||
import { | ||
Grid, | ||
VirtualTable, | ||
TableHeaderRow, | ||
} from '@devexpress/dx-react-grid-<%&themeName%>'; | ||
|
||
import { | ||
generateRows, | ||
defaultColumnValues, | ||
} from '../../../demo-data/generator'; | ||
|
||
const getRowId = row => row.id; | ||
|
||
export default class Demo extends React.PureComponent { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
columns: [ | ||
{ name: 'id', title: 'ID' }, | ||
{ name: 'name', title: 'Name' }, | ||
{ name: 'sex', title: 'Sex' }, | ||
{ name: 'city', title: 'City' }, | ||
{ name: 'car', title: 'Car' }, | ||
], | ||
rows: generateRows({ | ||
columnValues: { id: ({ index }) => index, ...defaultColumnValues }, | ||
length: 100000, | ||
}), | ||
}; | ||
} | ||
|
||
render() { | ||
const { rows, columns } = this.state; | ||
|
||
return ( | ||
<<%&wrapperTag%> style={{ height: '600px' }}> | ||
<Grid | ||
rows={rows} | ||
columns={columns} | ||
getRowId={getRowId} | ||
style={{ height: '100%' }} | ||
> | ||
<VirtualTable | ||
height="auto" | ||
/> | ||
<TableHeaderRow /> | ||
</Grid> | ||
</<%&wrapperTag%>> | ||
); | ||
} | ||
} |
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
32 changes: 26 additions & 6 deletions
32
packages/dx-react-grid-material-ui/src/templates/layout.jsx
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 |
---|---|---|
@@ -1,16 +1,36 @@ | ||
import * as React from 'react'; | ||
import * as PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
|
||
export const Root = ({ children, ...restProps }) => ( | ||
<div {...restProps}> | ||
const styles = { | ||
root: { | ||
overflow: 'auto', | ||
WebkitOverflowScrolling: 'touch', | ||
display: 'flex', | ||
flexDirection: 'column', | ||
}, | ||
}; | ||
|
||
const RootBase = ({ | ||
children, classes, className, ...restProps | ||
}) => ( | ||
<div | ||
className={classNames(classes.root, className)} | ||
{...restProps} | ||
> | ||
{children} | ||
</div> | ||
); | ||
|
||
Root.propTypes = { | ||
children: PropTypes.node, | ||
RootBase.propTypes = { | ||
children: PropTypes.node.isRequired, | ||
classes: PropTypes.object.isRequired, | ||
className: PropTypes.string, | ||
}; | ||
|
||
Root.defaultProps = { | ||
children: undefined, | ||
RootBase.defaultProps = { | ||
className: undefined, | ||
}; | ||
|
||
export const Root = withStyles(styles)(RootBase); |
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
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
Oops, something went wrong.