<script setup lang="ts">
  import { BasicForm, useForm } from '/@/components/Form';
  import { defaultSchemas, SchemaFiled } from './config';
  import { onMounted } from 'vue';
  import { useGridLayout } from '/@/hooks/component/useGridLayout';
  import { ColEx } from '/@/components/Form/src/types';

  const emit = defineEmits(['register']);
  const [register, method] = useForm({
    schemas: defaultSchemas,
    labelWidth: 120,
    baseColProps: useGridLayout(2, 3, 4) as unknown as ColEx,
    fieldMapToTime: [
      [SchemaFiled.DATE_RANGE, [SchemaFiled.START_TS, SchemaFiled.END_TS], 'YYYY-MM-DD HH:mm:ss'],
    ],
  });
  onMounted(() => {
    emit('register', method);
  });
</script>

<template>
  <BasicForm @register="register" />
</template>
