// 此类提供airTable,所有基础组件
import React from 'react';
import { Icon } from 'antd';
import { SetFormatter, formatStr } from './_utils/setFormatter';
import { GetFormatter } from './_utils/getFormatter';
export const config: any = {
    '1': {
        name: '单行文本',
        component: require('./edit/input').default,
        setFormatter: SetFormatter['INPUT'],
        getFormatter: GetFormatter['INPUT'],
        componentAttr: {
            autoFocus: true,
            emitTrigger: 'onBlur',
        },
        detail: require('./detail/input').default,
    },
    '2': {
        name: '超链接',
        component: require('./edit/search').default,
        getFormatter: GetFormatter.LINK,
        setFormatter: SetFormatter.LINK,
        detail: require('./detail/link').default,
    },
    '3': {
        name: '多行文本',
        component: require('./edit/textarea').default,
        getFormatter: GetFormatter['TEXTAREA'],
        setFormatter: SetFormatter['TEXTAREA'],
        componentAttr: {
            autoFocus: true,
            emitTrigger: 'onBlur',
        },
        detail: require('./detail/textarea').default,
    },
    '4': {
        name: '附件上传',
        component: require('./edit/input').default,
        setFormatter: SetFormatter['INPUT'],
        getFormatter: GetFormatter['INPUT'],
        detail: require('./detail/input').default,
    },
    '5': {
        name: '复选',
        component: require('./edit/checkbox').default, // 暂未添加
        getFormatter: GetFormatter['CHECKBOX'],
        setFormatter: SetFormatter['CHECKBOX'],
        detail: require('./detail/checkbox').default,
    },
    '6': {
        name: '下拉单选',
        component: require('./edit/select').default,
        componentAttr: {
            labelInValue: true,
            allowClear: true,
            autoFocus: true,
            emitTrigger: 'onBlur',
        },
        getFormatter: GetFormatter['SELECT'],
        setFormatter: SetFormatter['SELECT'],
        detail: require('./detail/select').default,
    },
    '7': {
        name: '下拉多选',
        component: require('./edit/multiple-select').default,
        componentAttr: {
            labelInValue: true,
            mode: 'tags',
            maxTagCount: 3,
            autoFocus: true,
            emitTrigger: 'onBlur',
        },
        getFormatter: GetFormatter['MULTIPLE_SELECT'],
        setFormatter: SetFormatter['MULTIPLE_SELECT'],
        detail: require('./detail/multiple-select').default,
    },
    '8': {
        name: '评级',
        component: require('./edit/rate').default,
        componentAttr: {
            allowClear: true,
            character: <Icon type="like" theme="filled" />,
        },
        getFormatter: GetFormatter['RATE'],
        setFormatter: SetFormatter['RATE'],
        detail: require('./detail/rate').default,
    },
    '9': {
        name: '数字输入',
        component: require('./edit/number').default,
        componentAttr: {
            autoFocus: true,
            emitTrigger: 'onBlur',
            precision: 2,
        },
        setFormatter: SetFormatter['NUMBER'],
        getFormatter: GetFormatter['NUMBER'],
        detail: require('./detail/number').default,
    },
    '10': {
        name: '百分比',
        component: require('./edit/percentage').default, // 暂未添加
        setFormatter: SetFormatter['PERCENTAGE'],
        getFormatter: GetFormatter['PERCENTAGE'],
        detail: require('./detail/percentage').default,
    },
    '11': {
        name: '日期',
        component: require('./edit/date').default,
        componentAttr: {
            format: formatStr,
            showTime: true,
        },
        getFormatter: GetFormatter['DATE'],
        setFormatter: SetFormatter['DATE'],
        detail: require('./detail/date').default,
    },
    '12': {
        name: '引用',
        component: require('./edit/link').default, // 暂未添加
        getFormatter: GetFormatter['LINK'],
        setFormatter: SetFormatter['LINK'],
        detail: require('./detail/link').default,
    },
    '13': {
        name: '模糊搜索多选',
        component: require('./edit/multiple-search').default,
        getFormatter: GetFormatter['MULTIPLE_SEARCH'],
        setFormatter: SetFormatter['MULTIPLE_SEARCH'],
        componentAttr: {
            allowClear: true,
        },
        detail: require('./detail/multiple-search').default,
    },
    // '14': {
    //     name: '树组件',
    //     component: require('./edit/tree-select').default,
    //     placeholder: '请选择',
    //     getFormatter: GetFormatter['TREE_SELECT'],
    //     setFormatter: SetFormatter['TREE_SELECT'],
    //     detail: require('./detail/tree-select').default,
    // },
    '15': {
        name: '文本选择',
        component: require('./edit/text-select').default,
        getFormatter: GetFormatter['TEXT_SELECT'],
        setFormatter: SetFormatter['TEXT_SELECT'],
        componentAttr: {
            allowClear: true,
        },
        detail: require('./detail/text-select').default,
    },
};
