tdesign-mobile-vue
Version:
tdesign-mobile-vue
27 lines (26 loc) • 1.29 kB
TypeScript
import isDate from 'validator/lib/isDate';
import isEmail from 'validator/lib/isEmail';
import isURL from 'validator/lib/isURL';
import { CustomValidator, FormRule, ValueType, AllValidateResult, CustomValidateResolveType } from './type';
export declare function isValueEmpty(val: ValueType): boolean;
declare const VALIDATE_MAP: {
date: typeof isDate;
url: typeof isURL;
email: typeof isEmail;
required: (val: any) => boolean;
whitespace: (val: any) => boolean;
boolean: (val: any) => boolean;
max: (val: any, num: number) => boolean;
min: (val: any, num: number) => boolean;
len: (val: any, num: number) => boolean;
number: (val: any) => boolean;
enum: (val: any, strs: string[]) => boolean;
idcard: (val: any) => boolean;
telnumber: (val: any) => boolean;
pattern: (val: any, regexp: string | RegExp) => boolean;
validator: (val: any, validate: CustomValidator) => Promise<CustomValidateResolveType> | CustomValidateResolveType;
};
export type ValidateFuncType = (typeof VALIDATE_MAP)[keyof typeof VALIDATE_MAP];
export declare function validateOneRule(value: ValueType, rule: FormRule): Promise<AllValidateResult>;
export declare function validate(value: ValueType, rules: Array<FormRule>): Promise<AllValidateResult[]>;
export {};