@hw-component/form 1.3.4 → 1.3.5

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.
Files changed (43) hide show
  1. package/.eslintcache +1 -1
  2. package/es/DialogForm/hooks.d.ts +5 -5
  3. package/es/Form/config.js +1 -1
  4. package/es/Form/hooks/useHForm.js +3 -0
  5. package/es/Form/modal.d.ts +1 -0
  6. package/es/Upload/UrlUpload/hooks.d.ts +1 -1
  7. package/es/Upload/hooks/change.d.ts +1 -1
  8. package/es/Upload/index.js +13 -10
  9. package/es/index.css +3 -3
  10. package/lib/DialogForm/hooks.d.ts +5 -5
  11. package/lib/Form/config.js +1 -1
  12. package/lib/Form/hooks/useHForm.js +3 -0
  13. package/lib/Form/modal.d.ts +1 -0
  14. package/lib/Upload/UrlUpload/hooks.d.ts +1 -1
  15. package/lib/Upload/hooks/change.d.ts +1 -1
  16. package/lib/Upload/index.js +13 -10
  17. package/lib/index.css +3 -3
  18. package/package.json +1 -1
  19. package/src/components/DialogForm/DrawerForm/index.tsx +1 -1
  20. package/src/components/DialogForm/hooks.ts +1 -1
  21. package/src/components/Form/FormItem/BasicItem.tsx +3 -3
  22. package/src/components/Form/FormItem/hooks.tsx +7 -4
  23. package/src/components/Form/HFormConnect.tsx +0 -1
  24. package/src/components/Form/Label.tsx +6 -10
  25. package/src/components/Form/config.ts +1 -1
  26. package/src/components/Form/hooks/useHForm.ts +4 -1
  27. package/src/components/Form/index.less +7 -7
  28. package/src/components/Form/modal.ts +6 -4
  29. package/src/components/Input/ButtonInput.tsx +7 -2
  30. package/src/components/Input/VerificationCodeInput/hooks.ts +32 -33
  31. package/src/components/Input/VerificationCodeInput/index.tsx +83 -81
  32. package/src/components/Select/index.tsx +2 -2
  33. package/src/components/Upload/UrlUpload/hooks.ts +15 -12
  34. package/src/components/Upload/UrlUpload/index.tsx +18 -11
  35. package/src/components/Upload/hooks/change.ts +7 -7
  36. package/src/components/Upload/hooks/propsMaker.ts +2 -2
  37. package/src/components/Upload/index.tsx +21 -14
  38. package/src/components/Upload/modal.ts +2 -2
  39. package/src/components/Upload/util.ts +6 -3
  40. package/src/pages/DrawerForm/index.tsx +27 -94
  41. package/src/pages/Form/index.tsx +185 -185
  42. package/src/pages/ModalForm/index.tsx +1 -1
  43. package/src/pages/Select/index.tsx +1 -1
@@ -3,197 +3,197 @@ import { useState } from "react";
3
3
  import { Button, DatePicker, Form, Input } from "antd";
4
4
 
5
5
  const formData = (options) => {
6
- const op = [
7
- {
8
- key: 1,
9
- value: "是",
6
+ const op = [
7
+ {
8
+ key: 1,
9
+ value: "是",
10
+ },
11
+ {
12
+ key: 0,
13
+ value: "否",
14
+ },
15
+ ];
16
+ return [
17
+ {
18
+ label: "测试",
19
+ className: "hdjd",
20
+ },
21
+ {
22
+ label: "测试1",
23
+ type: "select",
24
+ },
25
+ {
26
+ label: "测试1",
27
+ type: "inputNumber",
28
+ },
29
+ {
30
+ noStyle: true,
31
+ render: () => {
32
+ return <div>你好a</div>;
33
+ },
34
+ },
35
+ {
36
+ label: "时间",
37
+ type: "rangePicker",
38
+ name: "rangePicker",
39
+ itemProps: {
40
+ subProvider: () => {
41
+ return {
42
+ hdj: "fff",
43
+ };
10
44
  },
11
- {
12
- key: 0,
13
- value: "否",
45
+ },
46
+ },
47
+ {
48
+ label: "选择",
49
+ name: "checkboxGroup",
50
+ type: "checkboxGroup",
51
+ rules: [{ required: true }],
52
+ helper: "帮助我",
53
+ options: [
54
+ { value: "选择1", key: "check1" },
55
+ { value: "选择2", key: "check2" },
56
+ ],
57
+ direction: "vertical",
58
+ labelAlign: "topLeft",
59
+ },
60
+ {
61
+ label: "file",
62
+ name: "file",
63
+ type: "upload",
64
+ direction: "vertical",
65
+ labelAlign: "topLeft",
66
+ },
67
+ {
68
+ label: "开关",
69
+ name: "switch",
70
+ type: "switch",
71
+ rules: [{ required: true }],
72
+ itemProps: {
73
+ valueMap: {
74
+ open: 1,
75
+ close: 0,
14
76
  },
15
- ];
16
- return [
17
- {
18
- label: "测试",
19
- className: "hdjd",
20
- },
21
- {
22
- label: "测试1",
23
- type: "select",
24
- },
25
- {
26
- label: "测试1",
27
- type: "inputNumber",
28
- },
29
- {
30
- noStyle: true,
31
- render: () => {
32
- return <div>你好a</div>;
33
- },
34
- },
35
- {
36
- label: "时间",
37
- type: "rangePicker",
38
- name: "rangePicker",
39
- itemProps: {
40
- subProvider: () => {
41
- return {
42
- hdj:"fff"
43
- }
44
- },
45
- },
46
- },
47
- {
48
- label: "选择",
49
- name: "checkboxGroup",
50
- type: "checkboxGroup",
51
- rules: [{ required: true }],
52
- helper: "帮助我",
53
- options: [
54
- { value: "选择1", key: "check1" },
55
- { value: "选择2", key: "check2" },
56
- ],
57
- direction: "vertical",
58
- labelAlign: "topLeft",
59
- },
60
- {
61
- label: "file",
62
- name: "file",
63
- type: "upload",
64
- direction: "vertical",
65
- labelAlign: "topLeft",
66
- },
67
- {
68
- label: "开关",
69
- name: "switch",
70
- type: "switch",
71
- rules: [{ required: true }],
72
- itemProps: {
73
- valueMap: {
74
- open: 1,
75
- close: 0,
76
- },
77
- },
78
- },
79
- {
80
- type: "submit",
81
- itemProps: {
82
- extraList: [
83
- <Button
84
- key="wh"
85
- onClick={() => {
86
- console.log("起飞");
87
- }}
88
- >
89
- 芜湖
90
- </Button>,
91
- "666",
92
- "reset",
93
- ],
94
- },
95
- },
96
- {
97
- type: "submit",
98
- itemProps: {
99
- extraList: [
100
- <Button
101
- key="wh"
102
- onClick={() => {
103
- console.log("起飞");
104
- }}
105
- >
106
- 芜湖
107
- </Button>,
108
- <Ttta key="aa" />,
109
- "666",
110
- "submit",
111
- "reset",
112
- ],
113
- },
114
- },
115
- ];
116
- };
117
- function Ttta({ form }) {
118
- return (
119
- <div
77
+ },
78
+ },
79
+ {
80
+ type: "submit",
81
+ itemProps: {
82
+ extraList: [
83
+ <Button
84
+ key="wh"
85
+ onClick={() => {
86
+ console.log("起飞");
87
+ }}
88
+ >
89
+ 芜湖
90
+ </Button>,
91
+ "666",
92
+ "reset",
93
+ ],
94
+ },
95
+ },
96
+ {
97
+ type: "submit",
98
+ itemProps: {
99
+ extraList: [
100
+ <Button
101
+ key="wh"
120
102
  onClick={() => {
121
- console.log("form", form);
122
- form.setFieldsValue({ switch: 1 });
103
+ console.log("起飞");
123
104
  }}
124
- >
125
- ttta
126
- </div>
127
- );
105
+ >
106
+ 芜湖
107
+ </Button>,
108
+ <Ttta key="aa" />,
109
+ "666",
110
+ "submit",
111
+ "reset",
112
+ ],
113
+ },
114
+ },
115
+ ];
116
+ };
117
+ function Ttta({ form }) {
118
+ return (
119
+ <div
120
+ onClick={() => {
121
+ console.log("form", form);
122
+ form.setFieldsValue({ switch: 1 });
123
+ }}
124
+ >
125
+ ttta
126
+ </div>
127
+ );
128
128
  }
129
129
 
130
130
  const Test = (props) => {
131
- return <div>ffff</div>;
131
+ return <div>ffff</div>;
132
132
  };
133
133
  export default () => {
134
- const form = useHForm();
135
- const [options, setOptions] = useState([{ label: "1", value: 1 }]);
136
- const [aForm] = Form.useForm();
137
- return (
138
- <div style={{ overflow: "auto", height: "90vh" }}>
139
- <Form form={aForm} initialValues={{ ttim: "132123" }}>
140
- <Form.Item name="ttim" rules={[{ required: true }]}>
141
- <Input />
142
- </Form.Item>
143
- </Form>
144
- <HFormConfigProvider
145
- valueSwitchMap={{ open: 1, close: 2 }}
146
- valueCheckMap={{ noChecked: 0, checked: 1 }}
147
- defaultComponent={{
148
- test: Test,
149
- }}
150
- itemProps={{
151
- style: {
152
- borderRadius: 10,
153
- },
154
- }}
155
- fieldNames={{
156
- label: "value",
157
- value: "key",
158
- }}
159
- >
160
- <HForm
161
- configData={formData(options)}
162
- labelWidth={200}
163
- form={form}
164
- labelAlign={"right"}
165
- onFinish={(value) => {
166
- console.log(value);
167
- }}
168
- onValuesChange={(val) => {
169
- console.log(val, "onValuesChange");
170
- }}
171
- initialValues={{
172
- file:"fff"
173
- }}
174
- request={(params) => {
175
- return new Promise<any>((resolve) => {
176
- setTimeout(() => {
177
- resolve(params);
178
- }, 3000);
179
- });
180
- }}
181
- />
182
- </HFormConfigProvider>
183
- <div
184
- onClick={() => {
185
- aForm.resetFields();
186
- }}
187
- >
188
- 点我
189
- </div>
190
- <div
191
- onClick={() => {
192
- form.resetFieldsInitValue();
193
- }}
194
- >
195
- 重置
196
- </div>
197
- </div>
198
- );
199
- };
134
+ const form = useHForm();
135
+ const [options, setOptions] = useState([{ label: "1", value: 1 }]);
136
+ const [aForm] = Form.useForm();
137
+ return (
138
+ <div style={{ overflow: "auto", height: "90vh" }}>
139
+ <Form form={aForm} initialValues={{ ttim: "132123" }}>
140
+ <Form.Item name="ttim" rules={[{ required: true }]}>
141
+ <Input />
142
+ </Form.Item>
143
+ </Form>
144
+ <HFormConfigProvider
145
+ valueSwitchMap={{ open: 1, close: 2 }}
146
+ valueCheckMap={{ noChecked: 0, checked: 1 }}
147
+ defaultComponent={{
148
+ test: Test,
149
+ }}
150
+ itemProps={{
151
+ style: {
152
+ borderRadius: 10,
153
+ },
154
+ }}
155
+ fieldNames={{
156
+ label: "value",
157
+ value: "key",
158
+ }}
159
+ >
160
+ <HForm
161
+ configData={formData(options)}
162
+ labelWidth={200}
163
+ form={form}
164
+ labelAlign={"right"}
165
+ onFinish={(value) => {
166
+ console.log(value);
167
+ }}
168
+ onValuesChange={(val) => {
169
+ console.log(val, "onValuesChange");
170
+ }}
171
+ initialValues={{
172
+ file: "fff",
173
+ }}
174
+ request={(params) => {
175
+ return new Promise<any>((resolve) => {
176
+ setTimeout(() => {
177
+ resolve(params);
178
+ }, 3000);
179
+ });
180
+ }}
181
+ />
182
+ </HFormConfigProvider>
183
+ <div
184
+ onClick={() => {
185
+ aForm.resetFields();
186
+ }}
187
+ >
188
+ 点我
189
+ </div>
190
+ <div
191
+ onClick={() => {
192
+ form.resetFieldsInitValue();
193
+ }}
194
+ >
195
+ 重置
196
+ </div>
197
+ </div>
198
+ );
199
+ };
@@ -10,7 +10,7 @@ const data = [
10
10
  {
11
11
  label: "输入框",
12
12
  name: "name",
13
- hideLabel:true,
13
+ hideLabel: true,
14
14
  rules: [
15
15
  () => {
16
16
  return {
@@ -20,7 +20,7 @@ export default () => {
20
20
  placeholder="多选"
21
21
  value={selectVal}
22
22
  onChange={(val, option) => {
23
- console.log(option)
23
+ console.log(option);
24
24
  setSelectVal(val);
25
25
  }}
26
26
  allSelect={true}