indicator-ui 1.1.28 → 1.1.29
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.
|
@@ -8,8 +8,8 @@ export declare function createFormServices<T, F = Nullable<Undefinable<T>>>(deps
|
|
|
8
8
|
getValidForm: () => Promise<T | null>;
|
|
9
9
|
/** Fields */
|
|
10
10
|
getField: <P extends FormPath<F>>(path: P) => FormValue<F, P> | null | undefined;
|
|
11
|
-
getFieldSync: <P extends FormPath<F>>(path: P) => FormValue<F, P> | undefined;
|
|
12
|
-
setField: <P extends FormPath<F>>(path: P, value: FormValue<F, P> | undefined) => void;
|
|
11
|
+
getFieldSync: <P extends FormPath<F>>(path: P) => FormValue<F, P> | null | undefined;
|
|
12
|
+
setField: <P extends FormPath<F>>(path: P, value: FormValue<F, P> | null | undefined) => void;
|
|
13
13
|
clearField: (path: FormPath<F> | FormPath<F>[]) => void;
|
|
14
14
|
/** Errors */
|
|
15
15
|
getError: <P extends FormPath<F>>(path: P) => FormErrorType | undefined;
|
|
@@ -153,9 +153,9 @@ export type FieldConfigType<T, F> = DefaultValueConfig<T, F> & BaseFieldValidato
|
|
|
153
153
|
export type FormSchemeType<T> = Nullable<Undefinable<T>> extends infer Form ? {
|
|
154
154
|
[K in ExtendFormPath<Form>]?: FieldConfigType<Form, ExtendFormValue<Form, K>>;
|
|
155
155
|
} : never;
|
|
156
|
-
type
|
|
156
|
+
export type FormWatcherCallback<T, P extends FormPath<T>, F = Nullable<Undefinable<T>>> = (value: FormValue<F, P>, services: UseFormServices<T>) => any;
|
|
157
157
|
export type FormWatchType<T> = {
|
|
158
|
-
[K in FormPath<T>]?:
|
|
158
|
+
[K in FormPath<T>]?: FormWatcherCallback<T, K>;
|
|
159
159
|
};
|
|
160
160
|
export type FieldChangeMode = 'change' | 'update';
|
|
161
161
|
export type FieldOnChange<V, M extends FieldChangeMode> = M extends 'change' ? (action?: V | null) => void : (action: SetStateAction<V | undefined | null>) => void;
|
|
@@ -15,9 +15,9 @@ export type UseFormServices<T, F = Nullable<Undefinable<T>>> = {
|
|
|
15
15
|
/** Получить значение поля (реактивное) */
|
|
16
16
|
get: <P extends FormPath<F>>(path: P) => FormValue<F, P> | null | undefined;
|
|
17
17
|
/** Получить значение поля (гарантированно актуальное) */
|
|
18
|
-
getSync: <P extends FormPath<F>>(path: P) => FormValue<F, P> | undefined;
|
|
18
|
+
getSync: <P extends FormPath<F>>(path: P) => FormValue<F, P> | null | undefined;
|
|
19
19
|
/** Установить значение поля */
|
|
20
|
-
set: <P extends FormPath<F>>(path: P, value: FormValue<F, P> | undefined) => void;
|
|
20
|
+
set: <P extends FormPath<F>>(path: P, value: FormValue<F, P> | null | undefined) => void;
|
|
21
21
|
/** Очистить одно или несколько полей */
|
|
22
22
|
clear: (path: FormPath<F> | FormPath<F>[]) => void;
|
|
23
23
|
};
|