import React from 'react';
import { Table } from 'antd';
import { connect } from 'dva'
import resolveChartOption from './resolveChartOption'

const TableView = ({ chartDesigner, dispatch }) => {
    const option = resolveChartOption(chartDesigner.chartOption);
    const { columns, data } = option;

    return (
        <Table columns={columns} dataSource={data}/>
    );
}

function mapStateToProps({ present: { chartDesigner } }) {
    return { chartDesigner: chartDesigner }
}

export default connect(mapStateToProps)(TableView);