indicator-ui 1.1.41 → 1.1.42
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.
|
@@ -27,4 +27,4 @@ export declare function createFormServices<T, F = Nullable<Undefinable<T>>>(deps
|
|
|
27
27
|
highlightField: <P extends ExtendFormPath<F>>(path: P) => Promise<boolean>;
|
|
28
28
|
highlightFields: (paths: ExtendFormPath<F>[]) => Promise<boolean>;
|
|
29
29
|
highlightFormErrors: () => Promise<boolean>;
|
|
30
|
-
}): UseFormServices<T
|
|
30
|
+
}): UseFormServices<T>;
|
|
@@ -67,7 +67,7 @@ export type ArrayFieldValidators = Partial<{
|
|
|
67
67
|
/** Максимальное количество элементов в массиве */
|
|
68
68
|
maxItemCount: number;
|
|
69
69
|
}>;
|
|
70
|
-
export type FormValidateCustomFunType<T, F> = (value: F | undefined, services: UseFormServices<T>) => Promise<FormErrorType> | FormErrorType;
|
|
70
|
+
export type FormValidateCustomFunType<T, F> = (value: F | null | undefined, services: UseFormServices<T>) => Promise<FormErrorType> | FormErrorType;
|
|
71
71
|
export type BaseFieldValidators<T, F> = Partial<{
|
|
72
72
|
/** Поле обязательное */
|
|
73
73
|
required: ValidatorOption<boolean>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExtendFormPath, FormErrorsType, FormErrorType, FormPath, FormValue } from './formTypes';
|
|
2
2
|
import { Form } from '../classes';
|
|
3
3
|
import { Nullable, Undefinable } from '../../../types';
|
|
4
|
-
export type UseFormServices<T
|
|
4
|
+
export type UseFormServices<T> = Nullable<Undefinable<T>> extends infer F ? {
|
|
5
5
|
/** Работа с данными формы */
|
|
6
6
|
form: {
|
|
7
7
|
/** Получить актуальные данные формы */
|
|
@@ -56,4 +56,4 @@ export type UseFormServices<T, F = Nullable<Undefinable<T>>> = {
|
|
|
56
56
|
/** Подсветить все ошибки формы */
|
|
57
57
|
form: () => Promise<boolean>;
|
|
58
58
|
};
|
|
59
|
-
};
|
|
59
|
+
} : never;
|
|
@@ -9,12 +9,12 @@ type PropsType<Form, T> = {
|
|
|
9
9
|
useInstanceRefApi?: boolean;
|
|
10
10
|
initFormData?: T;
|
|
11
11
|
scheme?: FormSchemeType<T>;
|
|
12
|
-
onSubmit?: (data: Form, event: React.SubmitEvent<HTMLFormElement>, services: UseFormServices<Form
|
|
12
|
+
onSubmit?: (data: Form, event: React.SubmitEvent<HTMLFormElement>, services: UseFormServices<Form>) => void | Promise<void>;
|
|
13
13
|
/** Callback при ошибки валидации полей */
|
|
14
14
|
onSubmitError?: (event: {
|
|
15
15
|
errors: FormErrorsType<T>;
|
|
16
|
-
}, services: UseFormServices<Form
|
|
17
|
-
onSubmitAttempt?: (data: T | undefined | null, event: React.SubmitEvent<HTMLFormElement>, services: UseFormServices<Form
|
|
16
|
+
}, services: UseFormServices<Form>) => void;
|
|
17
|
+
onSubmitAttempt?: (data: T | undefined | null, event: React.SubmitEvent<HTMLFormElement>, services: UseFormServices<Form>) => void;
|
|
18
18
|
watch?: FormWatchType<Form>;
|
|
19
19
|
/** Отключить вызов watch-коллбэков для родительских путей при изменении вложенного поля */
|
|
20
20
|
offWatchDeep?: boolean;
|