add options.preserve of form

This commit is contained in:
zombiej 2018-12-21 23:58:31 +08:00
parent 607d08094d
commit f65fb2867f
4 changed files with 4 additions and 1 deletions

View File

@ -84,6 +84,7 @@ export type GetFieldDecoratorOptions = {
normalize?: (value: any, prevValue: any, allValues: any) => any;
/** Whether stop validate on first rule of error for this field. */
validateFirst?: boolean;
preserve?: boolean;
};
// function create

View File

@ -172,6 +172,7 @@ After wrapped by `getFieldDecorator`, `value`(or other property defined by `valu
| options.getValueProps | Get the component props according to field value. | function(value): any | [reference](https://github.com/react-component/form#option-object)
| options.initialValue | You can specify initial value, type, optional value of children node. (Note: Because `Form` will test equality with `===` internally, we recommend to use variable as `initialValue`, instead of literal) | | n/a |
| options.normalize | Normalize value to form component, [a select-all example](https://codepen.io/afc163/pen/JJVXzG?editors=001) | function(value, prevValue, allValues): any | - |
| options.preserve | Keep the field even if field removed | boolean | - |
| options.rules | Includes validation rules. Please refer to "Validation Rules" part for details. | object\[] | n/a |
| options.trigger | When to collect the value of children node | string | 'onChange' |
| options.validateFirst | Whether stop validate on first rule of error for this field. | boolean | false |

View File

@ -174,6 +174,7 @@ validateFields(['field1', 'field2'], options, (errors, values) => {
| options.getValueFromEvent | 可以把 onChange 的参数(如 event转化为控件的值 | function(..args) | [reference](https://github.com/react-component/form#option-object) |
| options.initialValue | 子节点的初始值,类型、可选值均由子节点决定(注意:由于内部校验时使用 `===` 判断是否变化,建议使用变量缓存所需设置的值而非直接使用字面量)) | | |
| options.normalize | 转换默认的 value 给控件,[一个选择全部的例子](https://codepen.io/afc163/pen/JJVXzG?editors=001) | function(value, prevValue, allValues): any | - |
| options.preserve | 即便字段不再使用,也保留该字段的值 | boolean | - |
| options.rules | 校验规则,参考下方文档 | object\[] | |
| options.trigger | 收集子节点的值的时机 | string | 'onChange' |
| options.validateFirst | 当某一规则校验不通过时,是否停止剩下的规则的校验 | boolean | false |

View File

@ -63,7 +63,7 @@
"rc-drawer": "~1.7.6",
"rc-dropdown": "~2.3.0",
"rc-editor-mention": "^1.1.7",
"rc-form": "^2.3.0",
"rc-form": "^2.4.0",
"rc-input-number": "~4.3.7",
"rc-menu": "~7.4.12",
"rc-notification": "~3.3.0",