@octanejs/tanstack-form 0.0.1
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/LICENSE +21 -0
- package/README.md +102 -0
- package/package.json +54 -0
- package/src/createFormHook.tsrx +864 -0
- package/src/createFormHook.tsrx.d.ts +101 -0
- package/src/index.ts +11 -0
- package/src/types.ts +122 -0
- package/src/useField.tsrx +656 -0
- package/src/useField.tsrx.d.ts +55 -0
- package/src/useFieldGroup.tsrx +252 -0
- package/src/useFieldGroup.tsrx.d.ts +37 -0
- package/src/useForm.tsrx +296 -0
- package/src/useForm.tsrx.d.ts +35 -0
- package/src/useFormGroup.tsrx +633 -0
- package/src/useFormGroup.tsrx.d.ts +16 -0
- package/src/useFormId.ts +4 -0
- package/src/useIsomorphicLayoutEffect.ts +4 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// Declaration companion generated from createFormHook.tsrx.
|
|
2
|
+
import type { AnyFieldApi, AnyFormApi, BaseFormOptions, DeepKeysOfType, FieldApi, FieldsMap, FormAsyncValidateOrFn, FormOptions, FormValidateOrFn } from '@tanstack/form-core';
|
|
3
|
+
import type { Context } from 'octane';
|
|
4
|
+
import type { FieldComponent } from './useField.tsrx';
|
|
5
|
+
import type { OctaneFormExtendedApi } from './useForm.tsrx';
|
|
6
|
+
import type { AppFieldExtendedOctaneFieldGroupApi } from './useFieldGroup.tsrx';
|
|
7
|
+
type HookRenderable = unknown;
|
|
8
|
+
type HookPropsWithChildren<P = object> = P & {
|
|
9
|
+
children?: HookRenderable;
|
|
10
|
+
};
|
|
11
|
+
type HookFunctionComponent<P = object> = (props: P) => HookRenderable;
|
|
12
|
+
type HookComponentType<P = object> = HookFunctionComponent<P>;
|
|
13
|
+
/**
|
|
14
|
+
* TypeScript inferencing is weird.
|
|
15
|
+
*
|
|
16
|
+
* If you have:
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
*
|
|
20
|
+
* interface Args<T> {
|
|
21
|
+
* arg?: T
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* function test<T>(arg?: Partial<Args<T>>): T {
|
|
25
|
+
* return 0 as any;
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* const a = test({});
|
|
29
|
+
*
|
|
30
|
+
* Then `T` will default to `unknown`.
|
|
31
|
+
*
|
|
32
|
+
* However, if we change `test` to be:
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
*
|
|
36
|
+
* function test<T extends undefined>(arg?: Partial<Args<T>>): T;
|
|
37
|
+
*
|
|
38
|
+
* Then `T` becomes `undefined`.
|
|
39
|
+
*
|
|
40
|
+
* Here, we are checking if the passed type `T` extends `DefaultT` and **only**
|
|
41
|
+
* `DefaultT`, as if that's the case we assume that inferencing has not occurred.
|
|
42
|
+
*/
|
|
43
|
+
type UnwrapOrAny<T> = [unknown] extends [T] ? any : T;
|
|
44
|
+
type UnwrapDefaultOrAny<DefaultT, T> = [DefaultT] extends [T] ? [T] extends [DefaultT] ? any : T : T;
|
|
45
|
+
declare function useFormContext(): OctaneFormExtendedApi<Record<string, never>, any, any, any, any, any, any, any, any, any, any, any>;
|
|
46
|
+
export declare function createFormHookContexts(): {
|
|
47
|
+
fieldContext: Context<AnyFieldApi>;
|
|
48
|
+
useFieldContext: <TData>() => FieldApi<any, string, TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
49
|
+
useFormContext: typeof useFormContext;
|
|
50
|
+
formContext: Context<AnyFormApi>;
|
|
51
|
+
};
|
|
52
|
+
interface CreateFormHookProps<TFieldComponents extends Record<string, HookComponentType<any>>, TFormComponents extends Record<string, HookComponentType<any>>> {
|
|
53
|
+
fieldComponents: TFieldComponents;
|
|
54
|
+
fieldContext: Context<AnyFieldApi>;
|
|
55
|
+
formComponents: TFormComponents;
|
|
56
|
+
formContext: Context<AnyFormApi>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @private
|
|
60
|
+
*/
|
|
61
|
+
export type AppFieldExtendedOctaneFormApi<TFormData, TOnMount extends undefined | FormValidateOrFn<TFormData>, TOnChange extends undefined | FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>, TSubmitMeta, TFieldComponents extends Record<string, HookComponentType<any>>, TFormComponents extends Record<string, HookComponentType<any>>> = OctaneFormExtendedApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta> & NoInfer<TFormComponents> & {
|
|
62
|
+
AppField: FieldComponent<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, NoInfer<TFieldComponents>>;
|
|
63
|
+
AppForm: HookComponentType<HookPropsWithChildren<{}>>;
|
|
64
|
+
};
|
|
65
|
+
export interface WithFormProps<TFormData, TOnMount extends undefined | FormValidateOrFn<TFormData>, TOnChange extends undefined | FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>, TSubmitMeta, TFieldComponents extends Record<string, HookComponentType<any>>, TFormComponents extends Record<string, HookComponentType<any>>, TRenderProps extends object = Record<string, never>> extends FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta> {
|
|
66
|
+
props?: TRenderProps;
|
|
67
|
+
render: HookFunctionComponent<HookPropsWithChildren<NoInfer<TRenderProps> & {
|
|
68
|
+
form: AppFieldExtendedOctaneFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, TFieldComponents, TFormComponents>;
|
|
69
|
+
}>>;
|
|
70
|
+
}
|
|
71
|
+
export interface WithFieldGroupProps<TFieldGroupData, TFieldComponents extends Record<string, HookComponentType<any>>, TFormComponents extends Record<string, HookComponentType<any>>, TSubmitMeta, TRenderProps extends object = Record<string, never>> extends BaseFormOptions<TFieldGroupData, TSubmitMeta> {
|
|
72
|
+
props?: TRenderProps;
|
|
73
|
+
render: HookFunctionComponent<HookPropsWithChildren<NoInfer<TRenderProps> & {
|
|
74
|
+
group: AppFieldExtendedOctaneFieldGroupApi<unknown, TFieldGroupData, string | FieldsMap<unknown, TFieldGroupData>, undefined | FormValidateOrFn<unknown>, undefined | FormValidateOrFn<unknown>, undefined | FormAsyncValidateOrFn<unknown>, undefined | FormValidateOrFn<unknown>, undefined | FormAsyncValidateOrFn<unknown>, undefined | FormValidateOrFn<unknown>, undefined | FormAsyncValidateOrFn<unknown>, undefined | FormValidateOrFn<unknown>, undefined | FormAsyncValidateOrFn<unknown>, undefined | FormAsyncValidateOrFn<unknown>, unknown extends TSubmitMeta ? never : TSubmitMeta, TFieldComponents, TFormComponents>;
|
|
75
|
+
}>>;
|
|
76
|
+
}
|
|
77
|
+
type UseAppForm<TComponents extends Record<string, HookComponentType<any>>, TFormComponents extends Record<string, HookComponentType<any>>> = <TFormData, TOnMount extends undefined | FormValidateOrFn<TFormData>, TOnChange extends undefined | FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>, TSubmitMeta>(props: FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>) => AppFieldExtendedOctaneFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, TComponents, TFormComponents>;
|
|
78
|
+
type WithForm<TComponents extends Record<string, HookComponentType<any>>, TFormComponents extends Record<string, HookComponentType<any>>> = <TFormData, TOnMount extends undefined | FormValidateOrFn<TFormData>, TOnChange extends undefined | FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>, TSubmitMeta, TRenderProps extends object = {}>(props: WithFormProps<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, TComponents, TFormComponents, TRenderProps>) => WithFormProps<UnwrapOrAny<TFormData>, UnwrapDefaultOrAny<undefined | FormValidateOrFn<TFormData>, TOnMount>, UnwrapDefaultOrAny<undefined | FormValidateOrFn<TFormData>, TOnChange>, UnwrapDefaultOrAny<undefined | FormValidateOrFn<TFormData>, TOnChangeAsync>, UnwrapDefaultOrAny<undefined | FormValidateOrFn<TFormData>, TOnBlur>, UnwrapDefaultOrAny<undefined | FormValidateOrFn<TFormData>, TOnBlurAsync>, UnwrapDefaultOrAny<undefined | FormValidateOrFn<TFormData>, TOnSubmit>, UnwrapDefaultOrAny<undefined | FormValidateOrFn<TFormData>, TOnSubmitAsync>, UnwrapDefaultOrAny<undefined | FormValidateOrFn<TFormData>, TOnDynamic>, UnwrapDefaultOrAny<undefined | FormValidateOrFn<TFormData>, TOnDynamicAsync>, UnwrapDefaultOrAny<undefined | FormValidateOrFn<TFormData>, TOnServer>, UnwrapOrAny<TSubmitMeta>, UnwrapOrAny<TComponents>, UnwrapOrAny<TFormComponents>, UnwrapOrAny<TRenderProps>>['render'];
|
|
79
|
+
type WithFieldGroup<TComponents extends Record<string, HookComponentType<any>>, TFormComponents extends Record<string, HookComponentType<any>>> = <TFieldGroupData, TSubmitMeta, TRenderProps extends object = {}>(props: WithFieldGroupProps<TFieldGroupData, TComponents, TFormComponents, TSubmitMeta, TRenderProps>) => <TFormData, TFields extends DeepKeysOfType<TFormData, TFieldGroupData | null | undefined> | FieldsMap<TFormData, TFieldGroupData>, TOnMount extends undefined | FormValidateOrFn<TFormData>, TOnChange extends undefined | FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>, TFormSubmitMeta>(params: HookPropsWithChildren<NoInfer<TRenderProps> & {
|
|
80
|
+
form: AppFieldExtendedOctaneFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, unknown extends TSubmitMeta ? TFormSubmitMeta : TSubmitMeta, TComponents, TFormComponents> | AppFieldExtendedOctaneFieldGroupApi<unknown, TFormData, string | FieldsMap<unknown, TFormData>, any, any, any, any, any, any, any, any, any, any, unknown extends TSubmitMeta ? TFormSubmitMeta : TSubmitMeta, TComponents, TFormComponents>;
|
|
81
|
+
fields: TFields;
|
|
82
|
+
}>) => ReturnType<HookFunctionComponent>;
|
|
83
|
+
type UseTypedAppFormContext<TComponents extends Record<string, HookComponentType<any>>, TFormComponents extends Record<string, HookComponentType<any>>> = <TFormData, TOnMount extends undefined | FormValidateOrFn<TFormData>, TOnChange extends undefined | FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>, TSubmitMeta>(props: FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>) => AppFieldExtendedOctaneFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, TComponents, TFormComponents>;
|
|
84
|
+
type FieldComponentExtension<TComponents extends Record<string, HookComponentType<any>>> = Record<string, HookComponentType<any>> & {
|
|
85
|
+
[K in keyof TComponents]?: 'Error: field component names must be unique — this key already exists in the base form';
|
|
86
|
+
};
|
|
87
|
+
type FormComponentExtension<TComponents extends Record<string, HookComponentType<any>>> = Record<string, HookComponentType<any>> & {
|
|
88
|
+
[K in keyof TComponents]?: 'Error: form component names must be unique — this key already exists in the base form';
|
|
89
|
+
};
|
|
90
|
+
export interface CreateFormHookReturn<TComponents extends Record<string, HookComponentType<any>>, TFormComponents extends Record<string, HookComponentType<any>>> {
|
|
91
|
+
useAppForm: UseAppForm<TComponents, TFormComponents>;
|
|
92
|
+
withForm: WithForm<TComponents, TFormComponents>;
|
|
93
|
+
withFieldGroup: WithFieldGroup<TComponents, TFormComponents>;
|
|
94
|
+
useTypedAppFormContext: UseTypedAppFormContext<TComponents, TFormComponents>;
|
|
95
|
+
extendForm: <TNewField extends FieldComponentExtension<TComponents>, TNewForm extends FormComponentExtension<TFormComponents>>(extension: {
|
|
96
|
+
fieldComponents?: TNewField;
|
|
97
|
+
formComponents?: TNewForm;
|
|
98
|
+
}) => CreateFormHookReturn<TComponents & TNewField, TFormComponents & TNewForm>;
|
|
99
|
+
}
|
|
100
|
+
export declare function createFormHook<TComponents extends Record<string, HookComponentType<any>>, TFormComponents extends Record<string, HookComponentType<any>>>({ fieldComponents, fieldContext, formContext, formComponents, }: CreateFormHookProps<TComponents, TFormComponents>): CreateFormHookReturn<TComponents, TFormComponents>;
|
|
101
|
+
export {};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from '@tanstack/form-core';
|
|
2
|
+
|
|
3
|
+
export { useSelector, useStore } from '@octanejs/tanstack-store';
|
|
4
|
+
|
|
5
|
+
export * from './createFormHook.tsrx';
|
|
6
|
+
export * from './types';
|
|
7
|
+
export * from './useField.tsrx';
|
|
8
|
+
export * from './useFieldGroup.tsrx';
|
|
9
|
+
export * from './useForm.tsrx';
|
|
10
|
+
export * from './useFormGroup.tsrx';
|
|
11
|
+
export * from './useIsomorphicLayoutEffect';
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
DeepKeys,
|
|
3
|
+
DeepValue,
|
|
4
|
+
FieldApiOptions,
|
|
5
|
+
FieldAsyncValidateOrFn,
|
|
6
|
+
FieldOptions,
|
|
7
|
+
FieldValidateOrFn,
|
|
8
|
+
FormAsyncValidateOrFn,
|
|
9
|
+
FormState,
|
|
10
|
+
FormValidateOrFn,
|
|
11
|
+
} from '@tanstack/form-core';
|
|
12
|
+
|
|
13
|
+
interface FieldOptionsMode {
|
|
14
|
+
mode?: 'value' | 'array';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The field options.
|
|
19
|
+
*/
|
|
20
|
+
export interface UseFieldOptions<
|
|
21
|
+
TParentData,
|
|
22
|
+
TName extends DeepKeys<TParentData>,
|
|
23
|
+
TData extends DeepValue<TParentData, TName>,
|
|
24
|
+
TOnMount extends undefined | FieldValidateOrFn<TParentData, TName, TData>,
|
|
25
|
+
TOnChange extends undefined | FieldValidateOrFn<TParentData, TName, TData>,
|
|
26
|
+
TOnChangeAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>,
|
|
27
|
+
TOnBlur extends undefined | FieldValidateOrFn<TParentData, TName, TData>,
|
|
28
|
+
TOnBlurAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>,
|
|
29
|
+
TOnSubmit extends undefined | FieldValidateOrFn<TParentData, TName, TData>,
|
|
30
|
+
TOnSubmitAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>,
|
|
31
|
+
TOnDynamic extends undefined | FieldValidateOrFn<TParentData, TName, TData>,
|
|
32
|
+
TOnDynamicAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>,
|
|
33
|
+
TFormOnMount extends undefined | FormValidateOrFn<TParentData>,
|
|
34
|
+
TFormOnChange extends undefined | FormValidateOrFn<TParentData>,
|
|
35
|
+
TFormOnChangeAsync extends undefined | FormAsyncValidateOrFn<TParentData>,
|
|
36
|
+
TFormOnBlur extends undefined | FormValidateOrFn<TParentData>,
|
|
37
|
+
TFormOnBlurAsync extends undefined | FormAsyncValidateOrFn<TParentData>,
|
|
38
|
+
TFormOnSubmit extends undefined | FormValidateOrFn<TParentData>,
|
|
39
|
+
TFormOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TParentData>,
|
|
40
|
+
TFormOnDynamic extends undefined | FormValidateOrFn<TParentData>,
|
|
41
|
+
TFormOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TParentData>,
|
|
42
|
+
TFormOnServer extends undefined | FormAsyncValidateOrFn<TParentData>,
|
|
43
|
+
TSubmitMeta,
|
|
44
|
+
>
|
|
45
|
+
extends
|
|
46
|
+
FieldApiOptions<
|
|
47
|
+
TParentData,
|
|
48
|
+
TName,
|
|
49
|
+
TData,
|
|
50
|
+
TOnMount,
|
|
51
|
+
TOnChange,
|
|
52
|
+
TOnChangeAsync,
|
|
53
|
+
TOnBlur,
|
|
54
|
+
TOnBlurAsync,
|
|
55
|
+
TOnSubmit,
|
|
56
|
+
TOnSubmitAsync,
|
|
57
|
+
TOnDynamic,
|
|
58
|
+
TOnDynamicAsync,
|
|
59
|
+
TFormOnMount,
|
|
60
|
+
TFormOnChange,
|
|
61
|
+
TFormOnChangeAsync,
|
|
62
|
+
TFormOnBlur,
|
|
63
|
+
TFormOnBlurAsync,
|
|
64
|
+
TFormOnSubmit,
|
|
65
|
+
TFormOnSubmitAsync,
|
|
66
|
+
TFormOnDynamic,
|
|
67
|
+
TFormOnDynamicAsync,
|
|
68
|
+
TFormOnServer,
|
|
69
|
+
TSubmitMeta
|
|
70
|
+
>,
|
|
71
|
+
FieldOptionsMode {}
|
|
72
|
+
|
|
73
|
+
export interface UseFieldOptionsBound<
|
|
74
|
+
TParentData,
|
|
75
|
+
TName extends DeepKeys<TParentData>,
|
|
76
|
+
TData extends DeepValue<TParentData, TName>,
|
|
77
|
+
TOnMount extends undefined | FieldValidateOrFn<TParentData, TName, TData>,
|
|
78
|
+
TOnChange extends undefined | FieldValidateOrFn<TParentData, TName, TData>,
|
|
79
|
+
TOnChangeAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>,
|
|
80
|
+
TOnBlur extends undefined | FieldValidateOrFn<TParentData, TName, TData>,
|
|
81
|
+
TOnBlurAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>,
|
|
82
|
+
TOnSubmit extends undefined | FieldValidateOrFn<TParentData, TName, TData>,
|
|
83
|
+
TOnSubmitAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>,
|
|
84
|
+
TOnDynamic extends undefined | FieldValidateOrFn<TParentData, TName, TData>,
|
|
85
|
+
TOnDynamicAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>,
|
|
86
|
+
>
|
|
87
|
+
extends
|
|
88
|
+
FieldOptions<
|
|
89
|
+
TParentData,
|
|
90
|
+
TName,
|
|
91
|
+
TData,
|
|
92
|
+
TOnMount,
|
|
93
|
+
TOnChange,
|
|
94
|
+
TOnChangeAsync,
|
|
95
|
+
TOnBlur,
|
|
96
|
+
TOnBlurAsync,
|
|
97
|
+
TOnSubmit,
|
|
98
|
+
TOnSubmitAsync,
|
|
99
|
+
TOnDynamic,
|
|
100
|
+
TOnDynamicAsync
|
|
101
|
+
>,
|
|
102
|
+
FieldOptionsMode {}
|
|
103
|
+
|
|
104
|
+
export type ServerFormState<
|
|
105
|
+
TFormData,
|
|
106
|
+
TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>,
|
|
107
|
+
> = Pick<
|
|
108
|
+
FormState<
|
|
109
|
+
TFormData,
|
|
110
|
+
undefined,
|
|
111
|
+
undefined,
|
|
112
|
+
undefined,
|
|
113
|
+
undefined,
|
|
114
|
+
undefined,
|
|
115
|
+
undefined,
|
|
116
|
+
undefined,
|
|
117
|
+
undefined,
|
|
118
|
+
undefined,
|
|
119
|
+
TOnServer
|
|
120
|
+
>,
|
|
121
|
+
'values' | 'errors' | 'errorMap'
|
|
122
|
+
>;
|