'use strict'; import React from 'react'; import Router from 'react-router'; import { ColumnModel } from './models/table_models'; import TableColumnMixin from '../../mixins/table_column_mixin'; let Link = Router.Link; let TableItemWrapper = React.createClass({ propTypes: { columnList: React.PropTypes.arrayOf(React.PropTypes.instanceOf(ColumnModel)), columnContent: React.PropTypes.object, columnWidth: React.PropTypes.number.isRequired }, mixins: [TableColumnMixin, Router.Navigation], render() { return ( {this.props.columnList.map((column, i) => { let TypeElement = column.displayType; let typeElementProps = column.transformFn(this.props.columnContent); let columnClass = this.calcColumnClasses(this.props.columnList, i, this.props.columnWidth); if(!column.transition) { return ( ); } else { let linkProps = column.transition.toReactRouterLinkProps(this.props.columnContent[column.transition.valueKey]); /** * If a transition is defined in columnContent, then we can use * Router.Navigation.transitionTo to redirect the user * programmatically */ return ( ); } })} ); } }); export default TableItemWrapper;