import React from 'react';
import { Input } from 'antd';
import styles from './styles.less';
import { BaseComponentProps } from '@/apollo-table/component/interface';

export default function(props: BaseComponentProps) {
    const { value, columnConfig } = props;
    const { columnAttrObj = {} } = columnConfig;
    const { maxLength } = columnAttrObj;
    return (
        <div className={styles.container}>
            <Input className={styles.input} value={value} {...columnAttrObj} />
            {maxLength && (
                <span className={styles.wordNumber}>
                    已输入{(value || '').length || 0}/{maxLength}
                </span>
            )}
        </div>
    );
}
