trithuc-mvc-react 2.1.1 → 2.2.1

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.
@@ -43,7 +43,7 @@ function FormField({
43
43
  disabled = false,
44
44
  ...rest
45
45
  }) {
46
- const { setValue, register } = useFormContext();
46
+ const { setValue, resetField, register, ...restForm } = useFormContext();
47
47
  const getValueObject = useCallback(
48
48
  (value) => {
49
49
  if (!value) return null;
@@ -125,7 +125,13 @@ function FormField({
125
125
  options={datas ?? []}
126
126
  onChange={(event, newValue) => {
127
127
  onFieldChange(newValue?.[keyValue]);
128
- onChange(newValue);
128
+ onChange(newValue, {
129
+ formMethods: {
130
+ setValue,
131
+ resetField,
132
+ ...restForm
133
+ }
134
+ });
129
135
  if (keyValueLabel) {
130
136
  setValue(keyValueLabel, newValue?.[keyLabel]);
131
137
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trithuc-mvc-react",
3
- "version": "2.1.1",
3
+ "version": "2.2.1",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"