/** * @author linhd * @date 2022/11/29 10:33 AM * @description 密码规则 */ import React, { FunctionComponent, ReactNode } from 'react'; import './index.scss'; export interface PasswordRulesConfigItemProps { /** 文案 */ label?: ReactNode; /** 正则 正则表达式 */ reg?: any; /** 自定义校验方法 * item: 当前项配置 * value: 校验值 * 返回值: * boolean: 表示是否校验通过,true通过 * ReactNode: 校验失败,当前显示的文本 */ validator?: (item: PasswordRulesConfigItemProps, value: string) => boolean | ReactNode; /** 校验结果 */ result?: boolean | ReactNode; [name: string]: any; } export interface PasswordRulesConfigProps { /** 标题 */ title?: ReactNode; /** 渲染类型 图标 / 序列,默认图标 */ type?: 'icon' | 'order'; /** 规则列表 */ list?: PasswordRulesConfigItemProps[]; [name: string]: any; } export interface PasswordRulesProps { /** 样式class */ className?: string; /** style */ style?: React.CSSProperties; /** 是否带有边框阴影 */ boxShadow?: boolean; /** 需要校验的值 */ value?: string; /** 配置 */ config?: PasswordRulesConfigProps | PasswordRulesConfigProps[]; /** * 校验结果全部回调 * true: 全部通过 * false: 全部未通过 * undefined: 未全部通过 * */ onCheckAll?: (bol: boolean | undefined) => void; [name: string]: any; } declare const PasswordRules: FunctionComponent; export default PasswordRules;