@hw-component/form 1.9.35 → 1.9.36

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.
@@ -91,7 +91,7 @@ var useInfoReq = function useInfoReq(_ref) {
91
91
  return initReq(reqParams);
92
92
  case 5:
93
93
  result = _context2.sent;
94
- form === null || form === void 0 || form.setFieldsValueFull(result);
94
+ form === null || form === void 0 || form.setFieldsValue(result);
95
95
  return _context2.abrupt("return", result || {});
96
96
  case 8:
97
97
  if (!(typeof initialValues === "undefined")) {
@@ -100,7 +100,7 @@ var useInfoReq = function useInfoReq(_ref) {
100
100
  }
101
101
  return _context2.abrupt("return", {});
102
102
  case 10:
103
- form === null || form === void 0 || form.setFieldsValueFull(initialValues);
103
+ form === null || form === void 0 || form.setFieldsValue(initialValues);
104
104
  return _context2.abrupt("return", initialValues);
105
105
  case 12:
106
106
  case "end":
@@ -33,14 +33,6 @@ var useHForm = (function () {
33
33
  defaultFn: []
34
34
  };
35
35
  };
36
- var clearObj = function clearObj(val) {
37
- var newVal = _objectSpread({}, val);
38
- var keys = Object.keys(val);
39
- keys.forEach(function (key) {
40
- newVal[key] = undefined;
41
- });
42
- return newVal;
43
- };
44
36
  var formatValuesFn = function formatValuesFn() {
45
37
  var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
46
38
  var formatKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "inputValue";
@@ -185,17 +177,6 @@ var useHForm = (function () {
185
177
  var newValue = formatValuesFn(values);
186
178
  form.setFieldsValue(newValue);
187
179
  },
188
- setFieldsValueFull: function setFieldsValueFull(values) {
189
- if (!isLoading) {
190
- cacheValues = values;
191
- return;
192
- }
193
- var oldFormVal = form.getFieldsValue(true);
194
- var formatVal = formatValuesFn(oldFormVal, "outputValue");
195
- var newValue = formatValuesFn(values);
196
- var clearData = clearObj(_objectSpread(_objectSpread({}, formatVal), oldFormVal));
197
- form.setFieldsValue(_objectSpread(_objectSpread({}, clearData), newValue));
198
- },
199
180
  validateFields: function validateFields(nameList) {
200
181
  return new Promise(function (resolve, reject) {
201
182
  form.validateFields(nameList).then(function (value) {
@@ -141,7 +141,6 @@ export interface HFormInstance extends FormInstance {
141
141
  clear: VoidFunction;
142
142
  resetFieldsInitValue: VoidFunction;
143
143
  clearFormat: (name: string) => void;
144
- setFieldsValueFull: (values: Record<string, any>) => void;
145
144
  }
146
145
  export interface ConnectConfigModal {
147
146
  format?: Record<string, addFormatItemModal>;
@@ -92,7 +92,7 @@ var useInfoReq = function useInfoReq(_ref) {
92
92
  return initReq(reqParams);
93
93
  case 5:
94
94
  result = _context2.sent;
95
- form === null || form === void 0 || form.setFieldsValueFull(result);
95
+ form === null || form === void 0 || form.setFieldsValue(result);
96
96
  return _context2.abrupt("return", result || {});
97
97
  case 8:
98
98
  if (!(typeof initialValues === "undefined")) {
@@ -101,7 +101,7 @@ var useInfoReq = function useInfoReq(_ref) {
101
101
  }
102
102
  return _context2.abrupt("return", {});
103
103
  case 10:
104
- form === null || form === void 0 || form.setFieldsValueFull(initialValues);
104
+ form === null || form === void 0 || form.setFieldsValue(initialValues);
105
105
  return _context2.abrupt("return", initialValues);
106
106
  case 12:
107
107
  case "end":
@@ -36,14 +36,6 @@ var useHForm = (function () {
36
36
  defaultFn: []
37
37
  };
38
38
  };
39
- var clearObj = function clearObj(val) {
40
- var newVal = _objectSpread({}, val);
41
- var keys = Object.keys(val);
42
- keys.forEach(function (key) {
43
- newVal[key] = undefined;
44
- });
45
- return newVal;
46
- };
47
39
  var formatValuesFn = function formatValuesFn() {
48
40
  var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
49
41
  var formatKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "inputValue";
@@ -188,17 +180,6 @@ var useHForm = (function () {
188
180
  var newValue = formatValuesFn(values);
189
181
  form.setFieldsValue(newValue);
190
182
  },
191
- setFieldsValueFull: function setFieldsValueFull(values) {
192
- if (!isLoading) {
193
- cacheValues = values;
194
- return;
195
- }
196
- var oldFormVal = form.getFieldsValue(true);
197
- var formatVal = formatValuesFn(oldFormVal, "outputValue");
198
- var newValue = formatValuesFn(values);
199
- var clearData = clearObj(_objectSpread(_objectSpread({}, formatVal), oldFormVal));
200
- form.setFieldsValue(_objectSpread(_objectSpread({}, clearData), newValue));
201
- },
202
183
  validateFields: function validateFields(nameList) {
203
184
  return new Promise(function (resolve, reject) {
204
185
  form.validateFields(nameList).then(function (value) {
@@ -141,7 +141,6 @@ export interface HFormInstance extends FormInstance {
141
141
  clear: VoidFunction;
142
142
  resetFieldsInitValue: VoidFunction;
143
143
  clearFormat: (name: string) => void;
144
- setFieldsValueFull: (values: Record<string, any>) => void;
145
144
  }
146
145
  export interface ConnectConfigModal {
147
146
  format?: Record<string, addFormatItemModal>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hw-component/form",
3
- "version": "1.9.35",
3
+ "version": "1.9.36",
4
4
  "description": "基于antd二次开发",
5
5
  "repository": {
6
6
  "type": "git",
@@ -61,13 +61,13 @@ export const useInfoReq = ({
61
61
  reqData.params = reqParams;
62
62
  if (initReq) {
63
63
  const result = await initReq(reqParams);
64
- form?.setFieldsValueFull(result);
64
+ form?.setFieldsValue(result);
65
65
  return result || {};
66
66
  }
67
67
  if (typeof initialValues === "undefined") {
68
68
  return {};
69
69
  }
70
- form?.setFieldsValueFull(initialValues);
70
+ form?.setFieldsValue(initialValues);
71
71
  return initialValues;
72
72
  },options);
73
73
  const { run, mutate } = infoControl;
@@ -34,14 +34,6 @@ export default () => {
34
34
  defaultFn: [],
35
35
  };
36
36
  };
37
- const clearObj=(val)=>{
38
- const newVal={...val};
39
- const keys=Object.keys(val);
40
- keys.forEach((key)=>{
41
- newVal[key]=undefined;
42
- });
43
- return newVal;
44
- }
45
37
  const formatValuesFn = (value = {}, formatKey = "inputValue") => {
46
38
  const valKeys = Object.keys(value).length;
47
39
  if (!valKeys) {
@@ -168,23 +160,6 @@ export default () => {
168
160
  const newValue = formatValuesFn(values);
169
161
  form.setFieldsValue(newValue);
170
162
  },
171
- setFieldsValueFull(values){
172
- if (!isLoading) {
173
- cacheValues = values;
174
- return;
175
- }
176
- const oldFormVal=form.getFieldsValue(true);
177
- const formatVal=formatValuesFn(oldFormVal, "outputValue")
178
- const newValue = formatValuesFn(values);
179
- const clearData=clearObj({
180
- ...formatVal,
181
- ...oldFormVal
182
- });
183
- form.setFieldsValue({
184
- ...clearData,
185
- ...newValue
186
- });
187
- },
188
163
  validateFields(nameList) {
189
164
  return new Promise((resolve, reject) => {
190
165
  form
@@ -199,7 +199,6 @@ export interface HFormInstance extends FormInstance {
199
199
  clear: VoidFunction;
200
200
  resetFieldsInitValue: VoidFunction;
201
201
  clearFormat: (name: string) => void;
202
- setFieldsValueFull:(values: Record<string, any>)=>void;
203
202
  }
204
203
 
205
204
  export interface ConnectConfigModal {