import { DatePicker, } from 'antd';
import FormItem from '../FormItem/FormItem'
import React from 'react';
import { getItemProps } from "../../utils"
import schema from "./schema"
import 'moment/locale/zh-cn';

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

  const DateBox = () => {
    return <DatePicker
      className='kx_antd_datepicker'
      {...ControlProps}
      placeholder={`${placeholder || '请选择' + FormItemProps.label}`}
    />
  }
  return (
    <>
      {
        componentType === 'FormItem' ?
          <FormItem FormItemProps={...FormItemProps}  >
            {DateBox()}
          </FormItem> : DateBox()
      }
    </>
  );
};

export default DateWapper;
