UNPKG

el-plus-powerful-form

Version:

## [DOCS](https://peng-xiao-shuai.github.io/vite-vue-admin-docs/zh-CN/component_directive/component/powerful-form-doc.html)

88 lines (86 loc) 2.21 kB
import { FormItem, FormType, FunBol, PowerfulFormData } from '../index'; import { FormItemRule } from 'element-plus'; import { LangKey } from '../locale/lang'; /** * 校验规则 */ export declare const verify: { phone: { pattern: RegExp; message: LangKey; trigger: string; }; email: { type: string; message: LangKey; trigger: string; }; code: { pattern: RegExp; message: LangKey; trigger: string; }; https: { pattern: RegExp; message: LangKey; trigger: string; }; ip: { pattern: RegExp; message: LangKey; trigger: string; }; number: { pattern: RegExp; message: LangKey; trigger: string; }; english: { pattern: RegExp; message: LangKey; trigger: string; }; chinese: { pattern: RegExp; message: LangKey; trigger: string; }; }; export declare const verifyFormItemRule: { [s: string]: FormItemRule; }; /** * @description 类型保护 * @see https://www.tslang.cn/docs/handbook/advanced-types.html 搜索 “自定义类型保护” * @param {T} obj 值,它必须是联合类型 * @param {(obj: T) => boolean} cb 回调函数,返回一个布尔值 * @example * const a = [] | string * a.push() // 报错 * if (isTypeProtect<typeof a, []>(a, (a) => Array.isArray(a))) { * a.push() // 正常 * } * @returns {boolean} */ export declare const isTypeProtect: <T, P extends T>(obj: T, cb: (obj: T) => boolean) => obj is P; /** * 匹配组件 * @param {Exclude<keyof FormType, 'slot'>} type 类型 * @returns 组件名称 */ export declare const matchComponents: (type: Exclude<keyof FormType, "slot">) => string; /** * 是否是boolean 还是 fun 函数类型 * @param val 值 * @param params val 为函数类型时 参数 * @returns {boolean} true 为禁用 */ export declare const isBolOrFun: (val: FunBol, params: { formData: PowerfulFormData["formData"]; formItem: FormItem; index: number; }) => boolean; /** * 清除:和 空格 */ export declare const clearSymbol: (v: string | undefined) => string | undefined;