Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(table): add types, examples, and demo for onRowClick
provide type for onRowClick handler add onRowClick example to docs add onRowClick test for table add on row click demo in react-integration clean up customRowWrapper demo/example only fire onRowClick when it is provided by user
- Loading branch information
1 parent
2c8ea98
commit 3fb644b
Showing
9 changed files
with
9,216 additions
and
43 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
35 changes: 0 additions & 35 deletions
35
...tegration/demo-app-ts/src/components/demos/TableDemo/RowWrapperForTableRowWrapperDemo.tsx
This file was deleted.
Oops, something went wrong.
56 changes: 56 additions & 0 deletions
56
...nfly-4/react-integration/demo-app-ts/src/components/demos/TableDemo/TableRowClickDemo.tsx
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,56 @@ | ||
import * as React from 'react'; | ||
import { | ||
Table, | ||
TableHeader, | ||
TableBody, | ||
IRow, | ||
IExtraRowData, | ||
IComputedData, | ||
TableProps, | ||
ICell | ||
} from '@patternfly/react-table'; | ||
|
||
interface ITableRowClickDemoState { | ||
rows: IRow[]; | ||
columns: (ICell | string)[]; | ||
} | ||
|
||
export class TableRowClickDemo extends React.Component<TableProps, ITableRowClickDemoState> { | ||
rowClickHandler: (event: React.MouseEvent, row: IRow, rowProps: IExtraRowData, computedData: IComputedData) => void; | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
columns: [ | ||
{ title: 'Repositories' }, | ||
'Branches', | ||
{ title: 'Pull requests' }, | ||
'Workspaces' | ||
], | ||
rows: [ | ||
{ | ||
cells: ['Repositories one', 'Branches one', 'Pull requests one', 'Workspaces one'] | ||
}, | ||
{ | ||
cells: ['Repositories two', 'Branches two', 'Pull requests two', 'Workspaces two'] | ||
}, | ||
{ | ||
cells: ['Repositories three', 'Branches three', 'Pull requests three', 'Workspaces three'] | ||
} | ||
] | ||
}; | ||
this.rowClickHandler = (event: React.MouseEvent, row: IRow) => { | ||
console.log('handle row click', row); | ||
} | ||
} | ||
|
||
render() { | ||
const { columns, rows } = this.state; | ||
|
||
return ( | ||
<Table caption="Row Click Handler Table" cells={columns} rows={rows}> | ||
<TableHeader /> | ||
<TableBody onRowClick={this.rowClickHandler} /> | ||
</Table> | ||
); | ||
} | ||
} |
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.