Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | export type LocaleValueFnParams<TExtra extends {} = {}> = {
path: string
type: string
label?: string
value: any
originalValue: any
} & TExtra
export type LocaleValueFn<TExtra extends {} = {}> = (
params: LocaleValueFnParams<TExtra>,
) => string
export type LocaleValue<TExtra extends {} = {}> = string | LocaleValueFn<TExtra>
export interface MixedLocale {
default: LocaleValue
required: LocaleValue
oneOf: LocaleValue<{ values: string }>
notOneOf: LocaleValue<{ values: string }>
notType: LocaleValue
defined: LocaleValue
}
export interface StringLocale {
length: LocaleValue<{ length: number }>
min: LocaleValue<{ min: number }>
max: LocaleValue<{ max: number }>
matches: LocaleValue<{ regex: RegExp }>
email: LocaleValue<{ regex: RegExp }>
url: LocaleValue<{ regex: RegExp }>
trim: LocaleValue
lowercase: LocaleValue
uppercase: LocaleValue
chineseMobilePhoneNumber: LocaleValue
chineseIDCardNumber: LocaleValue
}
export interface NumberLocale {
min: LocaleValue<{ min: number }>
max: LocaleValue<{ max: number }>
lessThan: LocaleValue<{ less: number }>
moreThan: LocaleValue<{ more: number }>
positive: LocaleValue<{ more: number }>
negative: LocaleValue<{ less: number }>
integer: LocaleValue
id: LocaleValue
positiveInteger: LocaleValue
negativeInteger: LocaleValue
nonPositive: LocaleValue
nonNegative: LocaleValue
nonPositiveInteger: LocaleValue
nonNegativeInteger: LocaleValue
}
export interface DateLocale {
min: LocaleValue<{ min: Date | string }>
max: LocaleValue<{ max: Date | string }>
}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface BooleanLocale {}
export interface ObjectLocale {
noUnknown: LocaleValue<{ unknown: string }>
}
export interface ArrayLocale {
min: LocaleValue<{ min: number }>
max: LocaleValue<{ max: number }>
}
export interface Locale {
mixed: MixedLocale
string: StringLocale
number: NumberLocale
date: DateLocale
boolean: BooleanLocale
object: ObjectLocale
array: ArrayLocale
}
|