2015-06-05 11:06:36 +02:00
|
|
|
|
2015-12-18 15:29:20 +01:00
|
|
|
'use strict';
|
2015-05-20 14:48:57 +02:00
|
|
|
import React from 'react';
|
|
|
|
|
2015-05-21 14:51:15 +02:00
|
|
|
import TableHeaderItem from './table_header_item';
|
2015-05-20 14:48:57 +02:00
|
|
|
|
2015-06-04 13:48:07 +02:00
|
|
|
import { ColumnModel } from './models/table_models';
|
2015-05-21 16:02:42 +02:00
|
|
|
|
2015-05-20 16:44:45 +02:00
|
|
|
|
2015-05-20 14:48:57 +02:00
|
|
|
let TableHeader = React.createClass({
|
|
|
|
propTypes: {
|
2015-06-04 13:48:07 +02:00
|
|
|
columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(ColumnModel)),
|
2015-05-20 19:19:57 +02:00
|
|
|
itemList: React.PropTypes.array.isRequired,
|
2015-05-26 14:05:34 +02:00
|
|
|
changeOrder: React.PropTypes.func,
|
|
|
|
orderAsc: React.PropTypes.bool,
|
|
|
|
orderBy: React.PropTypes.string
|
2015-05-20 19:19:57 +02:00
|
|
|
},
|
|
|
|
|
2015-05-20 14:48:57 +02:00
|
|
|
render() {
|
|
|
|
return (
|
2015-06-04 17:21:38 +02:00
|
|
|
<thead>
|
|
|
|
<tr>
|
2015-07-01 10:53:40 +02:00
|
|
|
{this.props.columnList.map((column, i) => {
|
2015-05-20 16:10:02 +02:00
|
|
|
|
2015-07-01 10:53:40 +02:00
|
|
|
let columnName = column.columnName;
|
|
|
|
let canBeOrdered = column.canBeOrdered;
|
2015-05-20 16:10:02 +02:00
|
|
|
|
2015-05-20 14:48:57 +02:00
|
|
|
return (
|
2015-05-21 14:51:15 +02:00
|
|
|
<TableHeaderItem
|
2015-07-01 10:53:40 +02:00
|
|
|
className={column.className}
|
2015-05-21 14:51:15 +02:00
|
|
|
key={i}
|
2015-12-18 15:29:20 +01:00
|
|
|
displayElement={column.displayElement}
|
2015-06-05 11:06:36 +02:00
|
|
|
columnName={columnName}
|
|
|
|
canBeOrdered={canBeOrdered}
|
2015-05-21 14:51:15 +02:00
|
|
|
orderAsc={this.props.orderAsc}
|
|
|
|
orderBy={this.props.orderBy}
|
2015-06-05 11:06:36 +02:00
|
|
|
changeOrder={this.props.changeOrder} />
|
2015-05-20 14:48:57 +02:00
|
|
|
);
|
|
|
|
})}
|
2015-06-04 17:21:38 +02:00
|
|
|
</tr>
|
2015-06-05 11:06:36 +02:00
|
|
|
</thead>
|
2015-05-20 14:48:57 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-05-20 16:44:45 +02:00
|
|
|
export default TableHeader;
|