import { CSSProperties, SetupContext, VNode } from 'vue';
import { Recordable, RenderOpts } from '@maxax/types';
import { ButtonProps, FormItemProps, FormItemRule, RowProps } from 'naive-ui';
import { FormValidate } from 'naive-ui/es/form/src/interface';
import { BasicFormColProps } from './col';
import { ComponentProps, ComponentType } from './component';
import { FormItem } from './formItem';
import { HelpComponentProps } from './help';
export interface BasicFormProps {
    card?: boolean;
    border?: boolean;
    name?: string;
    showRequireMark?: boolean | undefined;
    requireMarkPlacement?: 'left' | 'right' | 'right-hanging';
    showFeedback?: boolean;
    showLabel?: boolean;
    labelWidth?: number | string;
    labelAlign?: 'left' | 'right';
    labelPlacement?: 'top' | 'left';
    inline?: boolean;
    layout?: 'vertical' | 'inline' | 'horizontal';
    model?: Recordable;
    rowProps?: RowProps;
    submitOnReset?: boolean;
    submitOnChange?: boolean;
    labelCol?: Partial<BasicFormColProps>;
    wrapperCol?: Partial<BasicFormColProps>;
    baseRowStyle?: CSSProperties;
    baseColProps?: Partial<BasicFormColProps>;
    schemas?: FormSchema[];
    mergeDynamicData?: Recordable;
    compact?: boolean;
    emptySpan?: number | Partial<BasicFormColProps>;
    size?: 'small' | 'medium' | 'large';
    disabled?: boolean;
    readonly?: boolean;
    fieldMapToTime?: FormFieldMapToTime;
    autoSetPlaceHolder?: boolean;
    autoSubmitOnEnter?: boolean;
    rulesMessageJoinLabel?: boolean;
    showAdvancedButton?: boolean;
    autoFocusFirstItem?: boolean;
    autoAdvancedLine?: number;
    alwaysShowLines?: number;
    showActionButtonGroup?: boolean;
    resetButtonOptions?: Partial<ButtonProps>;
    submitButtonOptions?: Partial<ButtonProps>;
    toggleButtonOptions?: Partial<ButtonProps>;
    actionColOptions?: Partial<BasicFormColProps>;
    actionFormItemProps?: Partial<FormItemProps>;
    showResetButton?: boolean;
    showSubmitButton?: boolean;
    resetFunc?: () => Promise<void>;
    submitFunc?: () => Promise<void>;
    transformDateFunc?: (date: any) => string;
    colon?: boolean;
    above?: boolean;
}
interface BaseFormSchema<T extends ComponentType = any> {
    field: string;
    fields?: string[];
    changeEvent?: string;
    valueField?: string;
    label?: string | VNode | ((renderCallbackParams: FormRenderCallbackParams) => string | VNode);
    subLabel?: string;
    helpMessage?: string | string[] | ((renderCallbackParams: FormRenderCallbackParams) => string | string[]);
    helpComponentProps?: Partial<HelpComponentProps>;
    labelWidth?: string | number;
    disabledLabelWidth?: boolean;
    componentProps?: ((opt: {
        schema: FormSchema;
        formActionType: FormActionType;
        formModel: Recordable;
        setFormModel: (key: string, value: any, schema: BasicFormSchema) => void;
    }) => ComponentProps[T]) | ComponentProps[T];
    required?: boolean | ((renderCallbackParams: FormRenderCallbackParams) => boolean);
    suffix?: string | number | VNode | ((renderCallbackParams: FormRenderCallbackParams) => string | VNode | number);
    prefix?: string | number | VNode | ((renderCallbackParams: FormRenderCallbackParams) => string | VNode | number);
    rules?: Rule[];
    rulesMessageJoinLabel?: boolean;
    itemProps?: Partial<FormItem>;
    colProps?: Partial<BasicFormColProps>;
    defaultValue?: any;
    defaultValueObj?: {
        [key: string]: any;
    };
    isHandleDateDefaultValue?: boolean;
    isHandleDefaultValue?: boolean;
    isAdvanced?: boolean;
    span?: number;
    ifShow?: boolean | ((renderCallbackParams: FormRenderCallbackParams) => boolean);
    show?: boolean | ((renderCallbackParams: FormRenderCallbackParams) => boolean);
    render?: (renderCallbackParams: FormRenderCallbackParams, opts: RenderOpts) => VNode | VNode[] | string;
    renderColContent?: (renderCallbackParams: FormRenderCallbackParams, opts: RenderOpts) => VNode | VNode[] | string;
    renderComponentContent?: ((renderCallbackParams: FormRenderCallbackParams, opts: RenderOpts) => any) | VNode | VNode[] | string;
    customRenderComponent?: ((props: Recordable, ctx: SetupContext) => any) | VNode | VNode[] | string;
    slot?: string;
    colSlot?: string;
    dynamicDisabled?: boolean | ((renderCallbackParams: FormRenderCallbackParams) => boolean);
    dynamicReadonly?: boolean | ((renderCallbackParams: FormRenderCallbackParams) => boolean);
    dynamicRules?: (renderCallbackParams: FormRenderCallbackParams) => Rule[];
    valueFormat?: (arg: Partial<FormRenderCallbackParams> & {
        value: any;
    }) => any;
}
export interface ComponentFormSchema<T extends ComponentType = any> extends BaseFormSchema<T> {
    component: T;
}
export interface SlotFormSchema extends BaseFormSchema {
    slot: string;
}
type ComponentFormSchemaType<T extends ComponentType = ComponentType> = T extends any ? ComponentFormSchema<T> : never;
export type FormSchema = ComponentFormSchemaType | SlotFormSchema;
export type BasicFormSchema = Partial<ComponentFormSchema> & Partial<SlotFormSchema> & BaseFormSchema;
export type BasicFormValidate = FormValidate;
export interface FormActionType {
    submit: () => Promise<void>;
    updateSchema: (data: Partial<BasicFormSchema> | Array<Partial<BasicFormSchema>>) => Promise<void>;
    resetSchema: (data: Partial<BasicFormSchema> | Array<Partial<BasicFormSchema>>) => Promise<void>;
    removeSchemaByField: (field: string | string[]) => Promise<void>;
    appendSchemaByField: (schema: BasicFormSchema | BasicFormSchema[], prefixField?: string, first?: boolean | undefined) => Promise<void>;
    setProps: (formProps: Partial<BasicFormProps>) => Promise<void>;
    resetFields: () => Promise<void>;
    setFieldsValue: (values: Recordable) => Promise<void>;
    getFieldsValue: () => Recordable;
    validate: BasicFormValidate;
    restoreValidation: () => void;
    validateForm: () => Promise<Recordable>;
    validateFields: (nameList: string[]) => Promise<Recordable>;
    resetDefaultField: (nameList?: string[] | undefined) => void;
    getFieldsValueAsync: () => Promise<Recordable>;
    trigger: (data: Recordable) => void;
}
export interface FormRenderCallbackParams {
    schema: BasicFormSchema;
    values: Recordable;
    model: Recordable;
    field: string;
}
export type FormFieldMapToTime = Array<[string, [string, string], (string | [string, string])?]>;
export type Rule = FormItemRule & {
    trigger?: 'blur' | 'change' | ['change', 'blur'];
};
export interface BasicFormEmitType {
    (_e: 'advanced-change', isAdvanced: boolean): void;
    (_e: 'reset', values: Recordable): void;
    (_e: 'submit', values: Recordable): void;
    (_e: 'fieldValueChange', key: string, value: any): void;
    (_e: 'trigger', data: Recordable): void;
}
export {};
//# sourceMappingURL=form.d.ts.map