import { ComponentType } from './types/index';

/**
 * @description: 生成 placeholder
 */
export function createPlaceholderMessage(component: ComponentType) {
  if (component === 'Input') return '请输入';
  if (
    ['Picker', 'Select', 'Checkbox', 'Radio', 'Switch', 'DatePicker', 'TimePicker'].includes(
      component,
    )
  )
    return '请选择';
  return '';
}

const DATE_TYPE = ['DatePicker', 'MonthPicker', 'WeekPicker', 'TimePicker'];

function genType() {
  return [...DATE_TYPE, 'RangePicker'];
}

/**
 * 时间字段
 */
export const dateItemType = genType();

export function defaultType(component) {
  if (component === 'Input') return '';
  if (component === 'InputNumber') return null;
  return ['Picker', 'Select', 'Checkbox', 'Radio', 'Switch', 'DatePicker', 'TimePicker'].includes(
    component,
  )
    ? ''
    : undefined;
}
