@mobx-ecosystem/mobx-form 2.4.13 → 2.4.15
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/field-service.d.ts +6 -8
- package/dist/form-service.d.ts +1 -1
- package/dist/types.d.ts +3 -3
- package/package.json +1 -1
package/dist/field-service.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { IField } from './types';
|
|
1
|
+
import { IField, ValueType } from './types';
|
|
2
2
|
import { Emitter } from 'mitt';
|
|
3
3
|
type FieldOptionsType = {
|
|
4
4
|
onError?: boolean;
|
|
5
5
|
};
|
|
6
|
-
|
|
7
|
-
type ValueType<T> = Nullable<T> | undefined;
|
|
8
|
-
export declare class FieldService<T> implements IField {
|
|
6
|
+
export declare class FieldService<T = ValueType<unknown>> implements IField {
|
|
9
7
|
eventBus?: Emitter<{
|
|
10
8
|
ON_CHANGE: ValueType<T>;
|
|
11
9
|
}>;
|
|
@@ -16,9 +14,9 @@ export declare class FieldService<T> implements IField {
|
|
|
16
14
|
private _error?;
|
|
17
15
|
private _disabled;
|
|
18
16
|
options?: FieldOptionsType;
|
|
19
|
-
constructor(initValue?: T
|
|
20
|
-
get initValue():
|
|
21
|
-
set initValue(initValue:
|
|
17
|
+
constructor(initValue?: ValueType<T>, options?: FieldOptionsType);
|
|
18
|
+
get initValue(): ValueType<T>;
|
|
19
|
+
set initValue(initValue: ValueType<T>);
|
|
22
20
|
get value(): ValueType<T>;
|
|
23
21
|
set value(value: ValueType<T>);
|
|
24
22
|
get error(): string | undefined;
|
|
@@ -28,7 +26,7 @@ export declare class FieldService<T> implements IField {
|
|
|
28
26
|
get isValid(): boolean;
|
|
29
27
|
get isInit(): boolean;
|
|
30
28
|
createListener: () => void;
|
|
31
|
-
onChange: (_: any, value: T) => void;
|
|
29
|
+
onChange: (_: any, value: ValueType<T>) => void;
|
|
32
30
|
reset: () => void;
|
|
33
31
|
get props(): any;
|
|
34
32
|
}
|
package/dist/form-service.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FieldService } from './field-service';
|
|
2
2
|
import { FormErrors, FormValues } from './types';
|
|
3
3
|
import { CombinedFormFieldService } from './combined-form-field-service';
|
|
4
|
-
export declare class FormService<T extends Record<string, FieldService<
|
|
4
|
+
export declare class FormService<T extends Record<string, FieldService<any> | CombinedFormFieldService | Record<string, unknown>>> {
|
|
5
5
|
fields: T;
|
|
6
6
|
validationSchema?: unknown;
|
|
7
7
|
constructor(fields: T, validationSchema?: unknown);
|
package/dist/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FormService } from "form-service";
|
|
2
2
|
import { FieldService } from "./field-service";
|
|
3
|
-
|
|
4
|
-
export type FormValues<Type> = Type extends
|
|
3
|
+
export type ValueType<T> = T | null | undefined;
|
|
4
|
+
export type FormValues<Type> = Type extends IField ? Type['value'] : {
|
|
5
5
|
-readonly [Property in keyof Type]: FormValues<Type[Property]>;
|
|
6
6
|
};
|
|
7
|
-
export type FormErrors<Type> = Type extends
|
|
7
|
+
export type FormErrors<Type> = Type extends IField ? Type['error'] : {
|
|
8
8
|
-readonly [Property in keyof Type]: FormErrors<Type[Property]>;
|
|
9
9
|
};
|
|
10
10
|
export interface IField {
|
package/package.json
CHANGED