import { Input } from 'antd';
import React from 'react';
import FormItem from '../FormItem/FormItem'
import { getItemProps } from "../../utils"
import schema from "./schema"

const { TextArea } = Input;
const TextareaWapper = (item: any) => {
  const data: any = getItemProps(schema, item)
  const { componentType, FormItemProps, ControlProps } = data;
  const { placeholder } = ControlProps

  const TextareaBox = () => {
    return <TextArea
      className='kx_antd_textarea'
      {...ControlProps}
      placeholder={`${placeholder || '请输入' + FormItemProps.label}`}
    />
  }
  return <>
    {
      componentType === 'FormItem' ? <FormItem {...FormItemProps} >
        {TextareaBox()}
      </FormItem> : TextareaBox()
    }
  </>
};

export default TextareaWapper;
