@arquimedes.co/eureka-forms 1.9.133 → 1.9.134
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.
|
@@ -69,18 +69,17 @@ function ColumnForm(_a) {
|
|
|
69
69
|
var onSubmit = _a.onSubmit, formController = _a.formController, props = __rest(_a, ["onSubmit", "formController"]);
|
|
70
70
|
var form = props.form, formStyle = props.formStyle, customSubmit = props.customSubmit;
|
|
71
71
|
var _c = useState(false), loading = _c[0], setLoading = _c[1];
|
|
72
|
-
var getValues = formController.getValues, setValue = formController.setValue, clearErrors = formController.clearErrors, handleSubmit = formController.handleSubmit, control = formController.control, errors = formController.formState.errors, setFocus = formController.setFocus;
|
|
72
|
+
var getValues = formController.getValues, trigger = formController.trigger, setValue = formController.setValue, clearErrors = formController.clearErrors, handleSubmit = formController.handleSubmit, control = formController.control, errors = formController.formState.errors, setFocus = formController.setFocus;
|
|
73
73
|
var submit = handleSubmit(function (values) { return __awaiter(_this, void 0, void 0, function () {
|
|
74
|
-
var response;
|
|
75
74
|
return __generator(this, function (_a) {
|
|
76
75
|
switch (_a.label) {
|
|
77
76
|
case 0:
|
|
78
77
|
setLoading(true);
|
|
79
78
|
return [4 /*yield*/, onSubmit(values)];
|
|
80
79
|
case 1:
|
|
81
|
-
|
|
80
|
+
_a.sent();
|
|
82
81
|
setLoading(false);
|
|
83
|
-
return [2 /*return
|
|
82
|
+
return [2 /*return*/];
|
|
84
83
|
}
|
|
85
84
|
});
|
|
86
85
|
}); });
|
|
@@ -93,7 +92,28 @@ function ColumnForm(_a) {
|
|
|
93
92
|
: 'visible',
|
|
94
93
|
} }, { children: (_b = props.sendLabel) !== null && _b !== void 0 ? _b : 'Enviar' })), loading && (_jsx("div", __assign({ className: styles.loaderContainer }, { children: _jsx(Loader, { color: formStyle.primaryContrastColor, position: "unset" }) })))] })) }))), customSubmit &&
|
|
95
94
|
cloneElement(customSubmit, {
|
|
96
|
-
onSubmit:
|
|
95
|
+
onSubmit: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
96
|
+
var valid, values, response;
|
|
97
|
+
return __generator(this, function (_a) {
|
|
98
|
+
switch (_a.label) {
|
|
99
|
+
case 0:
|
|
100
|
+
setLoading(true);
|
|
101
|
+
return [4 /*yield*/, trigger()];
|
|
102
|
+
case 1:
|
|
103
|
+
valid = _a.sent();
|
|
104
|
+
if (!valid) return [3 /*break*/, 3];
|
|
105
|
+
values = getValues();
|
|
106
|
+
return [4 /*yield*/, onSubmit(values)];
|
|
107
|
+
case 2:
|
|
108
|
+
response = _a.sent();
|
|
109
|
+
setLoading(false);
|
|
110
|
+
return [2 /*return*/, response];
|
|
111
|
+
case 3:
|
|
112
|
+
setLoading(false);
|
|
113
|
+
return [2 /*return*/];
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}); },
|
|
97
117
|
loading: loading,
|
|
98
118
|
})] }))] })));
|
|
99
119
|
}
|
package/package.json
CHANGED