2015-05-20 14:48:57 +02:00
|
|
|
import React from 'react';
|
|
|
|
|
2015-05-21 15:14:05 +02:00
|
|
|
import TableColumnMixin from '../../mixins/table_column_mixin';
|
|
|
|
import GeneralUtils from '../../utils/general_utils';
|
2015-05-21 14:51:15 +02:00
|
|
|
import TableHeaderItem from './table_header_item';
|
2015-05-20 14:48:57 +02:00
|
|
|
|
2015-05-22 16:51:08 +02:00
|
|
|
import TableColumnContentModel from '../../models/table_column_content_model';
|
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({
|
|
|
|
mixins: [TableColumnMixin],
|
|
|
|
propTypes: {
|
2015-05-22 16:51:08 +02:00
|
|
|
columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(TableColumnContentModel)),
|
2015-05-20 19:19:57 +02:00
|
|
|
itemList: React.PropTypes.array.isRequired,
|
2015-05-22 13:58:09 +02:00
|
|
|
changeOrder: React.PropTypes.func.isRequired,
|
2015-05-21 14:03:56 +02:00
|
|
|
orderAsc: React.PropTypes.bool.isRequired,
|
|
|
|
orderBy: React.PropTypes.string.isRequired
|
2015-05-20 19:19:57 +02:00
|
|
|
},
|
|
|
|
|
2015-05-20 14:48:57 +02:00
|
|
|
render() {
|
|
|
|
return (
|
2015-05-20 17:32:06 +02:00
|
|
|
<div className="col-xs-12 col-sm-12 col-md-12 col-lg-12 ascribe-table-header-row">
|
2015-05-20 14:48:57 +02:00
|
|
|
<div className="row">
|
2015-05-21 16:02:42 +02:00
|
|
|
{this.props.columnList.map((val, i) => {
|
2015-05-20 16:10:02 +02:00
|
|
|
|
2015-05-21 16:02:42 +02:00
|
|
|
let columnClasses = this.calcColumnClasses(this.props.columnList, i);
|
|
|
|
let columnName = this.props.columnList[i].columnName;
|
|
|
|
let canBeOrdered = this.props.columnList[i].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
|
|
|
|
key={i}
|
|
|
|
columnClasses={columnClasses}
|
|
|
|
displayName={val.displayName}
|
|
|
|
columnName={columnName}
|
|
|
|
canBeOrdered={canBeOrdered}
|
|
|
|
orderAsc={this.props.orderAsc}
|
|
|
|
orderBy={this.props.orderBy}
|
2015-05-22 13:58:09 +02:00
|
|
|
changeOrder={this.props.changeOrder}>
|
2015-05-21 14:51:15 +02:00
|
|
|
</TableHeaderItem>
|
2015-05-20 14:48:57 +02:00
|
|
|
);
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-05-20 16:44:45 +02:00
|
|
|
export default TableHeader;
|