import React, {Component} from 'react';
import { observer } from 'mobx-react';
import { WeaTableEditable } from 'ecCom';

@observer
export default class FieldList extends Component{
    render(){
        const {store} = this.props;
        let {toJS, tableEditProps, onChange, getCellProps } = store;
        tableEditProps = toJS(tableEditProps);
        if(tableEditProps.columns.length == 0)
            return <div/>
        const cells = getCellProps();
        Object.assign(tableEditProps, {
            cells,
            tableProps: {
                scroll: {
                    y: $('.fieldList').height() - 60
                }
            },
            getRowSelection: rowSelection => null,
            onChange
        })

        return (
            <div>
                <WeaTableEditable ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEditable@2u14n3`} {...tableEditProps}/>
            </div>
        )
    }
}