import { Rule } from "antd/es/form";
import { ReactText } from "react";

export interface Props {
    formConfig: FormConfig[],
    title?: string,
    flow: 'row' | 'column',
    submit?: (value: any, key: string) => void,
    getFormValues?: (values: { changedValues: any, allValues: any }) => void,
    getFormSubmit?: (fun: any) => void,
    setFormValues?: (fun: any) => void,
    defaultProps?: object,
    formFlex?: 'flex-start' | 'flex-end' | 'space-around' | 'space-between' | 'space-evenly' | 'center',
    labelCol?:{span?:number,offset?:number},
    ew?: boolean,
    isAll?:boolean,
    isFirstLeftNull?: boolean
}
export interface Children {
    value: string,
    text: string
}
/**
 * @param {string} name 字段名
 * @param {string} tag 标签组件名
 * @param {string} label 标签的文本
 * @param {boolean} required 是否必填项
 * @param {object} tagProps 传入一个对象，为对应标签的参数具体有哪些参数查询antd对应组件的Api
 * @param {"button" | "submit" | "reset"} htmlType button 类型
 * @param {Function} callback 当button htmlType为button时 回调函数生效一般用于弹窗等事件
 * @param {boolean} change 立即执行回调函数
 */
export interface FormConfig {
    label?: string,
    tag: 'input' | 'select' | 'DatePicker' | 'button' | 'RangePicker' | 'inputSearch' | 'radio' | 'switch' | 'inputSearch' | 'TextArea' | 'inputFile' | 'imgCrop' | 'inputNumber',
    name: string,
    placeholder?: string,
    disabled?: boolean,
    btnType?: "link" | "ghost" | "default" | "primary" | "dashed",
    htmlType?: "button" | "submit" | "reset",
    showTime?: boolean,
    mode?: 'multiple' | 'tags',
    tagProps?: object,
    children?: Children[],
    width?: number,
    textSwitch?: string[],
    callback?: (a?: any) => void,
    icon?: React.ReactNode,
    required?: boolean,
    message?: string,
    defaultValue?: string | string[],
    rows?: number,
    copy?: string,
    change?: boolean
    Rule?: any,
    isShowUp?: boolean,
    formatter?: ((value: string | number | undefined) => string) | undefined,
    parser?: ((value: string) => ReactText) | undefined
}

