Add HTMLAttributes to CellProps

Previously adding a className (or any other HTML attribute) to a Cell as a property would result in a compilation error.
This commit is contained in:
Ethan Breder
2016-03-29 14:29:54 -07:00
parent ee9c524295
commit de24a81a54
2 changed files with 10 additions and 10 deletions
+8 -8
View File
@@ -88,16 +88,16 @@ interface RowData {
interface MyCellProps extends CellProps {
rowIndex?: number;
field: string;
data: RowData[];
myData: RowData[];
}
class MyTextCell extends React.Component<MyCellProps, {}> {
render(): React.ReactElement<any> {
const {rowIndex, field, data} = this.props;
const {rowIndex, field, myData} = this.props;
return (
<Cell {...this.props}>
{data[rowIndex][field]}
<Cell {...this.props} className="text-cell">
{myData[rowIndex][field]}
</Cell>
);
}
@@ -105,11 +105,11 @@ class MyTextCell extends React.Component<MyCellProps, {}> {
class MyLinkCell extends React.Component<MyCellProps, {}> {
render(): React.ReactElement<any> {
const {rowIndex, field, data} = this.props;
const link: string = data[rowIndex][field];
const {rowIndex, field, myData} = this.props;
const link: string = myData[rowIndex][field];
return (
<Cell {...this.props}>
<Cell {...this.props} className="link-cell">
<a href={link}>{link}</a>
</Cell>
);
@@ -150,7 +150,7 @@ class MyTable4 extends React.Component<{}, MyTable4State> {
header={<Cell>{field}</Cell>}
cell={
<MyTextCell
data={this.state.tableData}
myData={this.state.tableData}
field={field}
/>
}
+2 -2
View File
@@ -458,11 +458,11 @@ declare namespace FixedDataTable {
* />
* );
*/
export interface CellProps {
export interface CellProps extends __React.HTMLAttributes {
/**
* The row index of the cell.
*/
rowIndex?: number
rowIndex?: number;
/**
* Outer height of the cell.