chowa
Version:
UI component library based on React
37 lines (36 loc) • 1.22 kB
TypeScript
/**
* @license chowa v1.1.3
*
* Copyright (c) Chowa Techonlogies Co.,Ltd.(http://www.chowa.cn).
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import * as React from 'react';
import { ValidatorStatus, FormValidatorProps } from './form-validator';
export declare type FormComponentType = React.ComponentClass<any> | React.FunctionComponent<any>;
export interface CreateFormProps {
form: {
Validator: React.SFC<FormValidatorProps>;
verify: (cb: (error: boolean, values: {
[key: string]: any;
}) => void) => void;
getValues: () => {
[key: string]: any;
};
getFieldValue: (name: string) => any;
resetFields: (name?: string, value?: any) => void;
resetValidator: (name?: string) => void;
};
}
export interface FormValidationProps {
component: FormComponentType;
forwardedRef: React.Ref<any>;
[key: string]: any;
}
export interface FormValidationState {
fields: {
[field: string]: ValidatorStatus;
};
}
export default function createForm(): (component: FormComponentType) => React.ForwardRefExoticComponent<any>;