2015-05-26 20:20:17 +02:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import TableColumnContentModel from '../../models/table_column_content_model';
|
|
|
|
import TableColumnMixin from '../../mixins/table_column_mixin';
|
|
|
|
|
|
|
|
let TableItemWrapper = React.createClass({
|
|
|
|
mixins: [TableColumnMixin],
|
|
|
|
propTypes: {
|
|
|
|
columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(TableColumnContentModel)),
|
|
|
|
columnContent: React.PropTypes.object,
|
|
|
|
columnWidth: React.PropTypes.number.isRequired
|
|
|
|
},
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
{this.props.columnList.map((column, i) => {
|
|
|
|
|
|
|
|
let TypeElement = column.displayType;
|
2015-06-01 14:10:11 +02:00
|
|
|
let typeElementProps = column.transformFn(this.props.columnContent);
|
|
|
|
|
2015-05-26 20:20:17 +02:00
|
|
|
let columnClass = this.calcColumnClasses(this.props.columnList, i, this.props.columnWidth);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={columnClass + ' ascribe-table-item-column'} key={i}>
|
2015-06-01 14:10:11 +02:00
|
|
|
<TypeElement {...typeElementProps} />
|
2015-05-26 20:20:17 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
})}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default TableItemWrapper;
|