@hw-component/form 1.9.34 → 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.
- package/es/Form/hooks/index.js +2 -2
- package/es/Form/hooks/useHForm.js +0 -19
- package/es/Form/modal.d.ts +0 -1
- package/lib/Form/hooks/index.js +2 -2
- package/lib/Form/hooks/useHForm.js +0 -19
- package/lib/Form/modal.d.ts +0 -1
- package/package.json +1 -1
- package/src/components/Form/hooks/index.ts +2 -2
- package/src/components/Form/hooks/useHForm.ts +0 -22
- package/src/components/Form/modal.ts +0 -1
package/es/Form/hooks/index.js
CHANGED
|
@@ -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.
|
|
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.
|
|
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(formatVal);
|
|
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) {
|
package/es/Form/modal.d.ts
CHANGED
|
@@ -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/lib/Form/hooks/index.js
CHANGED
|
@@ -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.
|
|
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.
|
|
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(formatVal);
|
|
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) {
|
package/lib/Form/modal.d.ts
CHANGED
|
@@ -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
|
@@ -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?.
|
|
64
|
+
form?.setFieldsValue(result);
|
|
65
65
|
return result || {};
|
|
66
66
|
}
|
|
67
67
|
if (typeof initialValues === "undefined") {
|
|
68
68
|
return {};
|
|
69
69
|
}
|
|
70
|
-
form?.
|
|
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,20 +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(formatVal);
|
|
180
|
-
form.setFieldsValue({
|
|
181
|
-
...clearData,
|
|
182
|
-
...newValue
|
|
183
|
-
});
|
|
184
|
-
},
|
|
185
163
|
validateFields(nameList) {
|
|
186
164
|
return new Promise((resolve, reject) => {
|
|
187
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 {
|