import { App, defineComponent, PropType } from 'vue';
import FormAlias from 'ant-design-vue/es/form';
import 'ant-design-vue/es/form/style';
import config from './config';
// @ts-ignore
import style from './style/index.module.less';

const Form = defineComponent({
  name: 'AForm',
  inheritAttrs: false,
  props: {
    customMode: {
      type: String as PropType<'normal' | 'detail'>,
      default: 'normal'
    }
  },
  setup(props, { attrs, slots }) {
    return () => (
      <FormAlias
        class={`${style['unity-form']} ${
          props.customMode === 'detail' ? style['unity-form-detail'] : ''
        }`}
        {...config.props}
        {...attrs}
        v-slots={slots}
      />
    );
  }
});

export default Form as typeof Form & {
  install: (app: App, ...options: any[]) => any;
};
