@inertiajs/core 2.0.16 → 2.1.0
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.esm.js +57 -6
- package/dist/index.esm.js.map +4 -4
- package/dist/index.js +57 -6
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/types/formObject.d.ts +5 -0
- package/types/index.d.ts +2 -0
- package/types/types.d.ts +28 -0
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Router } from './router';
|
|
2
|
+
export { objectToFormData } from './formData';
|
|
3
|
+
export { formDataToObject } from './formObject';
|
|
2
4
|
export { default as createHeadManager } from './head';
|
|
3
5
|
export { hide as hideProgress, reveal as revealProgress, default as setupProgress } from './progress';
|
|
4
6
|
export { default as shouldIntercept } from './shouldIntercept';
|
package/types/types.d.ts
CHANGED
|
@@ -263,6 +263,34 @@ export type ProgressSettings = {
|
|
|
263
263
|
includeCSS: boolean;
|
|
264
264
|
color: string;
|
|
265
265
|
};
|
|
266
|
+
export type FormComponentOptions = Pick<VisitOptions, 'preserveScroll' | 'preserveState' | 'preserveUrl' | 'replace' | 'only' | 'except' | 'reset'>;
|
|
267
|
+
export type FormComponentProps = Partial<Pick<Visit, 'method' | 'headers' | 'queryStringArrayFormat' | 'errorBag' | 'showProgress'> & Omit<VisitCallbacks, 'onPrefetched' | 'onPrefetching'>> & {
|
|
268
|
+
action?: string | {
|
|
269
|
+
url: string;
|
|
270
|
+
method: Method;
|
|
271
|
+
};
|
|
272
|
+
transform?: (data: Record<string, FormDataConvertible>) => Record<string, FormDataConvertible>;
|
|
273
|
+
options?: FormComponentOptions;
|
|
274
|
+
};
|
|
275
|
+
export type FormComponentMethods = {
|
|
276
|
+
clearErrors: (...fields: string[]) => void;
|
|
277
|
+
resetAndClearErrors: (...fields: string[]) => void;
|
|
278
|
+
setError(field: string, value: string): void;
|
|
279
|
+
setError(errors: Record<string, string>): void;
|
|
280
|
+
reset: () => void;
|
|
281
|
+
submit: () => void;
|
|
282
|
+
};
|
|
283
|
+
export type FormComponentState = {
|
|
284
|
+
errors: Record<string, string>;
|
|
285
|
+
hasErrors: boolean;
|
|
286
|
+
processing: boolean;
|
|
287
|
+
progress: Progress | null;
|
|
288
|
+
wasSuccessful: boolean;
|
|
289
|
+
recentlySuccessful: boolean;
|
|
290
|
+
isDirty: boolean;
|
|
291
|
+
};
|
|
292
|
+
export type FormComponentSlotProps = FormComponentMethods & FormComponentState;
|
|
293
|
+
export type FormComponentRef = FormComponentSlotProps;
|
|
266
294
|
declare global {
|
|
267
295
|
interface DocumentEventMap {
|
|
268
296
|
'inertia:before': GlobalEvent<'before'>;
|