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

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

  const InputNumberBox = () => {
    return <InputNumber
      className='kx_antd_input_number'
      {...ControlProps}
      placeholder={placeholder || `请输入${FormItemProps?.label}`}
    />
  }

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

export default MoneyWapper;
