mobx-react-hook-form 2.0.14 → 2.0.16
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/mobx-form/mobx-form.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeepPartial, FormState, SubmitErrorHandler, SubmitHandler, UseFormProps } from 'react-hook-form';
|
|
1
|
+
import { DeepPartial, FormState, SubmitErrorHandler, SubmitHandler, UseFormProps, createFormControl } from 'react-hook-form';
|
|
2
2
|
import type { AnyObject, Maybe } from 'yummies/utils/types';
|
|
3
3
|
import { MobxFormParams } from './mobx-form.types';
|
|
4
4
|
export declare class MobxForm<TFieldValues extends AnyObject, TContext = any, TFieldOutputValues extends AnyObject = TFieldValues> {
|
|
@@ -13,7 +13,7 @@ export declare class MobxForm<TFieldValues extends AnyObject, TContext = any, TF
|
|
|
13
13
|
/**
|
|
14
14
|
* Original react-hook-form form
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
instance: Maybe<ReturnType<typeof createFormControl<TFieldValues, TContext>>>;
|
|
17
17
|
/**
|
|
18
18
|
* form state received from form.formState
|
|
19
19
|
*/
|
|
@@ -28,6 +28,7 @@ export declare class MobxForm<TFieldValues extends AnyObject, TContext = any, TF
|
|
|
28
28
|
protected handleSubmit(...args: Parameters<SubmitHandler<TFieldOutputValues>>): void | Promise<void>;
|
|
29
29
|
protected handleSubmitFailed(...args: Parameters<SubmitErrorHandler<TFieldValues>>): void | Promise<void>;
|
|
30
30
|
protected syncForm(formState: Partial<FormState<TFieldValues>>, data?: DeepPartial<TFieldValues> | TFieldValues): void;
|
|
31
|
+
onReset: () => void;
|
|
31
32
|
/**
|
|
32
33
|
* Allows to modify real react-hook-form useForm() payload
|
|
33
34
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobx-form.d.ts","sourceRoot":"","sources":["../../src/mobx-form/mobx-form.ts"],"names":[],"mappings":"AAQA,OAAO,EACL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C,IAAI,CAAC;IAKvB,SAAS,CAAC,kBAAkB,CAE1B,GAAG,IAAI,EAAE,UAAU,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAC,GACpD,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAKvB,SAAS,CAAC,QAAQ,CAChB,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,EAC3C,IAAI,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,YAAY;IAUjD,OAAO,aAEL;IAEF;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC,YAAY,EAAE,QAAQ,CAAC;IAItD;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IAIlE,OAAO;IAIP;;OAEG;IACH,OAAO,IAAI,IAAI;CAGhB"}
|
package/mobx-form/mobx-form.js
CHANGED
|
@@ -71,7 +71,6 @@ export class MobxForm {
|
|
|
71
71
|
observable.ref(this, 'params');
|
|
72
72
|
observable.ref(this, 'instance');
|
|
73
73
|
action.bound(this, 'setParams');
|
|
74
|
-
action.bound(this, 'updateParams');
|
|
75
74
|
action.bound(this, 'syncForm');
|
|
76
75
|
this.instance = createFormControl(config);
|
|
77
76
|
this.onSubmit = this.instance?.handleSubmit(this.handleSubmit.bind(this), this.handleSubmitFailed.bind(this));
|
|
@@ -109,15 +108,15 @@ export class MobxForm {
|
|
|
109
108
|
}
|
|
110
109
|
syncForm(formState, data) {
|
|
111
110
|
runInAction(() => {
|
|
112
|
-
Object.
|
|
113
|
-
// @ts-expect-error kkkk
|
|
114
|
-
this.state[key] = formState[key];
|
|
115
|
-
});
|
|
111
|
+
Object.assign(this.state, formState);
|
|
116
112
|
if (this.data) {
|
|
117
113
|
this.data = data;
|
|
118
114
|
}
|
|
119
115
|
});
|
|
120
116
|
}
|
|
117
|
+
onReset = () => {
|
|
118
|
+
this.config.onReset?.();
|
|
119
|
+
};
|
|
121
120
|
/**
|
|
122
121
|
* Allows to modify real react-hook-form useForm() payload
|
|
123
122
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobx-react-hook-form",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.16",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "js2me",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/lodash-es": "4.17.12",
|
|
22
22
|
"eslint": "8.57.0",
|
|
23
|
-
"js2me-eslint-config": "1.0.
|
|
23
|
+
"js2me-eslint-config": "1.0.7",
|
|
24
24
|
"js2me-exports-post-build-script": "2.0.10",
|
|
25
25
|
"rimraf": "6.0.1",
|
|
26
26
|
"prettier": "3.3.3",
|