@kne/react-form-antd 3.0.35 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -35
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,35 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
|
|
2
|
+
# react-form-antd
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### 描述
|
|
6
|
+
|
|
7
|
+
把 @kne/react-form 表单校验逻辑应用到antd
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### 安装
|
|
11
|
+
|
|
12
|
+
```shell
|
|
13
|
+
npm i --save @kne/react-form-antd
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### 概述
|
|
18
|
+
|
|
19
|
+
#### 特点
|
|
20
|
+
|
|
21
|
+
* UI分离,支持自定义UI框架。提供了antd的组件封装 @kne/react-form-antd 和 taro的组件封装 @kne/react-form-taro
|
|
22
|
+
* 分级校验规则配置,校验规则支持异步校验
|
|
23
|
+
* 事件驱动,方便灵活扩展。可以通过debug选项配置,通过触发事件顺序和参数轻松调试
|
|
24
|
+
* 支持包含Group的复杂表单,子表单
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### 示例
|
|
28
|
+
|
|
29
|
+
#### 示例代码
|
|
30
|
+
|
|
31
|
+
- 这里填写示例标题
|
|
32
|
+
- 这里填写示例说明
|
|
33
|
+
- reactFormAntd(@kne/react-form-antd),antd(antd)
|
|
34
|
+
|
|
35
|
+
```jsx
|
|
36
|
+
const {Button} = antd;
|
|
37
|
+
const {Form, Select, Input, Group, GroupList, SubmitButton, DatePickerToday} = reactFormAntd;
|
|
38
|
+
const {useRef} = React;
|
|
39
|
+
|
|
40
|
+
const Example = () => {
|
|
41
|
+
const addButton = useRef();
|
|
42
|
+
return <Form>
|
|
43
|
+
<Select name="select" label="哈哈哈" options={[{label: 'sss', value: 1}]}/>
|
|
44
|
+
<Input name="name" label="名称" realtime rule="REQ LEN-0-4"/>
|
|
45
|
+
<Input.Password name="password" label="密码"/>
|
|
46
|
+
<br/>
|
|
47
|
+
<Group name="target">
|
|
48
|
+
<Input name="name" label="名称"/>
|
|
49
|
+
<Input name="des" label="描述"/>
|
|
50
|
+
</Group>
|
|
51
|
+
<Group name="target">
|
|
52
|
+
<Input name="name" label="名称"/>
|
|
53
|
+
<Input name="des" label="描述"/>
|
|
54
|
+
</Group>
|
|
55
|
+
<br/>
|
|
56
|
+
<div>
|
|
57
|
+
<Button onClick={() => {
|
|
58
|
+
addButton.current.onAdd();
|
|
59
|
+
}}>添加</Button>
|
|
60
|
+
</div>
|
|
61
|
+
<GroupList name="list" ref={addButton}>
|
|
62
|
+
{(key, {onRemove}) => {
|
|
63
|
+
return <div>
|
|
64
|
+
<Button onClick={onRemove}>删除</Button>
|
|
65
|
+
<Input name="name" label="名称"/>
|
|
66
|
+
<Input name="des" label="描述"/>
|
|
67
|
+
</div>;
|
|
68
|
+
}}
|
|
69
|
+
</GroupList>
|
|
70
|
+
<DatePickerToday label="时间" name="time" selectToday={true}/>
|
|
71
|
+
<SubmitButton>提交</SubmitButton>
|
|
72
|
+
</Form>
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
render(<Example />);
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### API
|
|
81
|
+
|
|
82
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kne/react-form-antd",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"syntax": {
|
|
5
5
|
"esmodules": true
|
|
6
6
|
},
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"module": "dist/index.modern.js",
|
|
10
10
|
"source": "src/index.js",
|
|
11
11
|
"scripts": {
|
|
12
|
-
"init": "
|
|
12
|
+
"init-example": "modules-dev-libs-init",
|
|
13
13
|
"create-fields": "node ./scripts/createIndex.mjs",
|
|
14
14
|
"start": "run-p start:lib start:example",
|
|
15
15
|
"build": "run-s create-fields build:lib build:example",
|
|
@@ -74,7 +74,9 @@
|
|
|
74
74
|
"react-avatar-editor": "^13.0.0"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
+
"@craco/craco": "^7.1.0",
|
|
77
78
|
"@kne/microbundle": "^0.15.4",
|
|
79
|
+
"@kne/modules-dev": "^2.0.3",
|
|
78
80
|
"@kne/react-fetch": "^0.1.12",
|
|
79
81
|
"antd": "^5.0.2",
|
|
80
82
|
"axios": "^0.21.4",
|
|
@@ -83,13 +85,11 @@
|
|
|
83
85
|
"gh-pages": "^3.2.3",
|
|
84
86
|
"glob": "^10.3.3",
|
|
85
87
|
"husky": "^7.0.2",
|
|
86
|
-
"microbundle": "0.13.3",
|
|
87
88
|
"node-sass": "^9.0.0",
|
|
88
89
|
"npm-run-all": "^4.1.5",
|
|
89
90
|
"pify": "^5.0.0",
|
|
90
91
|
"prettier": "^2.4.1",
|
|
91
92
|
"react": "^18.2.0",
|
|
92
|
-
"react-dom": "^18.2.0"
|
|
93
|
-
"react-scripts": "^4.0.3"
|
|
93
|
+
"react-dom": "^18.2.0"
|
|
94
94
|
}
|
|
95
95
|
}
|