UNPKG

490 BPlain TextView Raw
1import { getRules } from './Rules'
2import { RulePropsType } from './PropTypes'
3
4const getFieldDecorator = (
5 form: any,
6 id?: string,
7 initialValue?: string | (string | undefined)[] | boolean | number,
8 originRules?: RulePropsType,
9 options?: object
10) => {
11 const rules = getRules(originRules)
12 const fieldDecorator = form.getFieldDecorator(id, {
13 initialValue,
14 rules,
15 validateFirst: true,
16 ...options,
17 })
18
19 return fieldDecorator
20}
21
22export default getFieldDecorator