@mobx-ecosystem/mobx-form 2.8.1 → 2.9.0
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/dist/combined-form-service.d.ts +20 -0
- package/dist/form-service.d.ts +2 -2
- package/dist/types.d.ts +15 -0
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FormService } from "form-service";
|
|
2
|
+
import { IForm, ValidationType } from "types";
|
|
3
|
+
export declare class CombinedFormService implements IForm<any> {
|
|
4
|
+
formServices: FormService<any>[];
|
|
5
|
+
constructor();
|
|
6
|
+
setForms: (formServices: FormService<any>[]) => void;
|
|
7
|
+
get fields(): any[];
|
|
8
|
+
get keys(): string[];
|
|
9
|
+
get isValid(): boolean;
|
|
10
|
+
get isTouched(): boolean;
|
|
11
|
+
get canBeSubmitted(): boolean;
|
|
12
|
+
get disabled(): boolean;
|
|
13
|
+
validate: (type: ValidationType) => Promise<void>;
|
|
14
|
+
getValues: () => any[];
|
|
15
|
+
resetErrors: () => void;
|
|
16
|
+
setValuesAsInit: () => void;
|
|
17
|
+
reset: () => void;
|
|
18
|
+
disable: () => void;
|
|
19
|
+
enable: () => void;
|
|
20
|
+
}
|
package/dist/form-service.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FieldService } from './field-service';
|
|
2
|
-
import { FormErrors, FormValues, ValidationType } from './types';
|
|
2
|
+
import { FormErrors, FormValues, IForm, ValidationType } from './types';
|
|
3
3
|
import { CombinedFormFieldService } from './combined-form-field-service';
|
|
4
|
-
export declare class FormService<T extends Record<string, FieldService<any> | CombinedFormFieldService | Record<string, unknown>>> {
|
|
4
|
+
export declare class FormService<T extends Record<string, FieldService<any> | CombinedFormFieldService | Record<string, unknown>>> implements IForm<T> {
|
|
5
5
|
fields: T;
|
|
6
6
|
validationSchema?: unknown;
|
|
7
7
|
onSubmit?: () => Promise<unknown>;
|
package/dist/types.d.ts
CHANGED
|
@@ -17,6 +17,21 @@ export interface IField {
|
|
|
17
17
|
reset(): void;
|
|
18
18
|
setAsInit(): void;
|
|
19
19
|
}
|
|
20
|
+
export interface IForm<T> {
|
|
21
|
+
fields: T;
|
|
22
|
+
validate: (type: ValidationType) => Promise<void>;
|
|
23
|
+
keys: string[];
|
|
24
|
+
isValid: boolean;
|
|
25
|
+
isTouched: boolean;
|
|
26
|
+
canBeSubmitted: boolean;
|
|
27
|
+
disabled: boolean;
|
|
28
|
+
getValues: () => FormValues<T>;
|
|
29
|
+
resetErrors: () => void;
|
|
30
|
+
setValuesAsInit: () => void;
|
|
31
|
+
reset: () => void;
|
|
32
|
+
disable: () => void;
|
|
33
|
+
enable: () => void;
|
|
34
|
+
}
|
|
20
35
|
export type FormServiceValuesType = Record<string, FieldService<unknown> | Record<string, unknown>>;
|
|
21
36
|
export interface IFormable<T extends FormServiceValuesType = FormServiceValuesType> {
|
|
22
37
|
formService: FormService<T>;
|
package/package.json
CHANGED