UNPKG

zp-bee

Version:

zp-bee,是一款基于 Dumi,由 React + TypeScript 开发的组件库 🎉。

52 lines (51 loc) 1.31 kB
import React from 'react'; import { ErrorMessage, CheckResult } from './interface'; import FormStore from './store'; export declare type Params = { /** * 组件id */ id: string | string[]; /** * 是否禁止输入 */ disabled?: boolean; /** * 是否必填 */ required?: boolean; /** * 错误信息 */ errors?: ErrorMessage[]; /** * 验证结果 */ checkResult: CheckResult | CheckResult[]; [key: string]: any; }; export declare type AutoWiredFuncChild = (params: Params) => React.ReactNode; export interface AutoWiredProps<T extends { [key: string]: any; } = any, P extends Extract<keyof T, string> | Extract<keyof T, string>[] = Extract<keyof T, string> | Extract<keyof T, string>[]> { store?: FormStore<T>; /** * 注入的字段 Key,可以是字符串 或 字符串数组 */ id: P; /** * 替换组件上 id */ replaceId?: string; /** * 数据注入props的名称 默认 value */ valueName?: string; /** * 数据收集的时机 默认 onChange */ trigger?: string; children?: React.ReactElement | AutoWiredFuncChild; } declare const _default: React.FunctionComponent<AutoWiredProps<any, string | string[]>>; export default _default;