UNPKG

@aliretail/react-materials-components

Version:
45 lines (44 loc) 1.27 kB
import * as React from 'react'; import { InputProps } from '@alifd/next/types/input/index'; declare type TValue = Record<string, string | number>; export interface IComProps { inputList: Array<{ regExp?: RegExp; regExpErrorMsg?: string; key: string; required: string; } & InputProps>; value: TValue; isPreview: boolean; readOnly: boolean; disabled: boolean; onChange: (val: TValue) => void; } interface IComState { errorMsg: Partial<Record<string, string>>; } export default class MultiInput extends React.Component<IComProps, IComState> { static defaultProps: { inputList: any[]; isPreview: boolean; readOnly: boolean; disabled: boolean; value: {}; onChange: () => void; }; state: { errorMsg: {}; }; /** * 校验规则,提供外部使用 ref 方式调用 * @param isRequired 是否是必填项 */ validate: (isRequired?: boolean) => true | Partial<Record<string, string>>; setErrors(error: IComState['errorMsg']): void; clearErrors(): void; isEmptyValue(): boolean; isEmptyErrorMsg(): boolean; isEmptyObjVal(obj: Record<string, any>): boolean; render(): JSX.Element; } export {};