Skip to content

Commit 6aaa51f

Browse files
committed
refactor(docs): update some docs
1 parent 61e8cb8 commit 6aaa51f

File tree

71 files changed

+822
-5
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+822
-5
lines changed

docs/API/SchemaForm.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ import SchemaForm from '@uform/next(antd)'
1919
| value | 表单值,受控态使用 | Object | {} |
2020
| initialValues | 表单值,受控态使用 | Object | {} |
2121
| locale | 表单国际化文案 | Object | {} |
22-
| schema | 表单json schema,具体参考 [扩展规范](https://yuque.antfin-inc.com/ascp-fe/uform/vu8y9o) | Object | {type:"object",properties:{}} |
22+
| schema | 表单json schema,具体参考 [扩展规范](#/MpI2Ij/1gSGSDf5) | Object | {type:"object",properties:{}} |
2323
| onChange | 表单变化事件回调 | `Function(values : Object){}` | |
2424
| onSubmit | 表单提交事件回调 | `Function(values : Object){}` | |
2525
| onReset | 表单重置事件回调 | `Function(values : Object){}` | |
2626
| onValidateFailed | 表单校验失败事件回调 | Function | |
2727
| editable | 控制表单字段是否可编辑状态 | `Boolean | Function(name : String) : Boolean` | |
28-
| actions | 需要握手的表单actions,只接收通过[createFormActions](https://yuque.antfin-inc.com/ascp-fe/uform/ggm005)创建出来的actions | Object | |
28+
| actions | 需要握手的表单actions,只接收通过[createFormActions](#/aAUeUD/XEFAF7HoHV)创建出来的actions | Object | |
2929
| effects | 副作用处理函数 | Function | |
3030

3131
## 副作用处理

docs/API/SchemaForm_React.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ import SchemaForm from '@uform/react'
1919
| value | 表单值,受控态使用 | Object | {} |
2020
| initialValues | 表单值,受控态使用 | Object | {} |
2121
| locale | 表单国际化文案 | Object | {} |
22-
| schema | 表单json schema,具体参考 [扩展规范](https://yuque.antfin-inc.com/ascp-fe/uform/vu8y9o) | Object | {type:"object",properties:{}} |
22+
| schema | 表单json schema,具体参考 [扩展规范](#/MpI2Ij/1gSGSDf5) | Object | {type:"object",properties:{}} |
2323
| onChange | 表单变化事件回调 | `Function(values : Object){}` | |
2424
| onSubmit | 表单提交事件回调 | `Function(values : Object){}` | |
2525
| onReset | 表单重置事件回调 | `Function(values : Object){}` | |
2626
| onValidateFailed | 表单校验失败事件回调 | Function | |
2727
| editable | 控制表单字段是否可编辑状态 | `Boolean | Function(name : String) : Boolean` | |
28-
| actions | 需要握手的表单actions,只接收通过[createFormActions](https://yuque.antfin-inc.com/ascp-fe/uform/ggm005)创建出来的actions | Object | |
28+
| actions | 需要握手的表单actions,只接收通过[createFormActions](#/aAUeUD/XEFAF7HoHV)创建出来的actions | Object | |
2929
| effects | 副作用处理函数 | `Function( selector : Function, actions: FormActions){}` | |
3030

3131

docs/API/createFormActions.md

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# createFormActions
2+
3+
## 介绍
4+
5+
声明表单 Actions,用于跨组件通讯
6+
7+
## 类型描述
8+
9+
```typescript
10+
type createFormActions() : {
11+
setFormState(callback : (state : formState)=>void) : Promise, //设置表单状态,目前只支持设置formState.values
12+
getFormState(callback : (state : formState)=>any)), //获取表单状态
13+
setFieldState(name : String,callback : (state : fieldState)=>void) : Promise, //设置表单字段状态,目前支持设置fieldState的所有属性
14+
getFieldState(name : String,callback : (state : fieldState)=>any)),//获取表单字段状态
15+
reset(),//重置表单
16+
submit(),//提交表单
17+
validate(),//校验表单
18+
getSchema(name : String) //获取表单Schema
19+
}
20+
```
21+
22+
## formState
23+
24+
用于描述整个表单状态的模型对象
25+
26+
```typescript
27+
type formState {
28+
values : Object, //表单数据
29+
valid : Boolean, //是否合法
30+
invalid : Boolean, //是否不合法
31+
errors : Array<String>, //错误提示集合
32+
pristine : Boolean, //是否是原始态
33+
dirty : Boolean //是否存在变化
34+
}
35+
```
36+
37+
## fieldState
38+
39+
用于描述表单字段状态的模型对象
40+
41+
```typescript
42+
type fieldState {
43+
value : Any,//字段值
44+
valid : Boolean,//字段是否合法
45+
invalid : Boolean,//字段是否非法
46+
visible : Boolean,//字段显示状态
47+
editable : Boolean,//字段是否可编辑
48+
loading : Boolean,//字段加载状态
49+
errors : Array<String>,//字段错误消息集合
50+
pristine : Boolean,//字段是否处于原始态
51+
initialValue : Any,//字段初始值
52+
name : String,//字段路径
53+
path, : Array<String>//字段路径,数组形式
54+
props : Object,//字段附加属性
55+
rules : Array<Object | Function | String>//字段校验规则
56+
}
57+
```
58+
59+
## 依赖
60+
61+
```javascript
62+
import { createFormActions } from '@uform/react'
63+
```
64+
65+
## 用例
66+
67+
```jsx
68+
import React from 'react'
69+
import ReactDOM from 'react-dom'
70+
import SchemaForm, {
71+
Field,
72+
registerFormField,
73+
connect,
74+
createFormActions
75+
} from '@uform/react'
76+
77+
registerFormField(
78+
'string',
79+
connect()(props => <input {...props} value={props.value || ''} />)
80+
)
81+
82+
const actions = createFormActions()
83+
84+
ReactDOM.render(
85+
<div>
86+
<SchemaForm actions={actions}>
87+
<Field name="aa" type="string" />
88+
</SchemaForm>
89+
<button
90+
onClick={() => {
91+
actions.submit()
92+
}}
93+
>
94+
提交表单
95+
</button>
96+
</div>,
97+
document.getElementById('root')
98+
)
99+
```

docs/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- [registerFieldMiddleware](./API/registerFieldMiddleware.md)
2121
- [createVirtualBox](./API/createVirtualBox.md)
2222
- [connect](./API/connect.md)
23+
- [createFormActions](./API/createFormActions.md)
2324
- @uform/next or antd
2425
- [<SchemaForm/>](./API/SchemaForm.md)
2526
- [<FormButtonGroup/>](./API/FormButtonGroup.md)

docs/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@
2929
src="https://unpkg.com/react-is@16/umd/react-is.production.min.js"
3030
></script>
3131

32-
<script type="text/javascript" src="statics/bundle.main.109ad769777e1adad4a6.js"></script></body>
32+
<script type="text/javascript" src="statics/bundle.main.4fe11b94d773a4a0546b.js"></script></body>
3333
</html>

docs/statics/bundle.0.4fe11b94d773a4a0546b.js

+32
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/statics/bundle.0.4fe11b94d773a4a0546b.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/statics/bundle.1.4fe11b94d773a4a0546b.js

+41
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/statics/bundle.1.4fe11b94d773a4a0546b.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/statics/bundle.10.4fe11b94d773a4a0546b.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/statics/bundle.10.4fe11b94d773a4a0546b.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)