@gustavo-valsechi/client 1.4.232 → 1.4.233
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.
|
@@ -81,9 +81,10 @@ function Form(props) {
|
|
|
81
81
|
}, [props.clearWhen, props.inputs]);
|
|
82
82
|
(0, import_react.useEffect)(() => {
|
|
83
83
|
const defaultValues = { ...props.defaultValues || {} };
|
|
84
|
+
const values = getValues();
|
|
84
85
|
if (!Object.keys(defaultValues).length) {
|
|
85
86
|
import_lodash.default.forEach(props.inputs, (data) => defaultValues[data.name] = "");
|
|
86
|
-
reset(defaultValues, { keepErrors: false });
|
|
87
|
+
reset({ ...defaultValues, ...values }, { keepErrors: false });
|
|
87
88
|
return;
|
|
88
89
|
}
|
|
89
90
|
import_lodash.default.forEach(defaultValues, (value, key) => {
|
|
@@ -97,7 +98,6 @@ function Form(props) {
|
|
|
97
98
|
}
|
|
98
99
|
defaultValues[key] = input.mask ? input.mask(value) : value;
|
|
99
100
|
});
|
|
100
|
-
const values = getValues();
|
|
101
101
|
reset({ ...defaultValues, ...values }, { keepErrors: false });
|
|
102
102
|
}, [props.defaultValues, props.inputs]);
|
|
103
103
|
const component = (data) => {
|
|
@@ -47,9 +47,10 @@ function Form(props) {
|
|
|
47
47
|
}, [props.clearWhen, props.inputs]);
|
|
48
48
|
useEffect(() => {
|
|
49
49
|
const defaultValues = { ...props.defaultValues || {} };
|
|
50
|
+
const values = getValues();
|
|
50
51
|
if (!Object.keys(defaultValues).length) {
|
|
51
52
|
_.forEach(props.inputs, (data) => defaultValues[data.name] = "");
|
|
52
|
-
reset(defaultValues, { keepErrors: false });
|
|
53
|
+
reset({ ...defaultValues, ...values }, { keepErrors: false });
|
|
53
54
|
return;
|
|
54
55
|
}
|
|
55
56
|
_.forEach(defaultValues, (value, key) => {
|
|
@@ -63,7 +64,6 @@ function Form(props) {
|
|
|
63
64
|
}
|
|
64
65
|
defaultValues[key] = input.mask ? input.mask(value) : value;
|
|
65
66
|
});
|
|
66
|
-
const values = getValues();
|
|
67
67
|
reset({ ...defaultValues, ...values }, { keepErrors: false });
|
|
68
68
|
}, [props.defaultValues, props.inputs]);
|
|
69
69
|
const component = (data) => {
|