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

const PasswordWapper = (item: any) => {
  const data: any = getItemProps(schema, item)
  const { componentType, ControlProps, FormItemProps } = data
  const { placeholder } = ControlProps
  const { label } = FormItemProps

  const PasswordBox = () => {
    return <Input.Password
      className='kx_antd_input_password'
      {...ControlProps}
      placeholder={`${placeholder || '请输入' + label}`}
    />
  }

  return <>
    {
      componentType === 'FormItem' ? <FormItem FormItemProps={...FormItemProps} >
        {PasswordBox()}
      </FormItem> : PasswordBox()
    }
  </>
};

export default PasswordWapper;
