indicator-ui 0.1.70 → 0.1.71
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Nullable } from "../../../types";
|
|
2
2
|
import { ExtendFormPath, ExtendFormValue, FormErrorType, FormPath, FormValue } from './formTypes';
|
|
3
3
|
export type StringFieldValidators = Partial<{
|
|
4
4
|
/** Минимальная длина строки */
|
|
@@ -148,7 +148,7 @@ export type FieldConfigType<T, F> = DefaultValueConfig<T, F> & BaseFieldValidato
|
|
|
148
148
|
*
|
|
149
149
|
* @template T — тип данных формы (например, интерфейс или тип объекта формы).
|
|
150
150
|
*/
|
|
151
|
-
export type FormSchemeType<T> =
|
|
151
|
+
export type FormSchemeType<T> = Nullable<Partial<T>> extends infer Form ? {
|
|
152
152
|
[K in ExtendFormPath<Form>]?: FieldConfigType<Form, ExtendFormValue<Form, K>>;
|
|
153
153
|
} : never;
|
|
154
154
|
export type FieldPropsType<V> = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { FormEvent } from "react";
|
|
2
2
|
import { ExtendFormPath, FieldPropsType, FormErrorsType, FormErrorType } from "../../hooks";
|
|
3
|
-
import {
|
|
3
|
+
import { Nullable } from "../../types";
|
|
4
4
|
import { FormPath, FormSchemeType, FormValue } from "./types";
|
|
5
5
|
type PropsType<T, Form> = [
|
|
6
6
|
props?: {
|
|
@@ -187,7 +187,7 @@ type PropsType<T, Form> = [
|
|
|
187
187
|
*
|
|
188
188
|
* @returns {object} Объект с методами и состоянием формы (см. таблицу выше).
|
|
189
189
|
*/
|
|
190
|
-
export declare function useForm<Form, T extends
|
|
190
|
+
export declare function useForm<Form, T extends Nullable<Partial<Form>> = Nullable<Partial<Form>>>(...args: PropsType<T, Form>): {
|
|
191
191
|
formData: T | undefined;
|
|
192
192
|
setFormData: (formData: T) => void;
|
|
193
193
|
getFormData: () => T | undefined;
|
|
@@ -14,7 +14,7 @@ export type IsTuple<T> = T extends readonly any[] ? number extends T['length'] ?
|
|
|
14
14
|
export type NegativeBoolean<T> = T extends true ? false : true;
|
|
15
15
|
export type NotTuple<T> = NegativeBoolean<IsTuple<T>>;
|
|
16
16
|
export type BuildTuple<N extends number, T extends any[] = []> = T['length'] extends N ? T : BuildTuple<N, [...T, N]>;
|
|
17
|
-
export type
|
|
18
|
-
[K in keyof T]:
|
|
17
|
+
export type Nullable<T> = {
|
|
18
|
+
[K in keyof T]: T[K] | null;
|
|
19
19
|
};
|
|
20
20
|
export {};
|