import { isDate, isEmail, isURL } from '../common/validator'; import { CustomValidator, ValueType, FormRule, AllValidateResult, Data } from '../form/type'; export declare const ValidateStatus: { TO_BE_VALIDATED: number; SUCCESS: number; FAIL: number; }; export declare function isValueEmpty(val: any): boolean; declare const VALIDATE_MAP: { date: typeof isDate; url: typeof isURL; email: typeof isEmail; required: (val: ValueType) => boolean; whitespace: (val: ValueType) => boolean; boolean: (val: ValueType) => boolean; max: (val: ValueType, num: number) => boolean; min: (val: ValueType, num: number) => boolean; len: (val: ValueType, num: number) => boolean; number: (val: ValueType) => boolean; enum: (val: ValueType, strs: Array) => boolean; idcard: (val: ValueType) => boolean; telnumber: (val: ValueType) => boolean; pattern: (val: ValueType, regexp: RegExp | string) => boolean; validator: (val: ValueType, validate: CustomValidator, context?: { formData: Data; name: string; }) => ReturnType; }; export declare type ValidateFuncType = (typeof VALIDATE_MAP)[keyof typeof VALIDATE_MAP]; /** * 校验某一条数据的某一条规则,一种校验规则不满足则不再进行校验。 * @param value 值 * @param rule 校验规则 * @param context 表单上下文,包含 formData 和 name,供自定义校验器使用 * @returns 两种校验结果,一种是内置校验规则的校验结果哦,二种是自定义校验规则(validator)的校验结果 */ export declare function validateOneRule(value: ValueType, rule: FormRule, context?: { formData: Data; name: string; }): Promise; /** * 单个数据进行全规则校验 * 保留 validateRules 别名以兼容已有调用 */ export declare function validate(value: any, rules: any[], context?: { formData: Data; name: string; }): Promise; export declare const validateRules: typeof validate; export {};