Skip to content

Commit b26d048

Browse files
authored
feat: replace async-validator to @rc-component/async-validator (#679)
* feat: replace async-validator to @rc-component/async-validator * feat: doc
1 parent b576957 commit b26d048

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ open http://localhost:8000
2424
## Feature
2525

2626
- Support react.js and even react-native
27-
- Validate fields with [async-validator](https://github.com/yiminghe/async-validator/)
27+
- Validate fields with [@rc-component/async-validator](https://github.com/react-component/async-validator/)
2828

2929
## Install
3030

@@ -35,13 +35,13 @@ open http://localhost:8000
3535
```js | pure
3636
import Form, { Field } from 'rc-field-form';
3737

38-
const Input = ({ value = "", ...props }) => <input value={value} {...props} />;
38+
const Input = ({ value = '', ...props }) => <input value={value} {...props} />;
3939

4040
const Demo = () => {
4141
return (
4242
<Form
43-
onFinish={(values) => {
44-
console.log("Finish:", values);
43+
onFinish={values => {
44+
console.log('Finish:', values);
4545
}}
4646
>
4747
<Field name="username">
@@ -81,20 +81,20 @@ We use typescript to create the Type definition. You can view directly in IDE. B
8181

8282
### Field
8383

84-
| Prop | Description | Type | Default |
85-
| ----------------- | ----------------------------------------------------------------------------- | ------------------------------------------- | -------- |
86-
| dependencies | Will re-render if dependencies changed | [NamePath](#namepath)[] | - |
87-
| getValueFromEvent | Specify how to get value from event | (..args: any[]) => any | - |
88-
| getValueProps | Customize additional props with value. This prop will disable `valuePropName` | (value) => any | - |
89-
| initialValue | Field initial value | any | - |
90-
| name | Field name path | [NamePath](#namepath) | - |
91-
| normalize | Normalize value before update | (value, prevValue, prevValues) => any | - |
92-
| preserve | Preserve value when field removed | boolean | false |
93-
| rules | Validate rules | [Rule](#rule)[] | - |
84+
| Prop | Description | Type | Default |
85+
| ----------------- | ----------------------------------------------------------------------------- | ---------------------------------------------- | -------- |
86+
| dependencies | Will re-render if dependencies changed | [NamePath](#namepath)[] | - |
87+
| getValueFromEvent | Specify how to get value from event | (..args: any[]) => any | - |
88+
| getValueProps | Customize additional props with value. This prop will disable `valuePropName` | (value) => any | - |
89+
| initialValue | Field initial value | any | - |
90+
| name | Field name path | [NamePath](#namepath) | - |
91+
| normalize | Normalize value before update | (value, prevValue, prevValues) => any | - |
92+
| preserve | Preserve value when field removed | boolean | false |
93+
| rules | Validate rules | [Rule](#rule)[] | - |
9494
| shouldUpdate | Check if Field should update | boolean \| (prevValues, nextValues) => boolean | - |
95-
| trigger | Collect value update by event trigger | string | onChange |
96-
| validateTrigger | Config trigger point with rule validate | string \| string[] | onChange |
97-
| valuePropName | Config value mapping prop with element | string | value |
95+
| trigger | Collect value update by event trigger | string | onChange |
96+
| validateTrigger | Config trigger point with rule validate | string \| string[] | onChange |
97+
| valuePropName | Config value mapping prop with element | string | value |
9898

9999
### List
100100

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
},
5151
"dependencies": {
5252
"@babel/runtime": "^7.18.0",
53-
"async-validator": "^4.1.0",
53+
"@rc-component/async-validator": "^5.0.1",
5454
"rc-util": "^5.32.2"
5555
},
5656
"devDependencies": {

src/utils/validateUtil.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import RawAsyncValidator from 'async-validator';
1+
import RawAsyncValidator from '@rc-component/async-validator';
22
import * as React from 'react';
33
import warning from 'rc-util/lib/warning';
44
import type {

0 commit comments

Comments
 (0)