@inertiajs/vue3 2.3.16 → 3.0.0-beta.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/dist/index.js +900 -408
- package/dist/index.js.map +4 -4
- package/dist/server.js +4 -35
- package/dist/server.js.map +2 -2
- package/package.json +11 -12
- package/resources/boost/guidelines/core.blade.php +4 -0
- package/resources/boost/skills/inertia-vue-development/SKILL.blade.php +411 -0
- package/types/app.d.ts +2 -1
- package/types/createInertiaApp.d.ts +9 -2
- package/types/deferred.d.ts +16 -2
- package/types/form.d.ts +42 -4
- package/types/index.d.ts +5 -3
- package/types/infiniteScroll.d.ts +10 -1
- package/types/layoutProps.d.ts +13 -0
- package/types/useForm.d.ts +2 -1
- package/types/useFormState.d.ts +80 -0
- package/types/useHttp.d.ts +63 -0
- package/dist/index.esm.js +0 -1802
- package/dist/index.esm.js.map +0 -7
- package/dist/server.esm.js +0 -6
- package/dist/server.esm.js.map +0 -7
package/types/form.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormComponentProps, FormComponentRef, FormComponentSlotProps, FormDataConvertible, Method } from '@inertiajs/core';
|
|
1
|
+
import { Errors, FormComponentProps, FormComponentRef, FormComponentSlotProps, FormDataConvertible, Method, VisitOptions } from '@inertiajs/core';
|
|
2
2
|
import { PropType, SlotsType } from 'vue';
|
|
3
3
|
declare const Form: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
4
|
action: {
|
|
@@ -97,10 +97,22 @@ declare const Form: import("vue").DefineComponent<import("vue").ExtractPropTypes
|
|
|
97
97
|
type: PropType<FormComponentProps["validationTimeout"]>;
|
|
98
98
|
default: number;
|
|
99
99
|
};
|
|
100
|
+
optimistic: {
|
|
101
|
+
type: PropType<FormComponentProps["optimistic"]>;
|
|
102
|
+
default: undefined;
|
|
103
|
+
};
|
|
100
104
|
withAllErrors: {
|
|
101
105
|
type: PropType<FormComponentProps["withAllErrors"]>;
|
|
102
106
|
default: null;
|
|
103
107
|
};
|
|
108
|
+
component: {
|
|
109
|
+
type: PropType<FormComponentProps["component"]>;
|
|
110
|
+
default: null;
|
|
111
|
+
};
|
|
112
|
+
instant: {
|
|
113
|
+
type: PropType<FormComponentProps["instant"]>;
|
|
114
|
+
default: boolean;
|
|
115
|
+
};
|
|
104
116
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
105
117
|
[key: string]: any;
|
|
106
118
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -200,18 +212,36 @@ declare const Form: import("vue").DefineComponent<import("vue").ExtractPropTypes
|
|
|
200
212
|
type: PropType<FormComponentProps["validationTimeout"]>;
|
|
201
213
|
default: number;
|
|
202
214
|
};
|
|
215
|
+
optimistic: {
|
|
216
|
+
type: PropType<FormComponentProps["optimistic"]>;
|
|
217
|
+
default: undefined;
|
|
218
|
+
};
|
|
203
219
|
withAllErrors: {
|
|
204
220
|
type: PropType<FormComponentProps["withAllErrors"]>;
|
|
205
221
|
default: null;
|
|
206
222
|
};
|
|
223
|
+
component: {
|
|
224
|
+
type: PropType<FormComponentProps["component"]>;
|
|
225
|
+
default: null;
|
|
226
|
+
};
|
|
227
|
+
instant: {
|
|
228
|
+
type: PropType<FormComponentProps["instant"]>;
|
|
229
|
+
default: boolean;
|
|
230
|
+
};
|
|
207
231
|
}>> & Readonly<{}>, {
|
|
208
232
|
transform: ((data: Record<string, FormDataConvertible>) => Record<string, FormDataConvertible>) | undefined;
|
|
233
|
+
withAllErrors: boolean | null | undefined;
|
|
209
234
|
method: Method | "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | undefined;
|
|
235
|
+
optimistic: import("@inertiajs/core").FormComponentOptimisticCallback<import("@inertiajs/core").PageProps & {
|
|
236
|
+
errors: Errors & import("@inertiajs/core").ErrorBag;
|
|
237
|
+
deferred?: Record<string, VisitOptions["only"]>;
|
|
238
|
+
}> | undefined;
|
|
210
239
|
headers: Record<string, string> | undefined;
|
|
211
240
|
errorBag: string | null | undefined;
|
|
212
241
|
queryStringArrayFormat: import("@inertiajs/core").QueryStringArrayFormatOption | undefined;
|
|
213
242
|
showProgress: boolean;
|
|
214
243
|
invalidateCacheTags: string | string[] | undefined;
|
|
244
|
+
component: string | undefined;
|
|
215
245
|
onCancelToken: import("@inertiajs/core").CancelTokenCallback | undefined;
|
|
216
246
|
onBefore: import("@inertiajs/core").GlobalEventCallback<"before", import("@inertiajs/core").RequestPayload> | undefined;
|
|
217
247
|
onStart: import("@inertiajs/core").GlobalEventCallback<"start", import("@inertiajs/core").RequestPayload> | undefined;
|
|
@@ -221,17 +251,25 @@ declare const Form: import("vue").DefineComponent<import("vue").ExtractPropTypes
|
|
|
221
251
|
onSuccess: import("@inertiajs/core").GlobalEventCallback<"success", import("@inertiajs/core").RequestPayload> | undefined;
|
|
222
252
|
onError: import("@inertiajs/core").GlobalEventCallback<"error", import("@inertiajs/core").RequestPayload> | undefined;
|
|
223
253
|
options: import("@inertiajs/core").FormComponentOptions | undefined;
|
|
224
|
-
withAllErrors: boolean | null | undefined;
|
|
225
254
|
action: string | import("@inertiajs/core").UrlMethodPair | undefined;
|
|
226
255
|
resetOnError: boolean | string[] | undefined;
|
|
227
256
|
resetOnSuccess: boolean | string[] | undefined;
|
|
228
257
|
setDefaultsOnSuccess: boolean | undefined;
|
|
229
|
-
onSubmitComplete: ((props: import("@inertiajs/core").
|
|
258
|
+
onSubmitComplete: ((props: import("@inertiajs/core").FormComponentOnSubmitCompleteArguments) => void) | undefined;
|
|
230
259
|
validateFiles: boolean | undefined;
|
|
231
260
|
validationTimeout: number | undefined;
|
|
261
|
+
instant: boolean | undefined;
|
|
232
262
|
disableWhileProcessing: boolean;
|
|
233
263
|
}, SlotsType<{
|
|
234
264
|
default: FormComponentSlotProps;
|
|
235
265
|
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
236
|
-
export declare function useFormContext(): FormComponentRef | undefined;
|
|
266
|
+
export declare function useFormContext<TForm extends object = Record<string, any>>(): FormComponentRef<TForm> | undefined;
|
|
267
|
+
type TypedFormComponent<TForm extends Record<string, any>> = typeof Form & {
|
|
268
|
+
new (): {
|
|
269
|
+
$slots: {
|
|
270
|
+
default: (props: FormComponentSlotProps<TForm>) => any;
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
};
|
|
274
|
+
export declare function createForm<TForm extends Record<string, any>>(): TypedFormComponent<TForm>;
|
|
237
275
|
export default Form;
|
package/types/index.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
export { progress, router } from '@inertiajs/core';
|
|
1
|
+
export { http, progress, router } from '@inertiajs/core';
|
|
2
2
|
export { default as App, usePage } from './app';
|
|
3
3
|
export { default as createInertiaApp } from './createInertiaApp';
|
|
4
4
|
export { default as Deferred } from './deferred';
|
|
5
|
-
export { default as Form, useFormContext } from './form';
|
|
5
|
+
export { createForm, default as Form, useFormContext } from './form';
|
|
6
6
|
export { default as Head } from './head';
|
|
7
7
|
export { default as InfiniteScroll } from './infiniteScroll';
|
|
8
|
+
export { resetLayoutProps, setLayoutProps, setLayoutPropsFor, useLayoutProps } from './layoutProps';
|
|
8
9
|
export { InertiaLinkProps, default as Link } from './link';
|
|
9
|
-
export
|
|
10
|
+
export { type VueInertiaAppConfig, type VuePageHandlerArgs } from './types';
|
|
10
11
|
export { InertiaForm, InertiaFormProps, InertiaPrecognitiveForm, default as useForm } from './useForm';
|
|
12
|
+
export { default as useHttp } from './useHttp';
|
|
11
13
|
export { default as usePoll } from './usePoll';
|
|
12
14
|
export { default as usePrefetch } from './usePrefetch';
|
|
13
15
|
export { default as useRemember } from './useRemember';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InfiniteScrollActionSlotProps, InfiniteScrollComponentBaseProps, InfiniteScrollSlotProps } from '@inertiajs/core';
|
|
1
|
+
import { InfiniteScrollActionSlotProps, InfiniteScrollComponentBaseProps, InfiniteScrollSlotProps, ReloadOptions } from '@inertiajs/core';
|
|
2
2
|
import { PropType, SlotsType } from 'vue';
|
|
3
3
|
declare const InfiniteScroll: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
4
4
|
data: {
|
|
@@ -53,6 +53,10 @@ declare const InfiniteScroll: import("vue").DefineComponent<import("vue").Extrac
|
|
|
53
53
|
type: PropType<string | (() => HTMLElement | null | undefined)>;
|
|
54
54
|
default: null;
|
|
55
55
|
};
|
|
56
|
+
params: {
|
|
57
|
+
type: PropType<ReloadOptions>;
|
|
58
|
+
default: () => {};
|
|
59
|
+
};
|
|
56
60
|
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
57
61
|
[key: string]: any;
|
|
58
62
|
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -108,9 +112,14 @@ declare const InfiniteScroll: import("vue").DefineComponent<import("vue").Extrac
|
|
|
108
112
|
type: PropType<string | (() => HTMLElement | null | undefined)>;
|
|
109
113
|
default: null;
|
|
110
114
|
};
|
|
115
|
+
params: {
|
|
116
|
+
type: PropType<ReloadOptions>;
|
|
117
|
+
default: () => {};
|
|
118
|
+
};
|
|
111
119
|
}>> & Readonly<{}>, {
|
|
112
120
|
reverse: boolean | undefined;
|
|
113
121
|
preserveUrl: boolean | undefined;
|
|
122
|
+
params: ReloadOptions;
|
|
114
123
|
buffer: number | undefined;
|
|
115
124
|
as: string | undefined;
|
|
116
125
|
manual: boolean | undefined;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComputedRef, InjectionKey } from 'vue';
|
|
2
|
+
export declare function setLayoutProps(props: Record<string, unknown>): void;
|
|
3
|
+
export declare function setLayoutPropsFor(name: string, props: Record<string, unknown>): void;
|
|
4
|
+
export declare function resetLayoutProps(): void;
|
|
5
|
+
export declare const LAYOUT_CONTEXT_KEY: InjectionKey<string | undefined>;
|
|
6
|
+
export declare const LayoutProvider: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
7
|
+
layoutName: StringConstructor;
|
|
8
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}>[] | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
11
|
+
layoutName: StringConstructor;
|
|
12
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
13
|
+
export declare function useLayoutProps<T extends Record<string, unknown>>(defaults: T): ComputedRef<T>;
|
package/types/useForm.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrorValue, FormDataErrors, FormDataKeys, FormDataType, FormDataValues, Method, Progress, UrlMethodPair, UseFormSubmitArguments, UseFormSubmitOptions, UseFormTransformCallback, UseFormWithPrecognitionArguments } from '@inertiajs/core';
|
|
1
|
+
import { ErrorValue, FormDataErrors, FormDataKeys, FormDataType, FormDataValues, Method, OptimisticCallback, Progress, UrlMethodPair, UseFormSubmitArguments, UseFormSubmitOptions, UseFormTransformCallback, UseFormWithPrecognitionArguments } from '@inertiajs/core';
|
|
2
2
|
import { NamedInputEvent, PrecognitionPath, ValidationConfig, Validator } from 'laravel-precognition';
|
|
3
3
|
export interface InertiaFormProps<TForm extends object> {
|
|
4
4
|
isDirty: boolean;
|
|
@@ -26,6 +26,7 @@ export interface InertiaFormProps<TForm extends object> {
|
|
|
26
26
|
delete(url: string, options?: UseFormSubmitOptions): void;
|
|
27
27
|
cancel(): void;
|
|
28
28
|
dontRemember<K extends FormDataKeys<TForm>>(...fields: K[]): this;
|
|
29
|
+
optimistic<TProps>(callback: OptimisticCallback<TProps>): this;
|
|
29
30
|
withPrecognition(...args: UseFormWithPrecognitionArguments): InertiaPrecognitiveForm<TForm>;
|
|
30
31
|
}
|
|
31
32
|
type PrecognitionValidationConfig<TKeys> = ValidationConfig & {
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ErrorValue, FormDataErrors, FormDataKeys, FormDataValues, Progress, UrlMethodPair, UseFormTransformCallback, UseFormWithPrecognitionArguments } from '@inertiajs/core';
|
|
2
|
+
import { NamedInputEvent, ValidationConfig, Validator } from 'laravel-precognition';
|
|
3
|
+
type PrecognitionValidationConfig<TKeys> = ValidationConfig & {
|
|
4
|
+
only?: TKeys[] | Iterable<TKeys> | ArrayLike<TKeys>;
|
|
5
|
+
};
|
|
6
|
+
export interface FormStateProps<TForm extends object> {
|
|
7
|
+
isDirty: boolean;
|
|
8
|
+
errors: FormDataErrors<TForm>;
|
|
9
|
+
hasErrors: boolean;
|
|
10
|
+
processing: boolean;
|
|
11
|
+
progress: Progress | null;
|
|
12
|
+
wasSuccessful: boolean;
|
|
13
|
+
recentlySuccessful: boolean;
|
|
14
|
+
data(): TForm;
|
|
15
|
+
transform(callback: UseFormTransformCallback<TForm>): this;
|
|
16
|
+
defaults(): this;
|
|
17
|
+
defaults<T extends FormDataKeys<TForm>>(field: T, value: FormDataValues<TForm, T>): this;
|
|
18
|
+
defaults(fields: Partial<TForm>): this;
|
|
19
|
+
reset<K extends FormDataKeys<TForm>>(...fields: K[]): this;
|
|
20
|
+
clearErrors<K extends FormDataKeys<TForm>>(...fields: K[]): this;
|
|
21
|
+
resetAndClearErrors<K extends FormDataKeys<TForm>>(...fields: K[]): this;
|
|
22
|
+
setError<K extends FormDataKeys<TForm>>(field: K, value: ErrorValue): this;
|
|
23
|
+
setError(errors: FormDataErrors<TForm>): this;
|
|
24
|
+
withPrecognition(...args: UseFormWithPrecognitionArguments): this & FormStateValidationProps<TForm>;
|
|
25
|
+
}
|
|
26
|
+
export interface FormStateValidationProps<TForm extends object> {
|
|
27
|
+
invalid<K extends FormDataKeys<TForm>>(field: K): boolean;
|
|
28
|
+
setValidationTimeout(duration: number): this;
|
|
29
|
+
touch<K extends FormDataKeys<TForm>>(field: K | NamedInputEvent | Array<K>, ...fields: K[]): this;
|
|
30
|
+
touched<K extends FormDataKeys<TForm>>(field?: K): boolean;
|
|
31
|
+
valid<K extends FormDataKeys<TForm>>(field: K): boolean;
|
|
32
|
+
validate<K extends FormDataKeys<TForm>>(field?: K | NamedInputEvent | PrecognitionValidationConfig<K>, config?: PrecognitionValidationConfig<K>): this;
|
|
33
|
+
validateFiles(): this;
|
|
34
|
+
validating: boolean;
|
|
35
|
+
validator: () => Validator;
|
|
36
|
+
withAllErrors(): this;
|
|
37
|
+
withoutFileValidation(): this;
|
|
38
|
+
setErrors(errors: FormDataErrors<TForm> | Record<string, string | string[]>): this;
|
|
39
|
+
forgetError<K extends FormDataKeys<TForm> | NamedInputEvent>(field: K): this;
|
|
40
|
+
}
|
|
41
|
+
interface InternalPrecognitionState {
|
|
42
|
+
__touched: string[];
|
|
43
|
+
__valid: string[];
|
|
44
|
+
}
|
|
45
|
+
export type FormState<TForm extends object> = TForm & FormStateProps<TForm>;
|
|
46
|
+
export type FormStateWithPrecognition<TForm extends object> = FormState<TForm> & FormStateValidationProps<TForm> & InternalPrecognitionState;
|
|
47
|
+
interface InternalRememberState<TForm extends object> {
|
|
48
|
+
__rememberable: boolean;
|
|
49
|
+
__remember: () => {
|
|
50
|
+
data: TForm;
|
|
51
|
+
errors: FormDataErrors<TForm>;
|
|
52
|
+
};
|
|
53
|
+
__restore: (restored: {
|
|
54
|
+
data: TForm;
|
|
55
|
+
errors: FormDataErrors<TForm>;
|
|
56
|
+
}) => void;
|
|
57
|
+
}
|
|
58
|
+
export interface UseFormStateOptions<TForm extends object> {
|
|
59
|
+
data: TForm | (() => TForm);
|
|
60
|
+
rememberKey?: string | null;
|
|
61
|
+
precognitionEndpoint?: (() => UrlMethodPair) | null;
|
|
62
|
+
}
|
|
63
|
+
export interface UseFormStateReturn<TForm extends object> {
|
|
64
|
+
form: FormState<TForm> & InternalRememberState<TForm>;
|
|
65
|
+
setDefaults: (newDefaults: TForm) => void;
|
|
66
|
+
getTransform: () => UseFormTransformCallback<TForm>;
|
|
67
|
+
getPrecognitionEndpoint: () => (() => UrlMethodPair) | null;
|
|
68
|
+
markAsSuccessful: () => void;
|
|
69
|
+
wasDefaultsCalledInOnSuccess: () => boolean;
|
|
70
|
+
resetDefaultsCalledInOnSuccess: () => void;
|
|
71
|
+
setRememberExcludeKeys: (keys: FormDataKeys<TForm>[]) => void;
|
|
72
|
+
resetBeforeSubmit: () => void;
|
|
73
|
+
finishProcessing: () => void;
|
|
74
|
+
withAllErrors: {
|
|
75
|
+
enabled: () => boolean;
|
|
76
|
+
enable: () => void;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export default function useFormState<TForm extends object>(options: UseFormStateOptions<TForm>): UseFormStateReturn<TForm>;
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ErrorValue, FormDataErrors, FormDataKeys, FormDataType, FormDataValues, Method, Progress, UrlMethodPair, UseFormTransformCallback, UseFormWithPrecognitionArguments, UseHttpSubmitArguments, UseHttpSubmitOptions } from '@inertiajs/core';
|
|
2
|
+
import { NamedInputEvent, ValidationConfig, Validator } from 'laravel-precognition';
|
|
3
|
+
export interface UseHttpProps<TForm extends object, TResponse = unknown> {
|
|
4
|
+
isDirty: boolean;
|
|
5
|
+
errors: FormDataErrors<TForm>;
|
|
6
|
+
hasErrors: boolean;
|
|
7
|
+
processing: boolean;
|
|
8
|
+
progress: Progress | null;
|
|
9
|
+
wasSuccessful: boolean;
|
|
10
|
+
recentlySuccessful: boolean;
|
|
11
|
+
response: TResponse | null;
|
|
12
|
+
data(): TForm;
|
|
13
|
+
transform(callback: UseFormTransformCallback<TForm>): this;
|
|
14
|
+
defaults(): this;
|
|
15
|
+
defaults<T extends FormDataKeys<TForm>>(field: T, value: FormDataValues<TForm, T>): this;
|
|
16
|
+
defaults(fields: Partial<TForm>): this;
|
|
17
|
+
reset<K extends FormDataKeys<TForm>>(...fields: K[]): this;
|
|
18
|
+
clearErrors<K extends FormDataKeys<TForm>>(...fields: K[]): this;
|
|
19
|
+
resetAndClearErrors<K extends FormDataKeys<TForm>>(...fields: K[]): this;
|
|
20
|
+
setError<K extends FormDataKeys<TForm>>(field: K, value: ErrorValue): this;
|
|
21
|
+
setError(errors: FormDataErrors<TForm>): this;
|
|
22
|
+
submit(...args: UseHttpSubmitArguments<TResponse, TForm>): Promise<TResponse>;
|
|
23
|
+
get(url: string, options?: UseHttpSubmitOptions<TResponse, TForm>): Promise<TResponse>;
|
|
24
|
+
post(url: string, options?: UseHttpSubmitOptions<TResponse, TForm>): Promise<TResponse>;
|
|
25
|
+
put(url: string, options?: UseHttpSubmitOptions<TResponse, TForm>): Promise<TResponse>;
|
|
26
|
+
patch(url: string, options?: UseHttpSubmitOptions<TResponse, TForm>): Promise<TResponse>;
|
|
27
|
+
delete(url: string, options?: UseHttpSubmitOptions<TResponse, TForm>): Promise<TResponse>;
|
|
28
|
+
cancel(): void;
|
|
29
|
+
dontRemember<K extends FormDataKeys<TForm>>(...fields: K[]): this;
|
|
30
|
+
optimistic(callback: (currentData: TForm) => Partial<TForm>): this;
|
|
31
|
+
withAllErrors(): this;
|
|
32
|
+
withPrecognition(...args: UseFormWithPrecognitionArguments): UseHttpPrecognitiveProps<TForm, TResponse>;
|
|
33
|
+
}
|
|
34
|
+
type PrecognitionValidationConfig<TKeys> = ValidationConfig & {
|
|
35
|
+
only?: TKeys[] | Iterable<TKeys> | ArrayLike<TKeys>;
|
|
36
|
+
};
|
|
37
|
+
export interface UseHttpValidationProps<TForm extends object> {
|
|
38
|
+
invalid<K extends FormDataKeys<TForm>>(field: K): boolean;
|
|
39
|
+
setValidationTimeout(duration: number): this;
|
|
40
|
+
touch<K extends FormDataKeys<TForm>>(field: K | NamedInputEvent | Array<K>, ...fields: K[]): this;
|
|
41
|
+
touched<K extends FormDataKeys<TForm>>(field?: K): boolean;
|
|
42
|
+
valid<K extends FormDataKeys<TForm>>(field: K): boolean;
|
|
43
|
+
validate<K extends FormDataKeys<TForm>>(field?: K | NamedInputEvent | PrecognitionValidationConfig<K>, config?: PrecognitionValidationConfig<K>): this;
|
|
44
|
+
validateFiles(): this;
|
|
45
|
+
validating: boolean;
|
|
46
|
+
validator: () => Validator;
|
|
47
|
+
withAllErrors(): this;
|
|
48
|
+
withoutFileValidation(): this;
|
|
49
|
+
setErrors(errors: FormDataErrors<TForm> | Record<string, string | string[]>): this;
|
|
50
|
+
forgetError<K extends FormDataKeys<TForm> | NamedInputEvent>(field: K): this;
|
|
51
|
+
}
|
|
52
|
+
interface InternalPrecognitionState {
|
|
53
|
+
__touched: string[];
|
|
54
|
+
__valid: string[];
|
|
55
|
+
}
|
|
56
|
+
export type UseHttp<TForm extends object, TResponse = unknown> = TForm & UseHttpProps<TForm, TResponse>;
|
|
57
|
+
export type UseHttpPrecognitiveProps<TForm extends object, TResponse = unknown> = UseHttp<TForm, TResponse> & UseHttpValidationProps<TForm> & InternalPrecognitionState;
|
|
58
|
+
export default function useHttp<TForm extends FormDataType<TForm>, TResponse = unknown>(method: Method | (() => Method), url: string | (() => string), data: TForm | (() => TForm)): UseHttpPrecognitiveProps<TForm, TResponse>;
|
|
59
|
+
export default function useHttp<TForm extends FormDataType<TForm>, TResponse = unknown>(urlMethodPair: UrlMethodPair | (() => UrlMethodPair), data: TForm | (() => TForm)): UseHttpPrecognitiveProps<TForm, TResponse>;
|
|
60
|
+
export default function useHttp<TForm extends FormDataType<TForm>, TResponse = unknown>(rememberKey: string, data: TForm | (() => TForm)): UseHttp<TForm, TResponse>;
|
|
61
|
+
export default function useHttp<TForm extends FormDataType<TForm>, TResponse = unknown>(data: TForm | (() => TForm)): UseHttp<TForm, TResponse>;
|
|
62
|
+
export default function useHttp<TForm extends FormDataType<TForm>, TResponse = unknown>(): UseHttp<TForm, TResponse>;
|
|
63
|
+
export {};
|