mobx-react-hook-form 3.0.5 → 3.0.7
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,5 +1,5 @@
|
|
|
1
1
|
import { BaseSyntheticEvent } from 'react';
|
|
2
|
-
import { Control, createFormControl, DeepMap, DeepPartial, FieldErrors, FieldValues, FormState, UseFormClearErrors, UseFormRegister, UseFormReset, UseFormResetField, UseFormSetError, UseFormSetFocus, UseFormSetValue, UseFormTrigger, UseFormUnregister } from 'react-hook-form';
|
|
2
|
+
import { Control, createFormControl, DeepMap, DeepPartial, DefaultValues, FieldErrors, FieldValues, FormState, UseFormClearErrors, UseFormRegister, UseFormReset, UseFormResetField, UseFormSetError, UseFormSetFocus, UseFormSetValue, UseFormTrigger, UseFormUnregister } from 'react-hook-form';
|
|
3
3
|
import { MobxFormParams } from './mobx-form.types.js';
|
|
4
4
|
type FormFullState<TFieldValues extends FieldValues> = FormState<TFieldValues> & {
|
|
5
5
|
values: TFieldValues;
|
|
@@ -17,10 +17,10 @@ export declare class MobxForm<TFieldValues extends FieldValues = FieldValues, TC
|
|
|
17
17
|
disabled: boolean;
|
|
18
18
|
submitCount: number;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* If you want to change this property
|
|
21
|
+
* Use {resetForm} method
|
|
22
22
|
*/
|
|
23
|
-
defaultValues:
|
|
23
|
+
defaultValues: Readonly<DefaultValues<TFieldValues>>;
|
|
24
24
|
dirtyFields: Partial<Readonly<DeepMap<DeepPartial<TFieldValues>, boolean>>>;
|
|
25
25
|
touchedFields: Partial<Readonly<DeepMap<DeepPartial<TFieldValues>, boolean>>>;
|
|
26
26
|
validatingFields: Partial<Readonly<DeepMap<DeepPartial<TFieldValues>, boolean>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mobx-form.d.ts","sourceRoot":"","sources":["../../src/mobx-form/mobx-form.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EACL,OAAO,EACP,iBAAiB,EACjB,OAAO,EACP,WAAW,
|
|
1
|
+
{"version":3,"file":"mobx-form.d.ts","sourceRoot":"","sources":["../../src/mobx-form/mobx-form.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EACL,OAAO,EACP,iBAAiB,EACjB,OAAO,EACP,WAAW,EACX,aAAa,EACb,WAAW,EACX,WAAW,EACX,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,KAAK,aAAa,CAAC,YAAY,SAAS,WAAW,IACjD,SAAS,CAAC,YAAY,CAAC,GAAG;IACxB,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC;AAEJ,qBAAa,QAAQ,CACnB,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,QAAQ,GAAG,GAAG,EACd,kBAAkB,GAAG,YAAY,CACjC,YAAW,aAAa,CAAC,YAAY,CAAC;IAmRpC,OAAO,CAAC,MAAM;IAjRhB,MAAM,EAAG,YAAY,CAAC;IACtB,OAAO,EAAE,OAAO,CAAS;IACzB,SAAS,EAAE,OAAO,CAAS;IAC3B,WAAW,EAAE,OAAO,CAAS;IAC7B,kBAAkB,EAAE,OAAO,CAAS;IACpC,YAAY,EAAE,OAAO,CAAS;IAC9B,YAAY,EAAE,OAAO,CAAS;IAC9B,OAAO,EAAE,OAAO,CAAS;IACzB,QAAQ,EAAE,OAAO,CAAS;IAC1B,WAAW,EAAE,MAAM,CAAK;IACxB;;;OAGG;IACH,aAAa,EAAG,QAAQ,CAAC,aAAa,CAA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AExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,SAAS,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;IAEtC,SAAS,CAAC,eAAe,EAAE,eAAe,CAAC;IAE3C,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAExC;;OAEG;IACH,YAAY,EAAE,UAAU,CACtB,OAAO,iBAAiB,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CACrE,CAAC;gBAGQ,MAAM,EAAE,cAAc,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC;IA6F5E;;;;;;;OAOG;IACH,MAAM,CAAC,CAAC,CAAC,EAAE,kBAAkB;IAe7B;;;;;;;OAOG;IACH,KAAK,CAAC,CAAC,CAAC,EAAE,kBAAkB;IAK5B,OAAO,CAAC,eAAe;IA2CvB,OAAO,IAAI,IAAI;CAMhB"}
|
package/mobx-form/mobx-form.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
2
2
|
import { LinkedAbortController } from 'linked-abort-controller';
|
|
3
|
-
import { action, comparer, makeObservable, observable
|
|
3
|
+
import { action, comparer, makeObservable, observable } from 'mobx';
|
|
4
4
|
import { createFormControl, } from 'react-hook-form';
|
|
5
5
|
export class MobxForm {
|
|
6
6
|
config;
|
|
@@ -15,8 +15,8 @@ export class MobxForm {
|
|
|
15
15
|
disabled = false;
|
|
16
16
|
submitCount = 0;
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
* If you want to change this property
|
|
19
|
+
* Use {resetForm} method
|
|
20
20
|
*/
|
|
21
21
|
defaultValues;
|
|
22
22
|
dirtyFields = {};
|
|
@@ -327,11 +327,6 @@ export class MobxForm {
|
|
|
327
327
|
observable.ref(this, 'originalForm');
|
|
328
328
|
action.bound(this, 'submit');
|
|
329
329
|
action.bound(this, 'reset');
|
|
330
|
-
reaction(() => this.defaultValues, (newDefaultValues) => {
|
|
331
|
-
this.resetForm(newDefaultValues);
|
|
332
|
-
}, {
|
|
333
|
-
signal: this.abortController.signal,
|
|
334
|
-
});
|
|
335
330
|
makeObservable(this);
|
|
336
331
|
this.abortController.signal.addEventListener('abort', () => {
|
|
337
332
|
subscription();
|