@hw-component/form 0.0.6-beta-v3 → 0.0.6-beta-v4

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.
@@ -66,7 +66,8 @@ var useModifyProps = function useModifyProps(_ref) {
66
66
  dialogForm.show = function () {
67
67
  var showParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
68
68
  var changeConfigData = showParams.configData,
69
- changeInitialValues = showParams.initialValues,
69
+ _showParams$initialVa = showParams.initialValues,
70
+ changeInitialValues = _showParams$initialVa === void 0 ? {} : _showParams$initialVa,
70
71
  _showParams$params = showParams.params,
71
72
  changeParams = _showParams$params === void 0 ? {} : _showParams$params,
72
73
  changeTitle = showParams.title;
@@ -72,23 +72,24 @@ var useInfoReq = function useInfoReq(_ref) {
72
72
  setValue = initialValues;
73
73
  reqData.params = reqParams;
74
74
  if (!(!initialValues && !infoRequest)) {
75
- _context2.next = 5;
75
+ _context2.next = 6;
76
76
  break;
77
77
  }
78
+ form === null || form === void 0 || form.setFieldsValue({});
78
79
  return _context2.abrupt("return", {});
79
- case 5:
80
+ case 6:
80
81
  if (!infoRequest) {
81
- _context2.next = 9;
82
+ _context2.next = 10;
82
83
  break;
83
84
  }
84
- _context2.next = 8;
85
+ _context2.next = 9;
85
86
  return infoRequest(reqParams);
86
- case 8:
87
- setValue = _context2.sent;
88
87
  case 9:
88
+ setValue = _context2.sent;
89
+ case 10:
89
90
  form === null || form === void 0 || form.setFieldsValue(setValue);
90
91
  return _context2.abrupt("return", setValue || {});
91
- case 11:
92
+ case 12:
92
93
  case "end":
93
94
  return _context2.stop();
94
95
  }
@@ -184,6 +184,10 @@ var useHForm = (function () {
184
184
  return resolve(result);
185
185
  });
186
186
  });
187
+ },
188
+ resetFields: function resetFields() {
189
+ form.resetFields();
190
+ isLoading = false;
187
191
  }
188
192
  });
189
193
  }, []);
@@ -67,7 +67,8 @@ var useModifyProps = function useModifyProps(_ref) {
67
67
  dialogForm.show = function () {
68
68
  var showParams = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
69
69
  var changeConfigData = showParams.configData,
70
- changeInitialValues = showParams.initialValues,
70
+ _showParams$initialVa = showParams.initialValues,
71
+ changeInitialValues = _showParams$initialVa === void 0 ? {} : _showParams$initialVa,
71
72
  _showParams$params = showParams.params,
72
73
  changeParams = _showParams$params === void 0 ? {} : _showParams$params,
73
74
  changeTitle = showParams.title;
@@ -73,23 +73,24 @@ var useInfoReq = function useInfoReq(_ref) {
73
73
  setValue = initialValues;
74
74
  reqData.params = reqParams;
75
75
  if (!(!initialValues && !infoRequest)) {
76
- _context2.next = 5;
76
+ _context2.next = 6;
77
77
  break;
78
78
  }
79
+ form === null || form === void 0 || form.setFieldsValue({});
79
80
  return _context2.abrupt("return", {});
80
- case 5:
81
+ case 6:
81
82
  if (!infoRequest) {
82
- _context2.next = 9;
83
+ _context2.next = 10;
83
84
  break;
84
85
  }
85
- _context2.next = 8;
86
+ _context2.next = 9;
86
87
  return infoRequest(reqParams);
87
- case 8:
88
- setValue = _context2.sent;
89
88
  case 9:
89
+ setValue = _context2.sent;
90
+ case 10:
90
91
  form === null || form === void 0 || form.setFieldsValue(setValue);
91
92
  return _context2.abrupt("return", setValue || {});
92
- case 11:
93
+ case 12:
93
94
  case "end":
94
95
  return _context2.stop();
95
96
  }
@@ -187,6 +187,10 @@ var useHForm = (function () {
187
187
  return resolve(result);
188
188
  });
189
189
  });
190
+ },
191
+ resetFields: function resetFields() {
192
+ form.resetFields();
193
+ isLoading = false;
190
194
  }
191
195
  });
192
196
  }, []);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "0.0.6-beta-v3",
3
+ "version": "0.0.6-beta-v4",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -45,7 +45,7 @@ export const useModifyProps = ({
45
45
  dialogForm.show = (showParams = {}) => {
46
46
  const {
47
47
  configData: changeConfigData,
48
- initialValues: changeInitialValues,
48
+ initialValues: changeInitialValues={},
49
49
  params: changeParams={},
50
50
  title: changeTitle,
51
51
  } = showParams;
@@ -47,6 +47,7 @@ export const useInfoReq = ({
47
47
  let setValue = initialValues;
48
48
  reqData.params = reqParams;
49
49
  if (!initialValues && !infoRequest) {
50
+ form?.setFieldsValue({});
50
51
  return {};
51
52
  }
52
53
  if (infoRequest) {
@@ -159,6 +159,10 @@ export default () => {
159
159
  });
160
160
  });
161
161
  },
162
+ resetFields:()=>{
163
+ form.resetFields();
164
+ isLoading=false;
165
+ }
162
166
  };
163
167
  }, []);
164
168
  };
@@ -114,12 +114,20 @@ export default () => {
114
114
  });
115
115
  }}
116
116
  >
117
- 打开
117
+ 显示
118
+ </Button>
119
+ <Button
120
+ onClick={() => {
121
+ modalForm.show();
122
+ }}
123
+ >
124
+ 打开
118
125
  </Button>
119
126
  <HDrawerForm
127
+
120
128
  configData={data}
121
129
  labelWidth={88}
122
- modalForm={modalForm}
130
+ dialogForm={modalForm}
123
131
  title="测试"
124
132
  />
125
133
  </>
@@ -150,7 +150,9 @@ export default () => {
150
150
  configData={formData(options)}
151
151
  labelWidth={200}
152
152
  form={form}
153
- initialValues={{}}
153
+ initialValues={{
154
+ name:'fff'
155
+ }}
154
156
  onFinish={(value) => {
155
157
  console.log(value);
156
158
  }}
@@ -182,22 +184,18 @@ export default () => {
182
184
  </HFormConfigProvider>
183
185
  <div
184
186
  onClick={() => {
185
- form.dispatch(
186
- {
187
- name: "select",
188
- key: "reload",
189
- },
190
- {
191
- params: {
192
- label: "更新",
193
- value: 2,
194
- },
195
- }
196
- );
187
+ form.setFieldsValue({name:"123"})
197
188
  }}
198
189
  >
199
190
  点我
200
191
  </div>
192
+ <div
193
+ onClick={() => {
194
+ form.resetFields();
195
+ }}
196
+ >
197
+ 重置
198
+ </div>
201
199
  </div>
202
200
  );
203
201
  };
@@ -107,7 +107,6 @@ const data = [
107
107
  },
108
108
  itemProps: {
109
109
  request: (params = {}, values) => {
110
- console.log(values, "paramsparamsparams");
111
110
  const { label = "123", value = 1 } = params;
112
111
  return Promise.resolve([{ label, value }]);
113
112
  },
@@ -133,6 +132,20 @@ export default () => {
133
132
  >
134
133
  打开
135
134
  </Button>
135
+ <Button
136
+ onClick={() => {
137
+ modalForm.show({
138
+ params: {
139
+ name: num,
140
+ },
141
+ initialValues:{
142
+ name:"name"
143
+ }
144
+ });
145
+ }}
146
+ >
147
+ 宣誓
148
+ </Button>
136
149
  <HModalForm
137
150
  configData={data}
138
151
  labelWidth={88}