@hw-component/form 1.4.9 → 1.5.0
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/.eslintcache +1 -1
- package/es/Input/InputNumberGroup.d.ts +2 -2
- package/es/Input/InputNumberGroup.js +4 -4
- package/es/Upload/hooks/customRequest.js +11 -6
- package/lib/Input/InputNumberGroup.d.ts +2 -2
- package/lib/Input/InputNumberGroup.js +4 -4
- package/lib/Upload/hooks/customRequest.js +11 -6
- package/package.json +1 -1
- package/src/components/Form/HFormConnect.tsx +6 -7
- package/src/components/Form/config.ts +2 -3
- package/src/components/Form/hooks/useHForm.ts +10 -7
- package/src/components/Input/InputNumberGroup.tsx +141 -129
- package/src/components/Input/index.less +5 -5
- package/src/components/Select/components/AllSelect.tsx +13 -13
- package/src/components/Select/components/CheckBoxOption.tsx +3 -3
- package/src/components/Select/defaultConfig.tsx +4 -2
- package/src/components/Select/hooks/changeHooks.tsx +2 -2
- package/src/components/Switch/index.tsx +1 -1
- package/src/components/Upload/hooks/customRequest.ts +7 -3
- package/src/components/Upload/index.tsx +1 -1
- package/src/pages/Form/index.tsx +49 -42
- package/src/pages/ModalForm/index.tsx +11 -10
- package/src/pages/Select/index.tsx +1 -1
- package/src/pages/Upload/index.tsx +13 -1
package/src/pages/Form/index.tsx
CHANGED
|
@@ -1,21 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
HForm,
|
|
3
|
+
HFormConfigProvider,
|
|
4
|
+
HSwitch,
|
|
5
|
+
useHForm,
|
|
6
|
+
} from "../../components";
|
|
2
7
|
import { useState } from "react";
|
|
3
|
-
import {Button, DatePicker, Form, Input, Row} from "antd";
|
|
4
|
-
const Test2=()=>{
|
|
5
|
-
return <Row style={{background:"red"}}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
import { Button, DatePicker, Form, Input, Row } from "antd";
|
|
9
|
+
const Test2 = () => {
|
|
10
|
+
return <Row style={{ background: "red" }} />;
|
|
11
|
+
};
|
|
12
|
+
const Test3 = ({ value, onChange }) => {
|
|
13
|
+
return (
|
|
14
|
+
<Input
|
|
15
|
+
value={value.input}
|
|
16
|
+
style={{ width: 100 }}
|
|
17
|
+
onChange={(e) => {
|
|
18
|
+
onChange({
|
|
19
|
+
...value,
|
|
20
|
+
input: e.target.value,
|
|
21
|
+
});
|
|
22
|
+
}}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
19
26
|
const formData = (options) => {
|
|
20
27
|
const op = [
|
|
21
28
|
{
|
|
@@ -28,20 +35,20 @@ const formData = (options) => {
|
|
|
28
35
|
},
|
|
29
36
|
];
|
|
30
37
|
return [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
},
|
|
38
|
+
{
|
|
39
|
+
label: "12321",
|
|
40
|
+
className: "3",
|
|
41
|
+
name: "inputNumberGroup",
|
|
42
|
+
type: "inputNumberGroup",
|
|
43
|
+
itemProps: {
|
|
44
|
+
addonAfter: <Test3 />,
|
|
39
45
|
},
|
|
46
|
+
},
|
|
40
47
|
{
|
|
41
48
|
label: "测试12312",
|
|
42
49
|
className: "hdjd",
|
|
43
|
-
|
|
44
|
-
name:"test",
|
|
50
|
+
type: "colorInput",
|
|
51
|
+
name: "test",
|
|
45
52
|
},
|
|
46
53
|
];
|
|
47
54
|
};
|
|
@@ -93,18 +100,18 @@ export default () => {
|
|
|
93
100
|
form={form}
|
|
94
101
|
labelAlign={"right"}
|
|
95
102
|
onFinish={(value) => {
|
|
96
|
-
console.log(value,"fff");
|
|
103
|
+
console.log(value, "fff");
|
|
97
104
|
}}
|
|
98
105
|
onValuesChange={(val) => {
|
|
99
106
|
console.log(val, "onValuesChange");
|
|
100
107
|
}}
|
|
101
108
|
initialValues={{
|
|
102
109
|
file: "https://img0.baidu.com/it/u=530540642,263790536&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=667",
|
|
103
|
-
min:1,
|
|
104
|
-
max:2,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
110
|
+
min: 1,
|
|
111
|
+
max: 2,
|
|
112
|
+
inputNumberGroup: {
|
|
113
|
+
input: "xxxxxxx",
|
|
114
|
+
},
|
|
108
115
|
}}
|
|
109
116
|
request={(params) => {
|
|
110
117
|
return new Promise<any>((resolve) => {
|
|
@@ -117,19 +124,19 @@ export default () => {
|
|
|
117
124
|
</HFormConfigProvider>
|
|
118
125
|
<div
|
|
119
126
|
onClick={async () => {
|
|
120
|
-
|
|
121
|
-
|
|
127
|
+
const result = await form.validateFields();
|
|
128
|
+
console.log(result);
|
|
122
129
|
}}
|
|
123
130
|
>
|
|
124
131
|
点我
|
|
125
132
|
</div>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
<div
|
|
134
|
+
onClick={() => {
|
|
135
|
+
form.submit();
|
|
136
|
+
}}
|
|
137
|
+
>
|
|
138
|
+
提交
|
|
139
|
+
</div>
|
|
133
140
|
<div
|
|
134
141
|
onClick={() => {
|
|
135
142
|
form.resetFields();
|
|
@@ -2,14 +2,15 @@ import { Button } from "antd";
|
|
|
2
2
|
import {
|
|
3
3
|
HModalForm,
|
|
4
4
|
useHDialogForm,
|
|
5
|
-
HFormConfigProvider,
|
|
5
|
+
HFormConfigProvider,
|
|
6
|
+
HUrlUpload,
|
|
6
7
|
} from "../../components";
|
|
7
8
|
import { useState } from "react";
|
|
8
9
|
import { ShowParamsModal } from "@/components/DialogForm/modal";
|
|
9
10
|
|
|
10
|
-
const Test=(props)=>{
|
|
11
|
-
return <HUrlUpload {...props}
|
|
12
|
-
}
|
|
11
|
+
const Test = (props) => {
|
|
12
|
+
return <HUrlUpload {...props} />;
|
|
13
|
+
};
|
|
13
14
|
const data = [
|
|
14
15
|
{
|
|
15
16
|
label: "输入框",
|
|
@@ -109,9 +110,9 @@ const data = [
|
|
|
109
110
|
{
|
|
110
111
|
label: "地址文件",
|
|
111
112
|
name: "urlUpload",
|
|
112
|
-
render:()=>{
|
|
113
|
-
return <Test
|
|
114
|
-
}
|
|
113
|
+
render: () => {
|
|
114
|
+
return <Test />;
|
|
115
|
+
},
|
|
115
116
|
},
|
|
116
117
|
{
|
|
117
118
|
label: "下拉框",
|
|
@@ -154,9 +155,9 @@ export default () => {
|
|
|
154
155
|
params: {
|
|
155
156
|
name: num,
|
|
156
157
|
},
|
|
157
|
-
initialValues:{
|
|
158
|
-
urlUpload:"ffff"
|
|
159
|
-
}
|
|
158
|
+
initialValues: {
|
|
159
|
+
urlUpload: "ffff",
|
|
160
|
+
},
|
|
160
161
|
});
|
|
161
162
|
}}
|
|
162
163
|
>
|
|
@@ -14,7 +14,7 @@ export default () => {
|
|
|
14
14
|
<HSelect
|
|
15
15
|
fieldNames={{ label: "name", value: "value" }}
|
|
16
16
|
options={[
|
|
17
|
-
{ name: "测试1", value: 10, userId: 112321,disabled:true },
|
|
17
|
+
{ name: "测试1", value: 10, userId: 112321, disabled: true },
|
|
18
18
|
{ name: "测试2", value: 20, userId: 112321 },
|
|
19
19
|
]}
|
|
20
20
|
placeholder="多选"
|
|
@@ -6,9 +6,21 @@ import { MediaTypeEnum } from "../../components/Upload/enums";
|
|
|
6
6
|
export default () => {
|
|
7
7
|
const [files, setFiles] = useState([]);
|
|
8
8
|
const [files1, setFiles1] = useState([]);
|
|
9
|
+
console.log(files)
|
|
9
10
|
return (
|
|
10
11
|
<Space size={"large"} direction={"vertical"} style={{ width: "100%" }}>
|
|
11
|
-
<HUpload
|
|
12
|
+
<HUpload exFiles={null}
|
|
13
|
+
value={files}
|
|
14
|
+
request={()=>{
|
|
15
|
+
return {
|
|
16
|
+
url:"https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641",
|
|
17
|
+
thumbUrl:"https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641"
|
|
18
|
+
}
|
|
19
|
+
}}
|
|
20
|
+
onChange={setFiles}
|
|
21
|
+
multiple={true}
|
|
22
|
+
maxCount={3}
|
|
23
|
+
maxSize={Number.MAX_SAFE_INTEGER}/>
|
|
12
24
|
<HUrlUpload
|
|
13
25
|
value={files1}
|
|
14
26
|
mediaType={MediaTypeEnum.file}
|