@mantine/form 8.3.7 → 8.3.9
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/lib/paths.types.d.ts +2 -0
- package/lib/types.d.ts +3 -3
- package/package.json +1 -1
package/lib/paths.types.d.ts
CHANGED
|
@@ -18,5 +18,7 @@ export type ArrayPath<T, D extends number = Depth> = [D] extends [never] ? never
|
|
|
18
18
|
}[keyof T];
|
|
19
19
|
export type PathValue<T, TPath extends string> = T extends any ? TPath extends `${infer K}.${infer R}` ? K extends keyof T ? R extends Path<T[K]> ? undefined extends T[K] ? PathValue<T[K], R> | undefined : PathValue<T[K], R> : never : K extends `${ArrayKey}` ? T extends readonly (infer V)[] ? PathValue<V, R & Path<V>> : never : never : TPath extends keyof T ? T[TPath] : TPath extends `${ArrayKey}` ? T extends readonly (infer V)[] ? V : never : never : never;
|
|
20
20
|
export type FormPathValue<T, TPath extends string> = PathValue<T, TPath> extends never ? any : PathValue<T, TPath>;
|
|
21
|
+
export type ArrayElement<T> = T extends readonly (infer U)[] ? U : never;
|
|
22
|
+
export type FormArrayElement<T, TPath extends string> = ArrayElement<FormPathValue<T, TPath>> extends never ? any : ArrayElement<FormPathValue<T, TPath>>;
|
|
21
23
|
export type LooseKeys<T> = Path<T> | ArrayPath<T> | (string & {});
|
|
22
24
|
export {};
|
package/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FormPathValue, LooseKeys } from './paths.types';
|
|
1
|
+
import type { FormArrayElement, FormPathValue, LooseKeys } from './paths.types';
|
|
2
2
|
import type { formRootRule } from './validate/validate-values';
|
|
3
3
|
export type GetInputPropsType = 'input' | 'checkbox';
|
|
4
4
|
export type FormMode = 'controlled' | 'uncontrolled';
|
|
@@ -67,8 +67,8 @@ export type SetFieldTouched<Values> = <Field extends LooseKeys<Values>>(path: Fi
|
|
|
67
67
|
export type SetFieldDirty<Values> = <Field extends LooseKeys<Values>>(path: Field, dirty: boolean, forceUpdate?: boolean) => void;
|
|
68
68
|
export type SetCalculatedFieldDirty<Values> = <Field extends LooseKeys<Values>>(path: Field, value: FormPathValue<Values, Field>) => void;
|
|
69
69
|
export type ReorderListItem<Values> = <Field extends LooseKeys<Values>>(path: Field, payload: ReorderPayload) => void;
|
|
70
|
-
export type InsertListItem<Values> = <Field extends LooseKeys<Values>>(path: Field, item:
|
|
71
|
-
export type ReplaceListItem<Values> = <Field extends LooseKeys<Values>>(path: Field, index: number, item:
|
|
70
|
+
export type InsertListItem<Values> = <Field extends LooseKeys<Values>>(path: Field, item: FormArrayElement<Values, Field>, index?: number) => void;
|
|
71
|
+
export type ReplaceListItem<Values> = <Field extends LooseKeys<Values>>(path: Field, index: number, item: FormArrayElement<Values, Field>) => void;
|
|
72
72
|
export type RemoveListItem<Values> = <Field extends LooseKeys<Values>>(path: Field, index: number) => void;
|
|
73
73
|
export type GetFieldStatus<Values> = <Field extends LooseKeys<Values>>(path?: Field) => boolean;
|
|
74
74
|
export type ResetStatus = () => void;
|