1 | import { getRules } from './Rules'
|
2 | import { RulePropsType } from './PropTypes'
|
3 |
|
4 | const 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 |
|
22 | export default getFieldDecorator
|