@reactables/forms 2.0.0-beta.2 → 2.0.0-beta.4
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/RxForm/RxForm.d.ts +13 -18
- package/dist/RxForm/index.d.ts +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/RxForm/RxForm.d.ts
CHANGED
|
@@ -29,22 +29,17 @@ export interface FormReducers {
|
|
|
29
29
|
markControlAsUntouched: <T>(state: BaseFormState<T>, payload: ControlRef) => BaseFormState<T>;
|
|
30
30
|
resetControl: <T>(state: BaseFormState<T>, payload: ControlRef) => BaseFormState<T>;
|
|
31
31
|
}
|
|
32
|
-
export type CustomReducerFunc<
|
|
33
|
-
export type CustomReducer = CustomReducerFunc | {
|
|
34
|
-
reducer: CustomReducerFunc
|
|
32
|
+
export type CustomReducerFunc<FormValue = unknown, Payload = unknown> = (reducers: FormReducers, state: BaseFormState<FormValue>, action: Action<Payload>) => BaseFormState<unknown>;
|
|
33
|
+
export type CustomReducer<FormValue = unknown, Payload = unknown> = CustomReducerFunc<FormValue, Payload> | {
|
|
34
|
+
reducer: CustomReducerFunc<FormValue, Payload>;
|
|
35
35
|
effects?: Effect<unknown, unknown>[] | ((payload?: unknown) => ScopedEffects<unknown>);
|
|
36
36
|
};
|
|
37
|
-
export type
|
|
38
|
-
[key in keyof (T & {
|
|
39
|
-
[key: string]: CustomReducer;
|
|
40
|
-
})]: CustomReducer;
|
|
41
|
-
};
|
|
42
|
-
export type ActionCreatorTypeFromCustomReducer<T> = T extends (reducers: FormReducers, state: BaseFormState<unknown>) => BaseFormState<unknown> ? () => void : T extends CustomReducerFunc<infer P> ? (payload: P) => void : T extends {
|
|
37
|
+
export type ActionCreatorTypeFromCustomReducer<T> = T extends (reducers: FormReducers, state: BaseFormState<unknown>) => BaseFormState<unknown> ? () => void : T extends CustomReducerFunc<unknown, infer P> ? (payload: P) => void : T extends {
|
|
43
38
|
reducer: (reducers: FormReducers, state: BaseFormState<unknown>) => BaseFormState<unknown>;
|
|
44
39
|
} ? () => void : T extends {
|
|
45
|
-
reducer: CustomReducerFunc<infer P>;
|
|
40
|
+
reducer: CustomReducerFunc<unknown, infer P>;
|
|
46
41
|
} ? (payload: P) => void : never;
|
|
47
|
-
export interface RxFormOptions<T extends
|
|
42
|
+
export interface RxFormOptions<T extends Record<string, CustomReducer> = Record<string, CustomReducer>> {
|
|
48
43
|
reducers?: T;
|
|
49
44
|
providers?: RxFormProviders;
|
|
50
45
|
name?: string;
|
|
@@ -63,8 +58,8 @@ export interface RxFormProviders {
|
|
|
63
58
|
[key: string]: ValidatorAsyncFn;
|
|
64
59
|
};
|
|
65
60
|
}
|
|
66
|
-
export declare const build: <
|
|
67
|
-
updateValues: <
|
|
61
|
+
export declare const build: <FormValue, CustomReducers extends Record<string, CustomReducer<FormValue, unknown>> = Record<string, CustomReducer<FormValue, unknown>>>(config: AbstractControlConfig, options?: RxFormOptions<CustomReducers>) => Reactable<Form<FormValue>, { [K in keyof CustomReducers]: ActionCreatorTypeFromCustomReducer<CustomReducers[K]>; } & {
|
|
62
|
+
updateValues: <T>(payload: UpdateValuesPayload<T>) => void;
|
|
68
63
|
addControl: (payload: AddControlPayload) => void;
|
|
69
64
|
pushControl: (payload: PushControlPayload) => void;
|
|
70
65
|
removeControl: (payload: ControlRef) => void;
|
|
@@ -72,11 +67,11 @@ export declare const build: <T extends CustomReducers<unknown>>(config: Abstract
|
|
|
72
67
|
markControlAsTouched: (payload: MarkTouchedPayload) => void;
|
|
73
68
|
markControlAsUntouched: (payload: ControlRef) => void;
|
|
74
69
|
resetControl: (payload: ControlRef) => void;
|
|
75
|
-
} & ActionMap & DestroyAction, CustomReducerActionTypes<
|
|
70
|
+
} & ActionMap & DestroyAction, CustomReducerActionTypes<CustomReducers> & FormActionTypes & {
|
|
76
71
|
destroy: 'destroy';
|
|
77
72
|
}>;
|
|
78
|
-
export declare const load: <
|
|
79
|
-
updateValues: <
|
|
73
|
+
export declare const load: <FormValue, CustomReducers extends Record<string, CustomReducer<FormValue, unknown>> = Record<string, CustomReducer<FormValue, unknown>>>(state: Form<FormValue>, options?: RxFormOptions<CustomReducers>) => Reactable<Form<FormValue>, { [K in keyof CustomReducers]: ActionCreatorTypeFromCustomReducer<CustomReducers[K]>; } & {
|
|
74
|
+
updateValues: <T>(payload: UpdateValuesPayload<T>) => void;
|
|
80
75
|
addControl: (payload: AddControlPayload) => void;
|
|
81
76
|
pushControl: (payload: PushControlPayload) => void;
|
|
82
77
|
removeControl: (payload: ControlRef) => void;
|
|
@@ -84,10 +79,10 @@ export declare const load: <Value, T extends CustomReducers<unknown>>(state: For
|
|
|
84
79
|
markControlAsTouched: (payload: MarkTouchedPayload) => void;
|
|
85
80
|
markControlAsUntouched: (payload: ControlRef) => void;
|
|
86
81
|
resetControl: (payload: ControlRef) => void;
|
|
87
|
-
} & ActionMap & DestroyAction, CustomReducerActionTypes<
|
|
82
|
+
} & ActionMap & DestroyAction, CustomReducerActionTypes<CustomReducers> & FormActionTypes & {
|
|
88
83
|
destroy: 'destroy';
|
|
89
84
|
}>;
|
|
90
|
-
type CustomReducerActionTypes<T extends
|
|
85
|
+
type CustomReducerActionTypes<T extends Record<string, CustomReducer>> = {
|
|
91
86
|
[K in keyof T as `${K & string}`]: `${K & string}`;
|
|
92
87
|
};
|
|
93
88
|
type FormActionTypes = {
|
package/dist/RxForm/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { build, load, group, array, control, RxFormActions, CustomReducer,
|
|
1
|
+
export { build, load, group, array, control, RxFormActions, CustomReducer, FormReducers, RxFormOptions, RxFormProviders, } from './RxForm';
|