@customafk/lunas-ui 0.2.55 → 0.2.56
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/features/tanstack-form/index.cjs +1 -1
- package/dist/features/tanstack-form/index.d.cts +1 -1
- package/dist/features/tanstack-form/index.d.mts +1 -1
- package/dist/features/tanstack-form/index.mjs +1 -1
- package/dist/{index-COLxGpG6.d.cts → index-BBViMxM1.d.cts} +304 -811
- package/dist/{index-COLxGpG6.d.mts → index-BBViMxM1.d.mts} +304 -811
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/tanstack-form-BqyVDyuQ.mjs +42 -0
- package/dist/tanstack-form-BqyVDyuQ.mjs.map +1 -0
- package/dist/tanstack-form-C3QvfUAO.cjs +42 -0
- package/dist/tanstack-form-C3QvfUAO.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/tanstack-form-CVnMirZT.cjs +0 -42
- package/dist/tanstack-form-CVnMirZT.cjs.map +0 -1
- package/dist/tanstack-form-Dl6pl0mL.mjs +0 -42
- package/dist/tanstack-form-Dl6pl0mL.mjs.map +0 -1
|
@@ -220,104 +220,7 @@ type AnyFieldProps = ({
|
|
|
220
220
|
/** The `fieldType` discriminant extracted from {@link AnyFieldProps}. */
|
|
221
221
|
type FieldType = AnyFieldProps['fieldType'];
|
|
222
222
|
//#endregion
|
|
223
|
-
//#region node_modules/@tanstack/
|
|
224
|
-
type TStandardSchemaValidatorValue<TData, TSource extends ValidationSource = ValidationSource> = {
|
|
225
|
-
value: TData;
|
|
226
|
-
validationSource: TSource;
|
|
227
|
-
};
|
|
228
|
-
/**
|
|
229
|
-
* The Standard Schema interface.
|
|
230
|
-
*/
|
|
231
|
-
type StandardSchemaV1<Input = unknown, Output = Input> = {
|
|
232
|
-
/**
|
|
233
|
-
* The Standard Schema properties.
|
|
234
|
-
*/
|
|
235
|
-
readonly '~standard': StandardSchemaV1Props<Input, Output>;
|
|
236
|
-
};
|
|
237
|
-
/**
|
|
238
|
-
* The Standard Schema properties interface.
|
|
239
|
-
*/
|
|
240
|
-
interface StandardSchemaV1Props<Input = unknown, Output = Input> {
|
|
241
|
-
/**
|
|
242
|
-
* The version number of the standard.
|
|
243
|
-
*/
|
|
244
|
-
readonly version: 1;
|
|
245
|
-
/**
|
|
246
|
-
* The vendor name of the schema library.
|
|
247
|
-
*/
|
|
248
|
-
readonly vendor: string;
|
|
249
|
-
/**
|
|
250
|
-
* Validates unknown input values.
|
|
251
|
-
*/
|
|
252
|
-
readonly validate: (value: unknown) => StandardSchemaV1Result<Output> | Promise<StandardSchemaV1Result<Output>>;
|
|
253
|
-
/**
|
|
254
|
-
* Inferred types associated with the schema.
|
|
255
|
-
*/
|
|
256
|
-
readonly types?: StandardSchemaV1Types<Input, Output> | undefined;
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* The result interface of the validate function.
|
|
260
|
-
*/
|
|
261
|
-
type StandardSchemaV1Result<Output> = StandardSchemaV1SuccessResult<Output> | StandardSchemaV1FailureResult;
|
|
262
|
-
/**
|
|
263
|
-
* The result interface if validation succeeds.
|
|
264
|
-
*/
|
|
265
|
-
interface StandardSchemaV1SuccessResult<Output> {
|
|
266
|
-
/**
|
|
267
|
-
* The typed output value.
|
|
268
|
-
*/
|
|
269
|
-
readonly value: Output;
|
|
270
|
-
/**
|
|
271
|
-
* The non-existent issues.
|
|
272
|
-
*/
|
|
273
|
-
readonly issues?: undefined;
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* The result interface if validation fails.
|
|
277
|
-
*/
|
|
278
|
-
interface StandardSchemaV1FailureResult {
|
|
279
|
-
/**
|
|
280
|
-
* The issues of failed validation.
|
|
281
|
-
*/
|
|
282
|
-
readonly issues: ReadonlyArray<StandardSchemaV1Issue>;
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* The issue interface of the failure output.
|
|
286
|
-
*/
|
|
287
|
-
interface StandardSchemaV1Issue {
|
|
288
|
-
/**
|
|
289
|
-
* The error message of the issue.
|
|
290
|
-
*/
|
|
291
|
-
readonly message: string;
|
|
292
|
-
/**
|
|
293
|
-
* The path of the issue, if any.
|
|
294
|
-
*/
|
|
295
|
-
readonly path?: ReadonlyArray<PropertyKey | StandardSchemaV1PathSegment> | undefined;
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* The path segment interface of the issue.
|
|
299
|
-
*/
|
|
300
|
-
interface StandardSchemaV1PathSegment {
|
|
301
|
-
/**
|
|
302
|
-
* The key representing a path segment.
|
|
303
|
-
*/
|
|
304
|
-
readonly key: PropertyKey;
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* The Standard Schema types interface.
|
|
308
|
-
*/
|
|
309
|
-
interface StandardSchemaV1Types<Input = unknown, Output = Input> {
|
|
310
|
-
/**
|
|
311
|
-
* The input type of the schema.
|
|
312
|
-
*/
|
|
313
|
-
readonly input: Input;
|
|
314
|
-
/**
|
|
315
|
-
* The output type of the schema.
|
|
316
|
-
*/
|
|
317
|
-
readonly output: Output;
|
|
318
|
-
}
|
|
319
|
-
//#endregion
|
|
320
|
-
//#region node_modules/@tanstack/store/dist/types.d.ts
|
|
223
|
+
//#region node_modules/@tanstack/store/dist/esm/types.d.ts
|
|
321
224
|
type Observer<T> = {
|
|
322
225
|
next?: (value: T) => void;
|
|
323
226
|
error?: (err: unknown) => void;
|
|
@@ -327,27 +230,17 @@ interface Subscription {
|
|
|
327
230
|
unsubscribe: () => void;
|
|
328
231
|
}
|
|
329
232
|
//#endregion
|
|
330
|
-
//#region node_modules/@tanstack/store/dist/store.d.ts
|
|
331
|
-
|
|
332
|
-
type StoreAction = (...args: Array<any>) => any;
|
|
333
|
-
type StoreActionMap = Record<string, StoreAction>;
|
|
334
|
-
type StoreActionsFactory<T, TActions extends StoreActionMap> = (store: {
|
|
335
|
-
setState: Store<T>['setState'];
|
|
336
|
-
get: Store<T>['get'];
|
|
337
|
-
}) => TActions;
|
|
338
|
-
type NonFunction<T> = T extends ((...args: Array<any>) => any) ? never : T;
|
|
339
|
-
declare class Store<T, TActions extends StoreActionMap = never> {
|
|
233
|
+
//#region node_modules/@tanstack/store/dist/esm/store.d.ts
|
|
234
|
+
declare class Store<T> {
|
|
340
235
|
private atom;
|
|
341
|
-
readonly actions: TActions;
|
|
342
236
|
constructor(getValue: (prev?: NoInfer<T>) => T);
|
|
343
237
|
constructor(initialValue: T);
|
|
344
|
-
constructor(initialValue: NonFunction<T>, actionsFactory: StoreActionsFactory<T, TActions>);
|
|
345
238
|
setState(updater: (prev: T) => T): void;
|
|
346
239
|
get state(): T;
|
|
347
240
|
get(): T;
|
|
348
241
|
subscribe(observerOrFn: Observer<T> | ((value: T) => void)): Subscription;
|
|
349
242
|
}
|
|
350
|
-
declare class ReadonlyStore<T> implements Omit<Store<T>, 'setState'
|
|
243
|
+
declare class ReadonlyStore<T> implements Omit<Store<T>, 'setState'> {
|
|
351
244
|
private atom;
|
|
352
245
|
constructor(getValue: (prev?: NoInfer<T>) => T);
|
|
353
246
|
constructor(initialValue: T);
|
|
@@ -356,19 +249,31 @@ declare class ReadonlyStore<T> implements Omit<Store<T>, 'setState' | 'actions'>
|
|
|
356
249
|
subscribe(observerOrFn: Observer<T> | ((value: T) => void)): Subscription;
|
|
357
250
|
}
|
|
358
251
|
//#endregion
|
|
252
|
+
//#region node_modules/@tanstack/form-core/dist/esm/ValidationLogic.d.ts
|
|
253
|
+
interface ValidationLogicValidatorsFn {
|
|
254
|
+
fn: FormValidators<any, any, any, any, any, any, any, any, any, any>[keyof FormValidators<any, any, any, any, any, any, any, any, any, any>];
|
|
255
|
+
cause: 'change' | 'blur' | 'submit' | 'mount' | 'server' | 'dynamic';
|
|
256
|
+
}
|
|
257
|
+
interface ValidationLogicProps {
|
|
258
|
+
form: AnyFormApi;
|
|
259
|
+
validators: FormValidators<any, any, any, any, any, any, any, any, any, any> | undefined | null;
|
|
260
|
+
event: {
|
|
261
|
+
type: 'blur' | 'change' | 'submit' | 'mount' | 'server';
|
|
262
|
+
fieldName?: string;
|
|
263
|
+
async: boolean;
|
|
264
|
+
};
|
|
265
|
+
runValidation: (props: {
|
|
266
|
+
validators: Array<ValidationLogicValidatorsFn | undefined>;
|
|
267
|
+
form: AnyFormApi;
|
|
268
|
+
}) => void;
|
|
269
|
+
}
|
|
270
|
+
type ValidationLogicFn = (props: ValidationLogicProps) => void;
|
|
271
|
+
//#endregion
|
|
359
272
|
//#region node_modules/@tanstack/form-core/dist/esm/util-types.d.ts
|
|
360
273
|
/**
|
|
361
274
|
* @private
|
|
362
275
|
*/
|
|
363
276
|
type UnwrapOneLevelOfArray<T> = T extends (infer U)[] ? U : T;
|
|
364
|
-
/**
|
|
365
|
-
* @private
|
|
366
|
-
* Helper type that rejects synchronous validators that return Promises.
|
|
367
|
-
* If the validator is a function returning a Promise, the type becomes `never`.
|
|
368
|
-
* Uses infer to extract the return type and handles `any` specially to avoid
|
|
369
|
-
* rejecting mock functions and other uses of `any`.
|
|
370
|
-
*/
|
|
371
|
-
type RejectPromiseValidator<T> = T extends ((...args: any[]) => infer R) ? 0 extends 1 & R ? T : [R] extends [Promise<any> | PromiseLike<any>] ? never : T : T;
|
|
372
277
|
interface AnyDeepKeyAndValue<K extends string = string, V extends any = any> {
|
|
373
278
|
key: K;
|
|
374
279
|
value: V;
|
|
@@ -426,6 +331,10 @@ type UpdaterFn<TInput, TOutput = TInput> = (input: TInput) => TOutput;
|
|
|
426
331
|
type Updater<TInput, TOutput = TInput> = TOutput | UpdaterFn<TInput, TOutput>;
|
|
427
332
|
//#endregion
|
|
428
333
|
//#region node_modules/@tanstack/form-core/dist/esm/FieldApi.d.ts
|
|
334
|
+
/**
|
|
335
|
+
* @private
|
|
336
|
+
*/
|
|
337
|
+
type FieldErrorMapFromValidator<TFormData, TName extends DeepKeys<TFormData>, TData extends DeepValue<TFormData, TName>, TOnMount extends undefined | FieldValidateOrFn<TFormData, TName, TData>, TOnChange extends undefined | FieldValidateOrFn<TFormData, TName, TData>, TOnChangeAsync extends undefined | FieldAsyncValidateOrFn<TFormData, TName, TData>, TOnBlur extends undefined | FieldValidateOrFn<TFormData, TName, TData>, TOnBlurAsync extends undefined | FieldAsyncValidateOrFn<TFormData, TName, TData>, TOnSubmit extends undefined | FieldValidateOrFn<TFormData, TName, TData>, TOnSubmitAsync extends undefined | FieldAsyncValidateOrFn<TFormData, TName, TData>> = Partial<Record<DeepKeys<TFormData>, ValidationErrorMap<TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync>>>;
|
|
429
338
|
/**
|
|
430
339
|
* @private
|
|
431
340
|
*/
|
|
@@ -433,6 +342,19 @@ type FieldValidateFn<TParentData, TName extends DeepKeys<TParentData>, TData ext
|
|
|
433
342
|
value: TData;
|
|
434
343
|
fieldApi: FieldApi<TParentData, TName, TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
435
344
|
}) => unknown;
|
|
345
|
+
/**
|
|
346
|
+
* @private
|
|
347
|
+
*/
|
|
348
|
+
type FieldValidateOrFn<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName> = DeepValue<TParentData, TName>> = FieldValidateFn<TParentData, TName, TData> | StandardSchemaV1<TData, unknown>;
|
|
349
|
+
type StandardBrandedSchemaV1<T> = T & {
|
|
350
|
+
__standardSchemaV1: true;
|
|
351
|
+
};
|
|
352
|
+
type UnwrapFormValidateOrFnForInner<TValidateOrFn extends undefined | FormValidateOrFn<any>> = [TValidateOrFn] extends [FormValidateFn<any>] ? ReturnType<TValidateOrFn> : [TValidateOrFn] extends [StandardSchemaV1<infer TOut, any>] ? StandardBrandedSchemaV1<TOut> : undefined;
|
|
353
|
+
type UnwrapFieldValidateOrFn<TName extends string, TValidateOrFn extends undefined | FieldValidateOrFn<any, any, any>, TFormValidateOrFn extends undefined | FormValidateOrFn<any>> = ([TFormValidateOrFn] extends [StandardSchemaV1<any, infer TStandardOut>] ? TName extends keyof TStandardOut ? StandardSchemaV1Issue[] : undefined : undefined) | (UnwrapFormValidateOrFnForInner<TFormValidateOrFn> extends infer TFormValidateVal ? TFormValidateVal extends {
|
|
354
|
+
__standardSchemaV1: true;
|
|
355
|
+
} ? [DeepValue<TFormValidateVal, TName>] extends [never] ? undefined : StandardSchemaV1Issue[] : TFormValidateVal extends {
|
|
356
|
+
fields: any;
|
|
357
|
+
} ? TName extends keyof TFormValidateVal['fields'] ? TFormValidateVal['fields'][TName] : undefined : undefined : never) | ([TValidateOrFn] extends [FieldValidateFn<any, any, any>] ? ReturnType<TValidateOrFn> : [TValidateOrFn] extends [StandardSchemaV1<any, any>] ? StandardSchemaV1Issue[] : undefined);
|
|
436
358
|
/**
|
|
437
359
|
* @private
|
|
438
360
|
*/
|
|
@@ -441,6 +363,16 @@ type FieldValidateAsyncFn<TParentData, TName extends DeepKeys<TParentData>, TDat
|
|
|
441
363
|
fieldApi: FieldApi<TParentData, TName, TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
442
364
|
signal: AbortSignal;
|
|
443
365
|
}) => unknown | Promise<unknown>;
|
|
366
|
+
/**
|
|
367
|
+
* @private
|
|
368
|
+
*/
|
|
369
|
+
type FieldAsyncValidateOrFn<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName> = DeepValue<TParentData, TName>> = FieldValidateAsyncFn<TParentData, TName, TData> | StandardSchemaV1<TData, unknown>;
|
|
370
|
+
type UnwrapFormAsyncValidateOrFnForInner<TValidateOrFn extends undefined | FormAsyncValidateOrFn<any>> = [TValidateOrFn] extends [FormValidateAsyncFn<any>] ? Awaited<ReturnType<TValidateOrFn>> : [TValidateOrFn] extends [StandardSchemaV1<infer TOut, any>] ? StandardBrandedSchemaV1<TOut> : undefined;
|
|
371
|
+
type UnwrapFieldAsyncValidateOrFn<TName extends string, TValidateOrFn extends undefined | FieldAsyncValidateOrFn<any, any, any>, TFormValidateOrFn extends undefined | FormAsyncValidateOrFn<any>> = ([TFormValidateOrFn] extends [StandardSchemaV1<any, infer TStandardOut>] ? TName extends keyof TStandardOut ? StandardSchemaV1Issue[] : undefined : undefined) | (UnwrapFormAsyncValidateOrFnForInner<TFormValidateOrFn> extends infer TFormValidateVal ? TFormValidateVal extends {
|
|
372
|
+
__standardSchemaV1: true;
|
|
373
|
+
} ? [DeepValue<TFormValidateVal, TName>] extends [never] ? undefined : StandardSchemaV1Issue[] : TFormValidateVal extends {
|
|
374
|
+
fields: any;
|
|
375
|
+
} ? TName extends keyof TFormValidateVal['fields'] ? TFormValidateVal['fields'][TName] : undefined : undefined : never) | ([TValidateOrFn] extends [FieldValidateAsyncFn<any, any, any>] ? Awaited<ReturnType<TValidateOrFn>> : [TValidateOrFn] extends [StandardSchemaV1<any, any>] ? StandardSchemaV1Issue[] : undefined);
|
|
444
376
|
/**
|
|
445
377
|
* @private
|
|
446
378
|
*/
|
|
@@ -448,25 +380,17 @@ type FieldListenerFn<TParentData, TName extends DeepKeys<TParentData>, TData ext
|
|
|
448
380
|
value: TData;
|
|
449
381
|
fieldApi: FieldApi<TParentData, TName, TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
450
382
|
}) => void;
|
|
451
|
-
/**
|
|
452
|
-
* @private
|
|
453
|
-
*/
|
|
454
|
-
type FieldValidateOrFn<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName> = DeepValue<TParentData, TName>> = FieldValidateFn<TParentData, TName, TData> | StandardSchemaV1<TData, unknown>;
|
|
455
|
-
/**
|
|
456
|
-
* @private
|
|
457
|
-
*/
|
|
458
|
-
type FieldAsyncValidateOrFn<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName> = DeepValue<TParentData, TName>> = FieldValidateAsyncFn<TParentData, TName, TData> | StandardSchemaV1<TData, unknown>;
|
|
459
383
|
interface FieldValidators<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName>, TOnMount extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnChange extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnChangeAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnBlur extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnBlurAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnSubmit extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnSubmitAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnDynamic extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnDynamicAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>> {
|
|
460
384
|
/**
|
|
461
385
|
* An optional function, that runs on the mount event of input.
|
|
462
386
|
*/
|
|
463
|
-
onMount?:
|
|
387
|
+
onMount?: TOnMount;
|
|
464
388
|
/**
|
|
465
389
|
* An optional function, that runs on the change event of input.
|
|
466
390
|
*
|
|
467
391
|
* @example z.string().min(1)
|
|
468
392
|
*/
|
|
469
|
-
onChange?:
|
|
393
|
+
onChange?: TOnChange;
|
|
470
394
|
/**
|
|
471
395
|
* An optional property similar to `onChange` but async validation
|
|
472
396
|
*
|
|
@@ -488,7 +412,7 @@ interface FieldValidators<TParentData, TName extends DeepKeys<TParentData>, TDat
|
|
|
488
412
|
*
|
|
489
413
|
* @example z.string().min(1)
|
|
490
414
|
*/
|
|
491
|
-
onBlur?:
|
|
415
|
+
onBlur?: TOnBlur;
|
|
492
416
|
/**
|
|
493
417
|
* An optional property similar to `onBlur` but async validation.
|
|
494
418
|
*
|
|
@@ -510,14 +434,14 @@ interface FieldValidators<TParentData, TName extends DeepKeys<TParentData>, TDat
|
|
|
510
434
|
*
|
|
511
435
|
* @example z.string().min(1)
|
|
512
436
|
*/
|
|
513
|
-
onSubmit?:
|
|
437
|
+
onSubmit?: TOnSubmit;
|
|
514
438
|
/**
|
|
515
439
|
* An optional property similar to `onSubmit` but async validation.
|
|
516
440
|
*
|
|
517
441
|
* @example z.string().refine(async (val) => val.length > 3, { message: 'Testing 123' })
|
|
518
442
|
*/
|
|
519
443
|
onSubmitAsync?: TOnSubmitAsync;
|
|
520
|
-
onDynamic?:
|
|
444
|
+
onDynamic?: TOnDynamic;
|
|
521
445
|
onDynamicAsync?: TOnDynamicAsync;
|
|
522
446
|
onDynamicAsyncDebounceMs?: number;
|
|
523
447
|
}
|
|
@@ -529,22 +453,113 @@ interface FieldListeners<TParentData, TName extends DeepKeys<TParentData>, TData
|
|
|
529
453
|
onMount?: FieldListenerFn<TParentData, TName, TData>;
|
|
530
454
|
onUnmount?: FieldListenerFn<TParentData, TName, TData>;
|
|
531
455
|
onSubmit?: FieldListenerFn<TParentData, TName, TData>;
|
|
532
|
-
onGroupSubmit?: FieldListenerFn<TParentData, TName, TData>;
|
|
533
456
|
}
|
|
534
|
-
|
|
457
|
+
/**
|
|
458
|
+
* An object type representing the options for a field in a form.
|
|
459
|
+
*/
|
|
460
|
+
interface FieldOptions<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName>, TOnMount extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnChange extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnChangeAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnBlur extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnBlurAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnSubmit extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnSubmitAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnDynamic extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnDynamicAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>> {
|
|
461
|
+
/**
|
|
462
|
+
* The field name. The type will be `DeepKeys<TParentData>` to ensure your name is a deep key of the parent dataset.
|
|
463
|
+
*/
|
|
464
|
+
name: TName;
|
|
465
|
+
/**
|
|
466
|
+
* An optional default value for the field.
|
|
467
|
+
*/
|
|
468
|
+
defaultValue?: NoInfer<TData>;
|
|
469
|
+
/**
|
|
470
|
+
* The default time to debounce async validation if there is not a more specific debounce time passed.
|
|
471
|
+
*/
|
|
472
|
+
asyncDebounceMs?: number;
|
|
473
|
+
/**
|
|
474
|
+
* If `true`, always run async validation, even if there are errors emitted during synchronous validation.
|
|
475
|
+
*/
|
|
476
|
+
asyncAlways?: boolean;
|
|
535
477
|
/**
|
|
536
478
|
* A list of validators to pass to the field
|
|
537
479
|
*/
|
|
538
480
|
validators?: FieldValidators<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync>;
|
|
481
|
+
/**
|
|
482
|
+
* An optional object with default metadata for the field.
|
|
483
|
+
*/
|
|
484
|
+
defaultMeta?: Partial<FieldMeta<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, any, any, any, any, any, any, any, any, any>>;
|
|
539
485
|
/**
|
|
540
486
|
* A list of listeners which attach to the corresponding events
|
|
541
487
|
*/
|
|
542
488
|
listeners?: FieldListeners<TParentData, TName, TData>;
|
|
489
|
+
/**
|
|
490
|
+
* Disable the `flat(1)` operation on `field.errors`. This is useful if you want to keep the error structure as is. Not suggested for most use-cases.
|
|
491
|
+
*/
|
|
492
|
+
disableErrorFlat?: boolean;
|
|
543
493
|
}
|
|
544
494
|
/**
|
|
545
|
-
* An object type representing the options for
|
|
495
|
+
* An object type representing the required options for the FieldApi class.
|
|
496
|
+
*/
|
|
497
|
+
interface FieldApiOptions<in out TParentData, in out TName extends DeepKeys<TParentData>, in out TData extends DeepValue<TParentData, TName>, in out TOnMount extends undefined | FieldValidateOrFn<TParentData, TName, TData>, in out TOnChange extends undefined | FieldValidateOrFn<TParentData, TName, TData>, in out TOnChangeAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, in out TOnBlur extends undefined | FieldValidateOrFn<TParentData, TName, TData>, in out TOnBlurAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, in out TOnSubmit extends undefined | FieldValidateOrFn<TParentData, TName, TData>, in out TOnSubmitAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, in out TOnDynamic extends undefined | FieldValidateOrFn<TParentData, TName, TData>, in out TOnDynamicAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, in out TFormOnMount extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChange extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChangeAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnBlur extends undefined | FormValidateOrFn<TParentData>, in out TFormOnBlurAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnSubmit extends undefined | FormValidateOrFn<TParentData>, in out TFormOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnDynamic extends undefined | FormValidateOrFn<TParentData>, in out TFormOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnServer extends undefined | FormAsyncValidateOrFn<TParentData>, in out TParentSubmitMeta> extends FieldOptions<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync> {
|
|
498
|
+
form: FormApi<TParentData, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>;
|
|
499
|
+
}
|
|
500
|
+
type FieldMetaBase<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName>, TOnMount extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnChange extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnChangeAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnBlur extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnBlurAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnSubmit extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnSubmitAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnDynamic extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnDynamicAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TFormOnMount extends undefined | FormValidateOrFn<TParentData>, TFormOnChange extends undefined | FormValidateOrFn<TParentData>, TFormOnChangeAsync extends undefined | FormAsyncValidateOrFn<TParentData>, TFormOnBlur extends undefined | FormValidateOrFn<TParentData>, TFormOnBlurAsync extends undefined | FormAsyncValidateOrFn<TParentData>, TFormOnSubmit extends undefined | FormValidateOrFn<TParentData>, TFormOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TParentData>, TFormOnDynamic extends undefined | FormValidateOrFn<TParentData>, TFormOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TParentData>> = {
|
|
501
|
+
/**
|
|
502
|
+
* A flag indicating whether the field has been touched.
|
|
503
|
+
*/
|
|
504
|
+
isTouched: boolean;
|
|
505
|
+
/**
|
|
506
|
+
* A flag indicating whether the field has been blurred.
|
|
507
|
+
*/
|
|
508
|
+
isBlurred: boolean;
|
|
509
|
+
/**
|
|
510
|
+
* A flag that is `true` if the field's value has been modified by the user. Opposite of `isPristine`.
|
|
511
|
+
*/
|
|
512
|
+
isDirty: boolean;
|
|
513
|
+
/**
|
|
514
|
+
* A map of errors related to the field value.
|
|
515
|
+
*/
|
|
516
|
+
errorMap: ValidationErrorMap<UnwrapFieldValidateOrFn<TName, TOnMount, TFormOnMount>, UnwrapFieldValidateOrFn<TName, TOnChange, TFormOnChange>, UnwrapFieldAsyncValidateOrFn<TName, TOnChangeAsync, TFormOnChangeAsync>, UnwrapFieldValidateOrFn<TName, TOnBlur, TFormOnBlur>, UnwrapFieldAsyncValidateOrFn<TName, TOnBlurAsync, TFormOnBlurAsync>, UnwrapFieldValidateOrFn<TName, TOnSubmit, TFormOnSubmit>, UnwrapFieldAsyncValidateOrFn<TName, TOnSubmitAsync, TFormOnSubmitAsync>, UnwrapFieldValidateOrFn<TName, TOnDynamic, TFormOnDynamic>, UnwrapFieldAsyncValidateOrFn<TName, TOnDynamicAsync, TFormOnDynamicAsync>>;
|
|
517
|
+
/**
|
|
518
|
+
* @private allows tracking the source of the errors in the error map
|
|
519
|
+
*/
|
|
520
|
+
errorSourceMap: ValidationErrorMapSource;
|
|
521
|
+
/**
|
|
522
|
+
* A flag indicating whether the field is currently being validated.
|
|
523
|
+
*/
|
|
524
|
+
isValidating: boolean;
|
|
525
|
+
};
|
|
526
|
+
type AnyFieldMetaBase = FieldMetaBase<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
527
|
+
type FieldMetaDerived<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName>, TOnMount extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnChange extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnChangeAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnBlur extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnBlurAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnSubmit extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnSubmitAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnDynamic extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnDynamicAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TFormOnMount extends undefined | FormValidateOrFn<TParentData>, TFormOnChange extends undefined | FormValidateOrFn<TParentData>, TFormOnChangeAsync extends undefined | FormAsyncValidateOrFn<TParentData>, TFormOnBlur extends undefined | FormValidateOrFn<TParentData>, TFormOnBlurAsync extends undefined | FormAsyncValidateOrFn<TParentData>, TFormOnSubmit extends undefined | FormValidateOrFn<TParentData>, TFormOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TParentData>, TFormOnDynamic extends undefined | FormValidateOrFn<TParentData>, TFormOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TParentData>> = {
|
|
528
|
+
/**
|
|
529
|
+
* An array of errors related to the field value.
|
|
530
|
+
*/
|
|
531
|
+
errors: Array<UnwrapOneLevelOfArray<UnwrapFieldValidateOrFn<TName, TOnMount, TFormOnMount>> | UnwrapOneLevelOfArray<UnwrapFieldValidateOrFn<TName, TOnChange, TFormOnChange>> | UnwrapOneLevelOfArray<UnwrapFieldAsyncValidateOrFn<TName, TOnChangeAsync, TFormOnChangeAsync>> | UnwrapOneLevelOfArray<UnwrapFieldValidateOrFn<TName, TOnBlur, TFormOnBlur>> | UnwrapOneLevelOfArray<UnwrapFieldAsyncValidateOrFn<TName, TOnBlurAsync, TFormOnBlurAsync>> | UnwrapOneLevelOfArray<UnwrapFieldValidateOrFn<TName, TOnSubmit, TFormOnSubmit>> | UnwrapOneLevelOfArray<UnwrapFieldAsyncValidateOrFn<TName, TOnSubmitAsync, TFormOnSubmitAsync>> | UnwrapOneLevelOfArray<UnwrapFieldValidateOrFn<TName, TOnDynamic, TFormOnDynamic>> | UnwrapOneLevelOfArray<UnwrapFieldAsyncValidateOrFn<TName, TOnDynamicAsync, TFormOnDynamicAsync>>>;
|
|
532
|
+
/**
|
|
533
|
+
* A flag that is `true` if the field's value has not been modified by the user. Opposite of `isDirty`.
|
|
534
|
+
*/
|
|
535
|
+
isPristine: boolean;
|
|
536
|
+
/**
|
|
537
|
+
* A boolean indicating if the field is valid. Evaluates `true` if there are no field errors.
|
|
538
|
+
*/
|
|
539
|
+
isValid: boolean;
|
|
540
|
+
/**
|
|
541
|
+
* A flag indicating whether the field's current value is the default value
|
|
542
|
+
*/
|
|
543
|
+
isDefaultValue: boolean;
|
|
544
|
+
};
|
|
545
|
+
/**
|
|
546
|
+
* An object type representing the metadata of a field in a form.
|
|
547
|
+
*/
|
|
548
|
+
type FieldMeta<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName>, TOnMount extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnChange extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnChangeAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnBlur extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnBlurAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnSubmit extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnSubmitAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnDynamic extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnDynamicAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TFormOnMount extends undefined | FormValidateOrFn<TParentData>, TFormOnChange extends undefined | FormValidateOrFn<TParentData>, TFormOnChangeAsync extends undefined | FormAsyncValidateOrFn<TParentData>, TFormOnBlur extends undefined | FormValidateOrFn<TParentData>, TFormOnBlurAsync extends undefined | FormAsyncValidateOrFn<TParentData>, TFormOnSubmit extends undefined | FormValidateOrFn<TParentData>, TFormOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TParentData>, TFormOnDynamic extends undefined | FormValidateOrFn<TParentData>, TFormOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TParentData>> = FieldMetaBase<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync> & FieldMetaDerived<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>;
|
|
549
|
+
type AnyFieldMeta = FieldMeta<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
550
|
+
/**
|
|
551
|
+
* An object type representing the state of a field.
|
|
546
552
|
*/
|
|
547
|
-
|
|
553
|
+
type FieldState<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName>, TOnMount extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnChange extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnChangeAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnBlur extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnBlurAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnSubmit extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnSubmitAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TOnDynamic extends undefined | FieldValidateOrFn<TParentData, TName, TData>, TOnDynamicAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, TFormOnMount extends undefined | FormValidateOrFn<TParentData>, TFormOnChange extends undefined | FormValidateOrFn<TParentData>, TFormOnChangeAsync extends undefined | FormAsyncValidateOrFn<TParentData>, TFormOnBlur extends undefined | FormValidateOrFn<TParentData>, TFormOnBlurAsync extends undefined | FormAsyncValidateOrFn<TParentData>, TFormOnSubmit extends undefined | FormValidateOrFn<TParentData>, TFormOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TParentData>, TFormOnDynamic extends undefined | FormValidateOrFn<TParentData>, TFormOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TParentData>> = {
|
|
554
|
+
/**
|
|
555
|
+
* The current value of the field.
|
|
556
|
+
*/
|
|
557
|
+
value: TData;
|
|
558
|
+
/**
|
|
559
|
+
* The current metadata of the field.
|
|
560
|
+
*/
|
|
561
|
+
meta: FieldMeta<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>;
|
|
562
|
+
};
|
|
548
563
|
/**
|
|
549
564
|
* @public
|
|
550
565
|
*
|
|
@@ -564,7 +579,7 @@ type AnyFieldApi = FieldApi<any, any, any, any, any, any, any, any, any, any, an
|
|
|
564
579
|
* However, if you need to create a new instance manually, you can do so by calling
|
|
565
580
|
* the `new FieldApi` constructor.
|
|
566
581
|
*/
|
|
567
|
-
declare class FieldApi<in out TParentData, in out TName extends DeepKeys<TParentData>, in out TData extends DeepValue<TParentData, TName>, in out TOnMount extends undefined | FieldValidateOrFn<TParentData, TName, TData>, in out TOnChange extends undefined | FieldValidateOrFn<TParentData, TName, TData>, in out TOnChangeAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, in out TOnBlur extends undefined | FieldValidateOrFn<TParentData, TName, TData>, in out TOnBlurAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, in out TOnSubmit extends undefined | FieldValidateOrFn<TParentData, TName, TData>, in out TOnSubmitAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, in out TOnDynamic extends undefined | FieldValidateOrFn<TParentData, TName, TData>, in out TOnDynamicAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, in out TFormOnMount extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChange extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChangeAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnBlur extends undefined | FormValidateOrFn<TParentData>, in out TFormOnBlurAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnSubmit extends undefined | FormValidateOrFn<TParentData>, in out TFormOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnDynamic extends undefined | FormValidateOrFn<TParentData>, in out TFormOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnServer extends undefined | FormAsyncValidateOrFn<TParentData>, in out TParentSubmitMeta>
|
|
582
|
+
declare class FieldApi<in out TParentData, in out TName extends DeepKeys<TParentData>, in out TData extends DeepValue<TParentData, TName>, in out TOnMount extends undefined | FieldValidateOrFn<TParentData, TName, TData>, in out TOnChange extends undefined | FieldValidateOrFn<TParentData, TName, TData>, in out TOnChangeAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, in out TOnBlur extends undefined | FieldValidateOrFn<TParentData, TName, TData>, in out TOnBlurAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, in out TOnSubmit extends undefined | FieldValidateOrFn<TParentData, TName, TData>, in out TOnSubmitAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, in out TOnDynamic extends undefined | FieldValidateOrFn<TParentData, TName, TData>, in out TOnDynamicAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData>, in out TFormOnMount extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChange extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChangeAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnBlur extends undefined | FormValidateOrFn<TParentData>, in out TFormOnBlurAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnSubmit extends undefined | FormValidateOrFn<TParentData>, in out TFormOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnDynamic extends undefined | FormValidateOrFn<TParentData>, in out TFormOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnServer extends undefined | FormAsyncValidateOrFn<TParentData>, in out TParentSubmitMeta> {
|
|
568
583
|
/**
|
|
569
584
|
* A reference to the form API instance.
|
|
570
585
|
*/
|
|
@@ -580,11 +595,11 @@ declare class FieldApi<in out TParentData, in out TName extends DeepKeys<TParent
|
|
|
580
595
|
/**
|
|
581
596
|
* The field state store.
|
|
582
597
|
*/
|
|
583
|
-
store: ReadonlyStore<
|
|
598
|
+
store: ReadonlyStore<FieldState<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>>;
|
|
584
599
|
/**
|
|
585
600
|
* The current field state.
|
|
586
601
|
*/
|
|
587
|
-
get state():
|
|
602
|
+
get state(): FieldState<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>;
|
|
588
603
|
timeoutIds: {
|
|
589
604
|
validations: Record<ValidationCause, ReturnType<typeof setTimeout> | null>;
|
|
590
605
|
listeners: Record<ListenerCause, ReturnType<typeof setTimeout> | null>;
|
|
@@ -615,518 +630,99 @@ declare class FieldApi<in out TParentData, in out TName extends DeepKeys<TParent
|
|
|
615
630
|
update: (opts: FieldApiOptions<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>) => void;
|
|
616
631
|
/**
|
|
617
632
|
* Gets the current field value.
|
|
618
|
-
* @deprecated Use `field.state.value` instead.
|
|
619
|
-
*/
|
|
620
|
-
getValue: () => TData;
|
|
621
|
-
/**
|
|
622
|
-
* Sets the field value and run the `change` validator.
|
|
623
|
-
*/
|
|
624
|
-
setValue: (updater: Updater<TData>, options?: UpdateMetaOptions) => void;
|
|
625
|
-
getMeta: () => FieldLikeMeta<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>;
|
|
626
|
-
/**
|
|
627
|
-
* Sets the field metadata.
|
|
628
|
-
*/
|
|
629
|
-
setMeta: (updater: Updater<FieldLikeMetaBase<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>>) => void;
|
|
630
|
-
/**
|
|
631
|
-
* Gets the field information object.
|
|
632
|
-
*/
|
|
633
|
-
getInfo: () => FieldInfo<TParentData>;
|
|
634
|
-
/**
|
|
635
|
-
* Pushes a new value to the field.
|
|
636
|
-
*/
|
|
637
|
-
pushValue: (value: TData extends any[] ? TData[number] : never, options?: UpdateMetaOptions) => void;
|
|
638
|
-
/**
|
|
639
|
-
* Inserts a value at the specified index, shifting the subsequent values to the right.
|
|
640
|
-
*/
|
|
641
|
-
insertValue: (index: number, value: TData extends any[] ? TData[number] : never, options?: UpdateMetaOptions) => void;
|
|
642
|
-
/**
|
|
643
|
-
* Replaces a value at the specified index.
|
|
644
|
-
*/
|
|
645
|
-
replaceValue: (index: number, value: TData extends any[] ? TData[number] : never, options?: UpdateMetaOptions) => void;
|
|
646
|
-
/**
|
|
647
|
-
* Removes a value at the specified index.
|
|
648
|
-
*/
|
|
649
|
-
removeValue: (index: number, options?: UpdateMetaOptions) => void;
|
|
650
|
-
/**
|
|
651
|
-
* Swaps the values at the specified indices.
|
|
652
|
-
*/
|
|
653
|
-
swapValues: (aIndex: number, bIndex: number, options?: UpdateMetaOptions) => void;
|
|
654
|
-
/**
|
|
655
|
-
* Moves the value at the first specified index to the second specified index.
|
|
656
|
-
*/
|
|
657
|
-
moveValue: (aIndex: number, bIndex: number, options?: UpdateMetaOptions) => void;
|
|
658
|
-
/**
|
|
659
|
-
* Clear all values from the array.
|
|
660
|
-
*/
|
|
661
|
-
clearValues: (options?: UpdateMetaOptions) => void;
|
|
662
|
-
/**
|
|
663
|
-
* @private
|
|
664
|
-
*/
|
|
665
|
-
getLinkedFields: (cause: ValidationCause) => AnyFieldApi[];
|
|
666
|
-
/**
|
|
667
|
-
* @private
|
|
668
|
-
*/
|
|
669
|
-
validateSync: (cause: ValidationCause, errorFromForm: ValidationErrorMap) => {
|
|
670
|
-
hasErrored: boolean;
|
|
671
|
-
};
|
|
672
|
-
/**
|
|
673
|
-
* @private
|
|
674
|
-
*/
|
|
675
|
-
validateAsync: (cause: ValidationCause, formValidationResultPromise: Promise<FieldErrorMapFromValidator<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync>>) => Promise<unknown[]>;
|
|
676
|
-
/**
|
|
677
|
-
* Validates the field value.
|
|
678
|
-
*/
|
|
679
|
-
validate: (cause: ValidationCause, opts?: {
|
|
680
|
-
skipFormValidation?: boolean;
|
|
681
|
-
skipGroupValidation?: boolean;
|
|
682
|
-
}) => ValidationError[] | Promise<ValidationError[]>;
|
|
683
|
-
/**
|
|
684
|
-
* Handles the change event.
|
|
685
|
-
*/
|
|
686
|
-
handleChange: (updater: Updater<TData>) => void;
|
|
687
|
-
/**
|
|
688
|
-
* Handles the blur event.
|
|
689
|
-
*/
|
|
690
|
-
handleBlur: () => void;
|
|
691
|
-
/**
|
|
692
|
-
* Updates the field's errorMap
|
|
693
|
-
*/
|
|
694
|
-
setErrorMap: (errorMap: ValidationErrorMap<UnwrapFieldValidateOrFn<TName, TOnMount, TFormOnMount>, UnwrapFieldValidateOrFn<TName, TOnChange, TFormOnChange>, UnwrapFieldAsyncValidateOrFn<TName, TOnChangeAsync, TFormOnChangeAsync>, UnwrapFieldValidateOrFn<TName, TOnBlur, TFormOnBlur>, UnwrapFieldAsyncValidateOrFn<TName, TOnBlurAsync, TFormOnBlurAsync>, UnwrapFieldValidateOrFn<TName, TOnSubmit, TFormOnSubmit>, UnwrapFieldAsyncValidateOrFn<TName, TOnSubmitAsync, TFormOnSubmitAsync>, UnwrapFieldValidateOrFn<TName, TOnDynamic, TFormOnDynamic>, UnwrapFieldAsyncValidateOrFn<TName, TOnDynamicAsync, TFormOnDynamicAsync>>) => void;
|
|
695
|
-
/**
|
|
696
|
-
* Parses the field's value with the given schema and returns
|
|
697
|
-
* issues (if any). This method does NOT set any internal errors.
|
|
698
|
-
* @param schema The standard schema to parse this field's value with.
|
|
699
|
-
*/
|
|
700
|
-
parseValueWithSchema: (schema: StandardSchemaV1<TData, unknown>) => StandardSchemaV1Issue[] | undefined;
|
|
701
|
-
/**
|
|
702
|
-
* Parses the field's value with the given schema and returns
|
|
703
|
-
* issues (if any). This method does NOT set any internal errors.
|
|
704
|
-
* @param schema The standard schema to parse this field's value with.
|
|
705
|
-
*/
|
|
706
|
-
parseValueWithSchemaAsync: (schema: StandardSchemaV1<TData, unknown>) => Promise<StandardSchemaV1Issue[] | undefined>;
|
|
707
|
-
private triggerOnBlurListener;
|
|
708
|
-
/**
|
|
709
|
-
* @private
|
|
710
|
-
*/
|
|
711
|
-
triggerOnChangeListener: () => void;
|
|
712
|
-
/**
|
|
713
|
-
* @private
|
|
714
|
-
*/
|
|
715
|
-
triggerOnSubmitListener: () => void;
|
|
716
|
-
}
|
|
717
|
-
//#endregion
|
|
718
|
-
//#region node_modules/@tanstack/form-core/dist/esm/ValidationLogic.d.ts
|
|
719
|
-
interface ValidationLogicValidatorsFn {
|
|
720
|
-
fn: FormValidators<any, any, any, any, any, any, any, any, any, any>[keyof FormValidators<any, any, any, any, any, any, any, any, any, any>];
|
|
721
|
-
cause: 'change' | 'blur' | 'submit' | 'mount' | 'server' | 'dynamic';
|
|
722
|
-
}
|
|
723
|
-
interface ValidationLogicProps {
|
|
724
|
-
form: AnyFormApi;
|
|
725
|
-
/**
|
|
726
|
-
* Set when the validators being processed belong to a `FormGroupApi`.
|
|
727
|
-
* Allows validation strategies (e.g. `revalidateLogic`) to gate their
|
|
728
|
-
* behavior on the group's own state instead of the parent form's.
|
|
729
|
-
*/
|
|
730
|
-
group?: AnyFormGroupApi;
|
|
731
|
-
validators: FormValidators<any, any, any, any, any, any, any, any, any, any> | undefined | null;
|
|
732
|
-
event: {
|
|
733
|
-
type: 'blur' | 'change' | 'submit' | 'mount' | 'server';
|
|
734
|
-
fieldName?: string;
|
|
735
|
-
async: boolean;
|
|
736
|
-
};
|
|
737
|
-
runValidation: (props: {
|
|
738
|
-
validators: Array<ValidationLogicValidatorsFn | undefined>;
|
|
739
|
-
form: AnyFormApi;
|
|
740
|
-
}) => void;
|
|
741
|
-
}
|
|
742
|
-
type ValidationLogicFn = (props: ValidationLogicProps) => void;
|
|
743
|
-
//#endregion
|
|
744
|
-
//#region node_modules/@tanstack/form-core/dist/esm/FormGroupApi.d.ts
|
|
745
|
-
/**
|
|
746
|
-
* @private
|
|
747
|
-
*/
|
|
748
|
-
type FormGroupValidateFn<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName> = DeepValue<TParentData, TName>> = (props: {
|
|
749
|
-
value: TData;
|
|
750
|
-
groupApi: FormGroupApi<TParentData, TName, TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
751
|
-
}) => unknown;
|
|
752
|
-
/**
|
|
753
|
-
* @private
|
|
754
|
-
*/
|
|
755
|
-
type FormGroupValidateOrFn<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName> = DeepValue<TParentData, TName>> = FormGroupValidateFn<TParentData, TName, TData> | StandardSchemaV1<TData, unknown>;
|
|
756
|
-
/**
|
|
757
|
-
* @private
|
|
758
|
-
*/
|
|
759
|
-
type FormGroupValidateAsyncFn<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName> = DeepValue<TParentData, TName>> = (options: {
|
|
760
|
-
value: TData;
|
|
761
|
-
groupApi: FormGroupApi<TParentData, TName, TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
762
|
-
signal: AbortSignal;
|
|
763
|
-
}) => unknown | Promise<unknown>;
|
|
764
|
-
/**
|
|
765
|
-
* @private
|
|
766
|
-
*/
|
|
767
|
-
type FormGroupAsyncValidateOrFn<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName> = DeepValue<TParentData, TName>> = FormGroupValidateAsyncFn<TParentData, TName, TData> | StandardSchemaV1<TData, unknown>;
|
|
768
|
-
/**
|
|
769
|
-
* @private
|
|
770
|
-
*/
|
|
771
|
-
type FormGroupListenerFn<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName> = DeepValue<TParentData, TName>> = (props: {
|
|
772
|
-
value: TData;
|
|
773
|
-
groupApi: FormGroupApi<TParentData, TName, TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
774
|
-
}) => void;
|
|
775
|
-
interface FormGroupValidators<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName>, TOnMount extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, TOnChange extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, TOnChangeAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, TOnBlur extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, TOnBlurAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, TOnSubmit extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, TOnSubmitAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, TOnDynamic extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, TOnDynamicAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>> {
|
|
776
|
-
/**
|
|
777
|
-
* An optional function, that runs on the mount event of input.
|
|
778
|
-
*/
|
|
779
|
-
onMount?: TOnMount;
|
|
780
|
-
/**
|
|
781
|
-
* An optional function, that runs on the change event of input.
|
|
782
|
-
*
|
|
783
|
-
* @example z.string().min(1)
|
|
784
|
-
*/
|
|
785
|
-
onChange?: TOnChange;
|
|
786
|
-
/**
|
|
787
|
-
* An optional property similar to `onChange` but async validation
|
|
788
|
-
*
|
|
789
|
-
* @example z.string().refine(async (val) => val.length > 3, { message: 'Testing 123' })
|
|
790
|
-
*/
|
|
791
|
-
onChangeAsync?: TOnChangeAsync;
|
|
792
|
-
/**
|
|
793
|
-
* An optional number to represent how long the `onChangeAsync` should wait before running
|
|
794
|
-
*
|
|
795
|
-
* If set to a number larger than 0, will debounce the async validation event by this length of time in milliseconds
|
|
796
|
-
*/
|
|
797
|
-
onChangeAsyncDebounceMs?: number;
|
|
798
|
-
/**
|
|
799
|
-
* An optional list of field names that should trigger this field's `onChange` and `onChangeAsync` events when its value changes
|
|
800
|
-
*/
|
|
801
|
-
/**
|
|
802
|
-
* An optional function, that runs on the blur event of input.
|
|
803
|
-
*
|
|
804
|
-
* @example z.string().min(1)
|
|
805
|
-
*/
|
|
806
|
-
onBlur?: TOnBlur;
|
|
807
|
-
/**
|
|
808
|
-
* An optional property similar to `onBlur` but async validation.
|
|
809
|
-
*
|
|
810
|
-
* @example z.string().refine(async (val) => val.length > 3, { message: 'Testing 123' })
|
|
811
|
-
*/
|
|
812
|
-
onBlurAsync?: TOnBlurAsync;
|
|
813
|
-
/**
|
|
814
|
-
* An optional number to represent how long the `onBlurAsync` should wait before running
|
|
815
|
-
*
|
|
816
|
-
* If set to a number larger than 0, will debounce the async validation event by this length of time in milliseconds
|
|
817
|
-
*/
|
|
818
|
-
onBlurAsyncDebounceMs?: number;
|
|
819
|
-
/**
|
|
820
|
-
* An optional list of field names that should trigger this field's `onBlur` and `onBlurAsync` events when its value changes
|
|
821
|
-
*/
|
|
822
|
-
/**
|
|
823
|
-
* An optional function, that runs on the submit event of form.
|
|
824
|
-
*
|
|
825
|
-
* @example z.string().min(1)
|
|
826
|
-
*/
|
|
827
|
-
onSubmit?: TOnSubmit;
|
|
828
|
-
/**
|
|
829
|
-
* An optional property similar to `onSubmit` but async validation.
|
|
830
|
-
*
|
|
831
|
-
* @example z.string().refine(async (val) => val.length > 3, { message: 'Testing 123' })
|
|
832
|
-
*/
|
|
833
|
-
onSubmitAsync?: TOnSubmitAsync;
|
|
834
|
-
onDynamic?: TOnDynamic;
|
|
835
|
-
onDynamicAsync?: TOnDynamicAsync;
|
|
836
|
-
onDynamicAsyncDebounceMs?: number;
|
|
837
|
-
}
|
|
838
|
-
interface FormGroupListeners<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName> = DeepValue<TParentData, TName>> {
|
|
839
|
-
onChange?: FormGroupListenerFn<TParentData, TName, TData>;
|
|
840
|
-
onChangeDebounceMs?: number;
|
|
841
|
-
onBlur?: FormGroupListenerFn<TParentData, TName, TData>;
|
|
842
|
-
onBlurDebounceMs?: number;
|
|
843
|
-
onMount?: FormGroupListenerFn<TParentData, TName, TData>;
|
|
844
|
-
onUnmount?: FormGroupListenerFn<TParentData, TName, TData>;
|
|
845
|
-
onSubmit?: FormGroupListenerFn<TParentData, TName, TData>;
|
|
846
|
-
onGroupSubmit?: FormGroupListenerFn<TParentData, TName, TData>;
|
|
847
|
-
}
|
|
848
|
-
interface FormGroupExtraOptions<in out TParentData, in out TName extends DeepKeys<TParentData>, in out TData extends DeepValue<TParentData, TName>, in out TOnMount extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnChange extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnChangeAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnBlur extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnBlurAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnSubmit extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnSubmitAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnDynamic extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnDynamicAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TSubmitMeta, in out TFormOnMount extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChange extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChangeAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnBlur extends undefined | FormValidateOrFn<TParentData>, in out TFormOnBlurAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnSubmit extends undefined | FormValidateOrFn<TParentData>, in out TFormOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnDynamic extends undefined | FormValidateOrFn<TParentData>, in out TFormOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnServer extends undefined | FormAsyncValidateOrFn<TParentData>, in out TParentSubmitMeta> {
|
|
849
|
-
/**
|
|
850
|
-
* A list of validators to pass to the field
|
|
851
|
-
*/
|
|
852
|
-
validators?: FormGroupValidators<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync>;
|
|
853
|
-
/**
|
|
854
|
-
* If true, allows the form to be submitted in an invalid state i.e. canSubmit will remain true regardless of validation errors. Defaults to undefined.
|
|
855
|
-
*/
|
|
856
|
-
canSubmitWhenInvalid?: boolean;
|
|
857
|
-
/**
|
|
858
|
-
* A list of listeners which attach to the corresponding events
|
|
859
|
-
*/
|
|
860
|
-
listeners?: FormGroupListeners<TParentData, TName, TData>;
|
|
861
|
-
defaultState?: FormGroupState;
|
|
862
|
-
/**
|
|
863
|
-
* Optional validation logic strategy to use for this group's own
|
|
864
|
-
* validators (e.g. `revalidateLogic()`). When omitted, the parent form's
|
|
865
|
-
* `validationLogic` (or the default) is used.
|
|
866
|
-
*/
|
|
867
|
-
validationLogic?: ValidationLogicFn;
|
|
868
|
-
/**
|
|
869
|
-
* onSubmitMeta, the data passed from the handleSubmit handler, to the onSubmit function props
|
|
870
|
-
*/
|
|
871
|
-
onSubmitMeta?: TSubmitMeta;
|
|
872
|
-
/**
|
|
873
|
-
* A function to be called when the form is submitted, what should happen once the user submits a valid form returns `any` or a promise `Promise<any>`
|
|
874
|
-
*/
|
|
875
|
-
onGroupSubmit?: (props: {
|
|
876
|
-
value: TData;
|
|
877
|
-
groupApi: FormGroupApi<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TSubmitMeta, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>;
|
|
878
|
-
meta: TSubmitMeta;
|
|
879
|
-
}) => any | Promise<any>;
|
|
880
|
-
/**
|
|
881
|
-
* Specify an action for scenarios where the user tries to submit an invalid form.
|
|
882
|
-
*/
|
|
883
|
-
onGroupSubmitInvalid?: (props: {
|
|
884
|
-
value: TData;
|
|
885
|
-
groupApi: FormGroupApi<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TSubmitMeta, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>;
|
|
886
|
-
meta: TSubmitMeta;
|
|
887
|
-
}) => void;
|
|
888
|
-
}
|
|
889
|
-
interface FormGroupOptions<in out TParentData, in out TName extends DeepKeys<TParentData>, in out TData extends DeepValue<TParentData, TName>, in out TOnMount extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnChange extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnChangeAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnBlur extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnBlurAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnSubmit extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnSubmitAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnDynamic extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnDynamicAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TSubmitMeta, in out TFormOnMount extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChange extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChangeAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnBlur extends undefined | FormValidateOrFn<TParentData>, in out TFormOnBlurAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnSubmit extends undefined | FormValidateOrFn<TParentData>, in out TFormOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnDynamic extends undefined | FormValidateOrFn<TParentData>, in out TFormOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnServer extends undefined | FormAsyncValidateOrFn<TParentData>, in out TParentSubmitMeta> extends FieldLikeOptions<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync>, FormGroupExtraOptions<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TSubmitMeta, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta> {}
|
|
890
|
-
interface FormGroupApiOptions<in out TParentData, in out TName extends DeepKeys<TParentData>, in out TData extends DeepValue<TParentData, TName>, in out TOnMount extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnChange extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnChangeAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnBlur extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnBlurAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnSubmit extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnSubmitAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnDynamic extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnDynamicAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TSubmitMeta, in out TFormOnMount extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChange extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChangeAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnBlur extends undefined | FormValidateOrFn<TParentData>, in out TFormOnBlurAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnSubmit extends undefined | FormValidateOrFn<TParentData>, in out TFormOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnDynamic extends undefined | FormValidateOrFn<TParentData>, in out TFormOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnServer extends undefined | FormAsyncValidateOrFn<TParentData>, in out TParentSubmitMeta> extends FormGroupOptions<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TSubmitMeta, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta> {
|
|
891
|
-
form: FormApi<TParentData, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>;
|
|
892
|
-
}
|
|
893
|
-
interface FormGroupState {
|
|
894
|
-
/**
|
|
895
|
-
* A boolean indicating if the form is currently in the process of being submitted after `handleSubmit` is called.
|
|
896
|
-
*
|
|
897
|
-
* Goes back to `false` when submission completes for one of the following reasons:
|
|
898
|
-
* - the validation step returned errors.
|
|
899
|
-
* - the `onSubmit` function has completed.
|
|
900
|
-
*
|
|
901
|
-
* Note: if you're running async operations in your `onSubmit` function make sure to await them to ensure `isSubmitting` is set to `false` only when the async operation completes.
|
|
902
|
-
*
|
|
903
|
-
* This is useful for displaying loading indicators or disabling form inputs during submission.
|
|
904
|
-
*
|
|
905
|
-
*/
|
|
906
|
-
isSubmitting: boolean;
|
|
907
|
-
/**
|
|
908
|
-
* A boolean indicating if the `onSubmit` function has completed successfully.
|
|
909
|
-
*
|
|
910
|
-
* Goes back to `false` at each new submission attempt.
|
|
911
|
-
*
|
|
912
|
-
* Note: you can use isSubmitting to check if the form is currently submitting.
|
|
913
|
-
*/
|
|
914
|
-
isSubmitted: boolean;
|
|
915
|
-
/**
|
|
916
|
-
* A boolean indicating if the form or any of its fields are currently validating.
|
|
917
|
-
*/
|
|
918
|
-
isValidating: boolean;
|
|
919
|
-
/**
|
|
920
|
-
* A counter for tracking the number of submission attempts.
|
|
921
|
-
*/
|
|
922
|
-
submissionAttempts: number;
|
|
923
|
-
/**
|
|
924
|
-
* A boolean indicating if the last submission was successful.
|
|
925
|
-
*/
|
|
926
|
-
isSubmitSuccessful: boolean;
|
|
927
|
-
}
|
|
928
|
-
/**
|
|
929
|
-
* @public
|
|
930
|
-
*
|
|
931
|
-
* A type representing the FormGroup API with all generics set to `any` for convenience.
|
|
932
|
-
*/
|
|
933
|
-
type AnyFormGroupApi = FormGroupApi<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
934
|
-
/**
|
|
935
|
-
* @public
|
|
936
|
-
*
|
|
937
|
-
* The `meta` shape exposed on `FormGroupApi.state.meta`. Mirrors
|
|
938
|
-
* `FieldApi.state.meta` (since `FormGroupMeta extends FieldLikeMeta`) but
|
|
939
|
-
* additionally surfaces the group's submission lifecycle and aggregated
|
|
940
|
-
* validity flags. All derivation lives on the parent `FormApi` (in
|
|
941
|
-
* `formGroupMetaDerived`), keeping per-instance `FormGroupApi.store` as
|
|
942
|
-
* minimal as `FieldApi.store`.
|
|
943
|
-
*
|
|
944
|
-
* Aggregated booleans (`isTouched`, `isBlurred`, `isDirty`, `isPristine`,
|
|
945
|
-
* `isDefaultValue`) are computed across the group's descendant fields
|
|
946
|
-
* rather than the group's own field-meta entry.
|
|
947
|
-
*/
|
|
948
|
-
interface FormGroupMeta<in out TParentData, in out TName extends DeepKeys<TParentData>, in out TData extends DeepValue<TParentData, TName>, in out TOnMount extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnChange extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnChangeAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnBlur extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnBlurAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnSubmit extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnSubmitAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnDynamic extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnDynamicAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TFormOnMount extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChange extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChangeAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnBlur extends undefined | FormValidateOrFn<TParentData>, in out TFormOnBlurAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnSubmit extends undefined | FormValidateOrFn<TParentData>, in out TFormOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnDynamic extends undefined | FormValidateOrFn<TParentData>, in out TFormOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TParentData>> extends FieldLikeMeta<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>, FormGroupState {
|
|
949
|
-
isFieldsValidating: boolean;
|
|
950
|
-
isFieldsValid: boolean;
|
|
951
|
-
isGroupValid: boolean;
|
|
952
|
-
isValid: boolean;
|
|
953
|
-
canSubmit: boolean;
|
|
954
|
-
}
|
|
955
|
-
/**
|
|
956
|
-
* @public
|
|
957
|
-
*
|
|
958
|
-
* `FormGroupMeta` with all generics widened to `any`.
|
|
959
|
-
*/
|
|
960
|
-
type AnyFormGroupMeta = FormGroupMeta<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
961
|
-
interface FormGroupStoreState<in out TParentData, in out TName extends DeepKeys<TParentData>, in out TData extends DeepValue<TParentData, TName>, in out TOnMount extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnChange extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnChangeAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnBlur extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnBlurAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnSubmit extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnSubmitAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnDynamic extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnDynamicAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TFormOnMount extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChange extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChangeAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnBlur extends undefined | FormValidateOrFn<TParentData>, in out TFormOnBlurAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnSubmit extends undefined | FormValidateOrFn<TParentData>, in out TFormOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnDynamic extends undefined | FormValidateOrFn<TParentData>, in out TFormOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TParentData>> {
|
|
962
|
-
/**
|
|
963
|
-
* The current value of the form group.
|
|
964
|
-
*/
|
|
965
|
-
value: TData;
|
|
966
|
-
/**
|
|
967
|
-
* The current metadata of the form group, including aggregated validity,
|
|
968
|
-
* group-level errors, and submission lifecycle.
|
|
969
|
-
*/
|
|
970
|
-
meta: FormGroupMeta<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>;
|
|
971
|
-
}
|
|
972
|
-
declare class FormGroupApi<in out TParentData, in out TName extends DeepKeys<TParentData>, in out TData extends DeepValue<TParentData, TName>, in out TOnMount extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnChange extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnChangeAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnBlur extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnBlurAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnSubmit extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnSubmitAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TOnDynamic extends undefined | FormGroupValidateOrFn<TParentData, TName, TData>, in out TOnDynamicAsync extends undefined | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, in out TSubmitMeta, in out TFormOnMount extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChange extends undefined | FormValidateOrFn<TParentData>, in out TFormOnChangeAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnBlur extends undefined | FormValidateOrFn<TParentData>, in out TFormOnBlurAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnSubmit extends undefined | FormValidateOrFn<TParentData>, in out TFormOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnDynamic extends undefined | FormValidateOrFn<TParentData>, in out TFormOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TParentData>, in out TFormOnServer extends undefined | FormAsyncValidateOrFn<TParentData>, in out TParentSubmitMeta> implements FormLikeAPI<TParentData, TSubmitMeta>, FieldLikeAPI<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta, FormGroupExtraOptions<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TSubmitMeta, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>> {
|
|
973
|
-
/**
|
|
974
|
-
* A reference to the form API instance.
|
|
975
|
-
*/
|
|
976
|
-
form: FormGroupApiOptions<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TSubmitMeta, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>['form'];
|
|
977
|
-
/**
|
|
978
|
-
* The field name.
|
|
979
|
-
*/
|
|
980
|
-
name: TName;
|
|
981
|
-
/**
|
|
982
|
-
* The field options.
|
|
983
|
-
*/
|
|
984
|
-
options: FormGroupApiOptions<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TSubmitMeta, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>;
|
|
985
|
-
/**
|
|
986
|
-
* The field state store.
|
|
987
|
-
*/
|
|
988
|
-
store: ReadonlyStore<FormGroupStoreState<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>>;
|
|
989
|
-
/**
|
|
990
|
-
* The current field state.
|
|
991
|
-
*/
|
|
992
|
-
get state(): FormGroupStoreState<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>;
|
|
993
|
-
/**
|
|
994
|
-
* @private
|
|
995
|
-
*
|
|
996
|
-
* Updates this group's submission lifecycle state on the parent form's
|
|
997
|
-
* `baseStore` (where group state is now persisted), preserving entries
|
|
998
|
-
* for any other mounted groups. After writing, the form's
|
|
999
|
-
* `formGroupMetaDerived` re-derives so this group's `state.meta` picks
|
|
1000
|
-
* up the new lifecycle values automatically.
|
|
1001
|
-
*/
|
|
1002
|
-
private setFormGroupState;
|
|
1003
|
-
timeoutIds: {
|
|
1004
|
-
validations: Record<ValidationCause, ReturnType<typeof setTimeout> | null>;
|
|
1005
|
-
listeners: Record<ListenerCause, ReturnType<typeof setTimeout> | null>;
|
|
1006
|
-
formListeners: Record<ListenerCause, ReturnType<typeof setTimeout> | null>;
|
|
1007
|
-
};
|
|
1008
|
-
/**
|
|
1009
|
-
* @private
|
|
1010
|
-
*
|
|
1011
|
-
* Tracks the set of fully-qualified child field names that this group's
|
|
1012
|
-
* validators last set form-source errors on, keyed by `errorMap` key.
|
|
1013
|
-
* Used to clear stale group-level field errors on subsequent runs without
|
|
1014
|
-
* trampling errors set by the parent form's validators.
|
|
1015
|
-
*/
|
|
1016
|
-
private _lastDistributedFieldNames;
|
|
1017
|
-
private fieldInfo;
|
|
1018
|
-
constructor(opts: FormGroupApiOptions<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TSubmitMeta, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>);
|
|
1019
|
-
/**
|
|
1020
|
-
* Updates the field instance with new options.
|
|
1021
|
-
*/
|
|
1022
|
-
update: (opts: FormGroupApiOptions<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TSubmitMeta, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta>) => void;
|
|
1023
|
-
/**
|
|
1024
|
-
* @private
|
|
1025
|
-
*/
|
|
1026
|
-
runValidator<TValue extends TStandardSchemaValidatorValue<TData> & {
|
|
1027
|
-
groupApi: AnyFormGroupApi;
|
|
1028
|
-
}, TType extends 'validate' | 'validateAsync'>(props: {
|
|
1029
|
-
validate: TType extends 'validate' ? FormGroupValidateOrFn<any, any, any> : FormGroupAsyncValidateOrFn<any, any, any>;
|
|
1030
|
-
value: TValue;
|
|
1031
|
-
type: TType;
|
|
1032
|
-
}): unknown;
|
|
1033
|
-
mount: () => () => void;
|
|
633
|
+
* @deprecated Use `field.state.value` instead.
|
|
634
|
+
*/
|
|
635
|
+
getValue: () => TData;
|
|
1034
636
|
/**
|
|
1035
637
|
* Sets the field value and run the `change` validator.
|
|
1036
638
|
*/
|
|
1037
639
|
setValue: (updater: Updater<TData>, options?: UpdateMetaOptions) => void;
|
|
1038
|
-
getMeta: () =>
|
|
640
|
+
getMeta: () => FieldMeta<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>;
|
|
1039
641
|
/**
|
|
1040
642
|
* Sets the field metadata.
|
|
1041
643
|
*/
|
|
1042
|
-
setMeta: (updater: Updater<
|
|
644
|
+
setMeta: (updater: Updater<FieldMetaBase<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>>) => void;
|
|
1043
645
|
/**
|
|
1044
646
|
* Gets the field information object.
|
|
1045
647
|
*/
|
|
1046
648
|
getInfo: () => FieldInfo<TParentData>;
|
|
1047
649
|
/**
|
|
1048
|
-
*
|
|
650
|
+
* Pushes a new value to the field.
|
|
1049
651
|
*/
|
|
1050
|
-
|
|
652
|
+
pushValue: (value: TData extends any[] ? TData[number] : never, options?: UpdateMetaOptions) => void;
|
|
1051
653
|
/**
|
|
1052
|
-
*
|
|
654
|
+
* Inserts a value at the specified index, shifting the subsequent values to the right.
|
|
1053
655
|
*/
|
|
1054
|
-
|
|
1055
|
-
name: string;
|
|
1056
|
-
})[];
|
|
656
|
+
insertValue: (index: number, value: TData extends any[] ? TData[number] : never, options?: UpdateMetaOptions) => void;
|
|
1057
657
|
/**
|
|
1058
|
-
*
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
*
|
|
658
|
+
* Replaces a value at the specified index.
|
|
659
|
+
*/
|
|
660
|
+
replaceValue: (index: number, value: TData extends any[] ? TData[number] : never, options?: UpdateMetaOptions) => void;
|
|
661
|
+
/**
|
|
662
|
+
* Removes a value at the specified index.
|
|
1063
663
|
*/
|
|
1064
|
-
|
|
664
|
+
removeValue: (index: number, options?: UpdateMetaOptions) => void;
|
|
665
|
+
/**
|
|
666
|
+
* Swaps the values at the specified indices.
|
|
667
|
+
*/
|
|
668
|
+
swapValues: (aIndex: number, bIndex: number, options?: UpdateMetaOptions) => void;
|
|
669
|
+
/**
|
|
670
|
+
* Moves the value at the first specified index to the second specified index.
|
|
671
|
+
*/
|
|
672
|
+
moveValue: (aIndex: number, bIndex: number, options?: UpdateMetaOptions) => void;
|
|
673
|
+
/**
|
|
674
|
+
* Clear all values from the array.
|
|
675
|
+
*/
|
|
676
|
+
clearValues: (options?: UpdateMetaOptions) => void;
|
|
1065
677
|
/**
|
|
1066
678
|
* @private
|
|
1067
|
-
*
|
|
1068
|
-
* Distributes a `{ fields: { ... } }` payload returned by one of this
|
|
1069
|
-
* group's own validators onto the corresponding child fields. Tracks
|
|
1070
|
-
* which fields have been touched so subsequent runs can clear stale
|
|
1071
|
-
* errors without trampling errors set by the parent form's validators.
|
|
1072
679
|
*/
|
|
1073
|
-
|
|
680
|
+
getLinkedFields: (cause: ValidationCause) => AnyFieldApi[];
|
|
1074
681
|
/**
|
|
1075
682
|
* @private
|
|
1076
683
|
*/
|
|
1077
|
-
validateSync: (cause: ValidationCause, errorFromForm: ValidationErrorMap
|
|
1078
|
-
skipRelatedFieldValidation?: boolean;
|
|
1079
|
-
}) => {
|
|
684
|
+
validateSync: (cause: ValidationCause, errorFromForm: ValidationErrorMap) => {
|
|
1080
685
|
hasErrored: boolean;
|
|
1081
686
|
};
|
|
1082
687
|
/**
|
|
1083
688
|
* @private
|
|
1084
689
|
*/
|
|
1085
|
-
validateAsync: (cause: ValidationCause, formValidationResultPromise: Promise<FieldErrorMapFromValidator<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync
|
|
1086
|
-
skipRelatedFieldValidation?: boolean;
|
|
1087
|
-
}) => Promise<unknown[]>;
|
|
690
|
+
validateAsync: (cause: ValidationCause, formValidationResultPromise: Promise<FieldErrorMapFromValidator<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync>>) => Promise<unknown[]>;
|
|
1088
691
|
/**
|
|
1089
|
-
* Validates
|
|
1090
|
-
* This will ignore FORM level validators, use form.validate({ValidationCause}) for a complete validation
|
|
1091
|
-
*/
|
|
1092
|
-
validateAllFields: (cause: ValidationCause) => Promise<unknown[]>;
|
|
1093
|
-
validateArrayFieldsStartingFrom: <TField extends DeepKeysOfType<TParentData, any[]>>(field: TField, index: number, cause: ValidationCause) => Promise<unknown[]>;
|
|
1094
|
-
validateField: <TField extends DeepKeysOfType<TParentData, any>>(field: TField, cause: ValidationCause) => any[] | Promise<any[]>;
|
|
1095
|
-
getFieldValue: <TField extends DeepKeysOfType<TParentData, any>>(field: TField) => DeepValue<TParentData, TField>;
|
|
1096
|
-
getFieldMeta: <TField extends DeepKeysOfType<TParentData, any>>(field: TField) => AnyFieldLikeMeta | undefined;
|
|
1097
|
-
setFieldMeta: <TField extends DeepKeysOfType<TParentData, any>>(field: TField, updater: Updater<AnyFieldLikeMetaBase>) => void;
|
|
1098
|
-
setFieldValue: <TField extends DeepKeysOfType<TParentData, any>>(field: TField, value: any) => void;
|
|
1099
|
-
deleteField: <TField extends DeepKeysOfType<TParentData, any>>(field: TField) => void;
|
|
1100
|
-
pushFieldValue: <TField extends DeepKeysOfType<TParentData, any[]>>(field: TField, value: any) => void;
|
|
1101
|
-
insertFieldValue: <TField extends DeepKeysOfType<TParentData, any[]>>(field: TField, index: number, value: any) => Promise<void>;
|
|
1102
|
-
replaceFieldValue: <TField extends DeepKeysOfType<TParentData, any[]>>(field: TField, index: number, value: any) => Promise<void>;
|
|
1103
|
-
swapFieldValues: <TField extends DeepKeysOfType<TParentData, any[]>>(field: TField, index1: number, index2: number) => void;
|
|
1104
|
-
moveFieldValues: <TField extends DeepKeysOfType<TParentData, any[]>>(field: TField, fromIndex: number, toIndex: number) => void;
|
|
1105
|
-
clearFieldValues: <TField extends DeepKeysOfType<TParentData, any[]>>(field: TField) => void;
|
|
1106
|
-
resetField: <TField extends DeepKeysOfType<TParentData, any>>(field: TField) => void;
|
|
1107
|
-
removeFieldValue: <TField extends DeepKeysOfType<TParentData, any[]>>(field: TField, index: number) => Promise<void>;
|
|
1108
|
-
areRelatedFieldsValid: () => boolean;
|
|
1109
|
-
/**
|
|
1110
|
-
* Validates the form group and all related children.
|
|
692
|
+
* Validates the field value.
|
|
1111
693
|
*/
|
|
1112
694
|
validate: (cause: ValidationCause, opts?: {
|
|
1113
695
|
skipFormValidation?: boolean;
|
|
1114
|
-
skipRelatedFieldValidation?: boolean;
|
|
1115
696
|
}) => ValidationError[] | Promise<ValidationError[]>;
|
|
1116
697
|
/**
|
|
1117
|
-
*
|
|
698
|
+
* Handles the change event.
|
|
1118
699
|
*/
|
|
1119
|
-
|
|
700
|
+
handleChange: (updater: Updater<TData>) => void;
|
|
1120
701
|
/**
|
|
1121
|
-
*
|
|
702
|
+
* Handles the blur event.
|
|
1122
703
|
*/
|
|
1123
|
-
|
|
1124
|
-
handleSubmit(): Promise<void>;
|
|
1125
|
-
handleSubmit(submitMeta: TSubmitMeta): Promise<void>;
|
|
704
|
+
handleBlur: () => void;
|
|
1126
705
|
/**
|
|
1127
|
-
*
|
|
706
|
+
* Updates the field's errorMap
|
|
1128
707
|
*/
|
|
1129
|
-
|
|
708
|
+
setErrorMap: (errorMap: ValidationErrorMap<UnwrapFieldValidateOrFn<TName, TOnMount, TFormOnMount>, UnwrapFieldValidateOrFn<TName, TOnChange, TFormOnChange>, UnwrapFieldAsyncValidateOrFn<TName, TOnChangeAsync, TFormOnChangeAsync>, UnwrapFieldValidateOrFn<TName, TOnBlur, TFormOnBlur>, UnwrapFieldAsyncValidateOrFn<TName, TOnBlurAsync, TFormOnBlurAsync>, UnwrapFieldValidateOrFn<TName, TOnSubmit, TFormOnSubmit>, UnwrapFieldAsyncValidateOrFn<TName, TOnSubmitAsync, TFormOnSubmitAsync>, UnwrapFieldValidateOrFn<TName, TOnDynamic, TFormOnDynamic>, UnwrapFieldAsyncValidateOrFn<TName, TOnDynamicAsync, TFormOnDynamicAsync>>) => void;
|
|
709
|
+
/**
|
|
710
|
+
* Parses the field's value with the given schema and returns
|
|
711
|
+
* issues (if any). This method does NOT set any internal errors.
|
|
712
|
+
* @param schema The standard schema to parse this field's value with.
|
|
713
|
+
*/
|
|
714
|
+
parseValueWithSchema: (schema: StandardSchemaV1<TData, unknown>) => StandardSchemaV1Issue[] | undefined;
|
|
715
|
+
/**
|
|
716
|
+
* Parses the field's value with the given schema and returns
|
|
717
|
+
* issues (if any). This method does NOT set any internal errors.
|
|
718
|
+
* @param schema The standard schema to parse this field's value with.
|
|
719
|
+
*/
|
|
720
|
+
parseValueWithSchemaAsync: (schema: StandardSchemaV1<TData, unknown>) => Promise<StandardSchemaV1Issue[] | undefined>;
|
|
721
|
+
private triggerOnBlurListener;
|
|
722
|
+
/**
|
|
723
|
+
* @private
|
|
724
|
+
*/
|
|
725
|
+
triggerOnChangeListener: () => void;
|
|
1130
726
|
}
|
|
1131
727
|
//#endregion
|
|
1132
728
|
//#region node_modules/@tanstack/form-core/dist/esm/types.d.ts
|
|
@@ -1215,8 +811,9 @@ interface UpdateMetaOptions {
|
|
|
1215
811
|
}
|
|
1216
812
|
/**
|
|
1217
813
|
* @private
|
|
814
|
+
* A list of field manipulation methods that a form-like API must implement.
|
|
1218
815
|
*/
|
|
1219
|
-
interface
|
|
816
|
+
interface FieldManipulator<TFormData, TSubmitMeta> {
|
|
1220
817
|
/**
|
|
1221
818
|
* Validates all fields using the correct handlers for a given validation cause.
|
|
1222
819
|
*/
|
|
@@ -1241,11 +838,11 @@ interface FormLikeAPI<TFormData, TSubmitMeta> {
|
|
|
1241
838
|
/**
|
|
1242
839
|
* Gets the metadata of the specified field.
|
|
1243
840
|
*/
|
|
1244
|
-
getFieldMeta: <TField extends DeepKeys<TFormData>>(field: TField) =>
|
|
841
|
+
getFieldMeta: <TField extends DeepKeys<TFormData>>(field: TField) => AnyFieldMeta | undefined;
|
|
1245
842
|
/**
|
|
1246
843
|
* Updates the metadata of the specified field.
|
|
1247
844
|
*/
|
|
1248
|
-
setFieldMeta: <TField extends DeepKeys<TFormData>>(field: TField, updater: Updater<
|
|
845
|
+
setFieldMeta: <TField extends DeepKeys<TFormData>>(field: TField, updater: Updater<AnyFieldMetaBase>) => void;
|
|
1249
846
|
/**
|
|
1250
847
|
* Sets the value of the specified field and optionally updates the touched state.
|
|
1251
848
|
*/
|
|
@@ -1287,182 +884,102 @@ interface FormLikeAPI<TFormData, TSubmitMeta> {
|
|
|
1287
884
|
*/
|
|
1288
885
|
resetField: <TField extends DeepKeys<TFormData>>(field: TField) => void;
|
|
1289
886
|
}
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
} ? TName extends keyof TFormValidateVal['fields'] ? TFormValidateVal['fields'][TName] : undefined : undefined : never) | ([TValidateOrFn] extends [FieldValidateAsyncFn<any, any, any>] ? Awaited<ReturnType<TValidateOrFn>> : [TValidateOrFn] extends [StandardSchemaV1<any, any>] ? StandardSchemaV1Issue[] : undefined) | ([TValidateOrFn] extends [FormGroupValidateAsyncFn<any, any, any>] ? Awaited<ReturnType<TValidateOrFn>> : [TValidateOrFn] extends [StandardSchemaV1<any, any>] ? StandardSchemaV1Issue[] : undefined);
|
|
1296
|
-
/**
|
|
1297
|
-
* @private
|
|
1298
|
-
*/
|
|
1299
|
-
type FieldErrorMapFromValidator<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName>, TOnMount extends undefined | FieldValidateOrFn<TParentData, TName, TData> | FormGroupValidateOrFn<TParentData, TName, TData>, TOnChange extends undefined | FieldValidateOrFn<TParentData, TName, TData> | FormGroupValidateOrFn<TParentData, TName, TData>, TOnChangeAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData> | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, TOnBlur extends undefined | FieldValidateOrFn<TParentData, TName, TData> | FormGroupValidateOrFn<TParentData, TName, TData>, TOnBlurAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData> | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, TOnSubmit extends undefined | FieldValidateOrFn<TParentData, TName, TData> | FormGroupValidateOrFn<TParentData, TName, TData>, TOnSubmitAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData> | FormGroupAsyncValidateOrFn<TParentData, TName, TData>> = Partial<Record<DeepKeys<TParentData>, ValidationErrorMap<TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync>>>;
|
|
1300
|
-
type StandardBrandedSchemaV1<T> = T & {
|
|
1301
|
-
__standardSchemaV1: true;
|
|
887
|
+
//#endregion
|
|
888
|
+
//#region node_modules/@tanstack/form-core/dist/esm/standardSchemaValidator.d.ts
|
|
889
|
+
type TStandardSchemaValidatorValue<TData, TSource extends ValidationSource = ValidationSource> = {
|
|
890
|
+
value: TData;
|
|
891
|
+
validationSource: TSource;
|
|
1302
892
|
};
|
|
1303
|
-
type UnwrapFormValidateOrFnForInner<TValidateOrFn extends undefined | FormValidateOrFn<any>> = [TValidateOrFn] extends [FormValidateFn<any>] ? ReturnType<TValidateOrFn> : [TValidateOrFn] extends [StandardSchemaV1<infer TOut, any>] ? StandardBrandedSchemaV1<TOut> : undefined;
|
|
1304
|
-
type UnwrapFieldValidateOrFn<TName extends string, TValidateOrFn extends undefined | FieldValidateOrFn<any, any, any> | FormGroupValidateOrFn<any, any, any>, TFormValidateOrFn extends undefined | FormValidateOrFn<any>> = ([TFormValidateOrFn] extends [StandardSchemaV1<any, infer TStandardOut>] ? TName extends keyof TStandardOut ? StandardSchemaV1Issue[] : undefined : undefined) | (UnwrapFormValidateOrFnForInner<TFormValidateOrFn> extends infer TFormValidateVal ? TFormValidateVal extends {
|
|
1305
|
-
__standardSchemaV1: true;
|
|
1306
|
-
} ? [DeepValue<TFormValidateVal, TName>] extends [never] ? undefined : StandardSchemaV1Issue[] : TFormValidateVal extends {
|
|
1307
|
-
fields: any;
|
|
1308
|
-
} ? TName extends keyof TFormValidateVal['fields'] ? TFormValidateVal['fields'][TName] : undefined : undefined : never) | ([TValidateOrFn] extends [FieldValidateFn<any, any, any>] ? ReturnType<TValidateOrFn> : [TValidateOrFn] extends [StandardSchemaV1<any, any>] ? StandardSchemaV1Issue[] : undefined) | ([TValidateOrFn] extends [FormGroupValidateFn<any, any, any>] ? ReturnType<TValidateOrFn> : [TValidateOrFn] extends [StandardSchemaV1<any, any>] ? StandardSchemaV1Issue[] : undefined);
|
|
1309
893
|
/**
|
|
1310
|
-
*
|
|
894
|
+
* The Standard Schema interface.
|
|
1311
895
|
*/
|
|
1312
|
-
type
|
|
1313
|
-
/**
|
|
1314
|
-
* A flag indicating whether the field has been touched.
|
|
1315
|
-
*/
|
|
1316
|
-
isTouched: boolean;
|
|
1317
|
-
/**
|
|
1318
|
-
* A flag indicating whether the field has been blurred.
|
|
1319
|
-
*/
|
|
1320
|
-
isBlurred: boolean;
|
|
1321
|
-
/**
|
|
1322
|
-
* A flag that is `true` if the field's value has been modified by the user. Opposite of `isPristine`.
|
|
1323
|
-
*/
|
|
1324
|
-
isDirty: boolean;
|
|
1325
|
-
/**
|
|
1326
|
-
* A map of errors related to the field value.
|
|
1327
|
-
*/
|
|
1328
|
-
errorMap: ValidationErrorMap<UnwrapFieldValidateOrFn<TName, TOnMount, TFormOnMount>, UnwrapFieldValidateOrFn<TName, TOnChange, TFormOnChange>, UnwrapFieldAsyncValidateOrFn<TName, TOnChangeAsync, TFormOnChangeAsync>, UnwrapFieldValidateOrFn<TName, TOnBlur, TFormOnBlur>, UnwrapFieldAsyncValidateOrFn<TName, TOnBlurAsync, TFormOnBlurAsync>, UnwrapFieldValidateOrFn<TName, TOnSubmit, TFormOnSubmit>, UnwrapFieldAsyncValidateOrFn<TName, TOnSubmitAsync, TFormOnSubmitAsync>, UnwrapFieldValidateOrFn<TName, TOnDynamic, TFormOnDynamic>, UnwrapFieldAsyncValidateOrFn<TName, TOnDynamicAsync, TFormOnDynamicAsync>>;
|
|
1329
|
-
/**
|
|
1330
|
-
* @private allows tracking the source of the errors in the error map
|
|
1331
|
-
*/
|
|
1332
|
-
errorSourceMap: ValidationErrorMapSource;
|
|
1333
|
-
/**
|
|
1334
|
-
* A flag indicating whether the field is currently being validated.
|
|
1335
|
-
*/
|
|
1336
|
-
isValidating: boolean;
|
|
896
|
+
type StandardSchemaV1<Input = unknown, Output = Input> = {
|
|
1337
897
|
/**
|
|
1338
|
-
*
|
|
1339
|
-
* operation (push, insert, remove, swap, move, replace, clear) modifies
|
|
1340
|
-
* the value of an array field. Adapters can subscribe to this to trigger
|
|
1341
|
-
* re-renders for `mode="array"` fields without having to subscribe to the
|
|
1342
|
-
* full field value.
|
|
898
|
+
* The Standard Schema properties.
|
|
1343
899
|
*/
|
|
1344
|
-
|
|
900
|
+
readonly '~standard': StandardSchemaV1Props<Input, Output>;
|
|
1345
901
|
};
|
|
1346
902
|
/**
|
|
1347
|
-
*
|
|
1348
|
-
*/
|
|
1349
|
-
type AnyFieldLikeMetaBase = FieldLikeMetaBase<any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
1350
|
-
/**
|
|
1351
|
-
* @private
|
|
903
|
+
* The Standard Schema properties interface.
|
|
1352
904
|
*/
|
|
1353
|
-
|
|
905
|
+
interface StandardSchemaV1Props<Input = unknown, Output = Input> {
|
|
1354
906
|
/**
|
|
1355
|
-
*
|
|
907
|
+
* The version number of the standard.
|
|
1356
908
|
*/
|
|
1357
|
-
|
|
909
|
+
readonly version: 1;
|
|
1358
910
|
/**
|
|
1359
|
-
*
|
|
911
|
+
* The vendor name of the schema library.
|
|
1360
912
|
*/
|
|
1361
|
-
|
|
913
|
+
readonly vendor: string;
|
|
1362
914
|
/**
|
|
1363
|
-
*
|
|
915
|
+
* Validates unknown input values.
|
|
1364
916
|
*/
|
|
1365
|
-
|
|
917
|
+
readonly validate: (value: unknown) => StandardSchemaV1Result<Output> | Promise<StandardSchemaV1Result<Output>>;
|
|
1366
918
|
/**
|
|
1367
|
-
*
|
|
919
|
+
* Inferred types associated with the schema.
|
|
1368
920
|
*/
|
|
1369
|
-
|
|
1370
|
-
}
|
|
1371
|
-
/**
|
|
1372
|
-
* @private
|
|
1373
|
-
* An object type representing the metadata of a field in a form.
|
|
1374
|
-
*/
|
|
1375
|
-
type FieldLikeMeta<TParentData, TName extends DeepKeys<TParentData>, TData extends DeepValue<TParentData, TName>, TOnMount extends undefined | FieldValidateOrFn<TParentData, TName, TData> | FormGroupValidateOrFn<TParentData, TName, TData>, TOnChange extends undefined | FieldValidateOrFn<TParentData, TName, TData> | FormGroupValidateOrFn<TParentData, TName, TData>, TOnChangeAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData> | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, TOnBlur extends undefined | FieldValidateOrFn<TParentData, TName, TData> | FormGroupValidateOrFn<TParentData, TName, TData>, TOnBlurAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData> | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, TOnSubmit extends undefined | FieldValidateOrFn<TParentData, TName, TData> | FormGroupValidateOrFn<TParentData, TName, TData>, TOnSubmitAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData> | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, TOnDynamic extends undefined | FieldValidateOrFn<TParentData, TName, TData> | FormGroupValidateOrFn<TParentData, TName, TData>, TOnDynamicAsync extends undefined | FieldAsyncValidateOrFn<TParentData, TName, TData> | FormGroupAsyncValidateOrFn<TParentData, TName, TData>, TFormOnMount extends undefined | FormValidateOrFn<TParentData>, TFormOnChange extends undefined | FormValidateOrFn<TParentData>, TFormOnChangeAsync extends undefined | FormAsyncValidateOrFn<TParentData>, TFormOnBlur extends undefined | FormValidateOrFn<TParentData>, TFormOnBlurAsync extends undefined | FormAsyncValidateOrFn<TParentData>, TFormOnSubmit extends undefined | FormValidateOrFn<TParentData>, TFormOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TParentData>, TFormOnDynamic extends undefined | FormValidateOrFn<TParentData>, TFormOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TParentData>> = FieldLikeMetaBase<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync> & FieldLikeMetaDerived<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>;
|
|
921
|
+
readonly types?: StandardSchemaV1Types<Input, Output> | undefined;
|
|
922
|
+
}
|
|
1376
923
|
/**
|
|
1377
|
-
*
|
|
924
|
+
* The result interface of the validate function.
|
|
1378
925
|
*/
|
|
1379
|
-
type
|
|
926
|
+
type StandardSchemaV1Result<Output> = StandardSchemaV1SuccessResult<Output> | StandardSchemaV1FailureResult;
|
|
1380
927
|
/**
|
|
1381
|
-
*
|
|
1382
|
-
* An object type representing the state of a field.
|
|
928
|
+
* The result interface if validation succeeds.
|
|
1383
929
|
*/
|
|
1384
|
-
|
|
930
|
+
interface StandardSchemaV1SuccessResult<Output> {
|
|
1385
931
|
/**
|
|
1386
|
-
* The
|
|
932
|
+
* The typed output value.
|
|
1387
933
|
*/
|
|
1388
|
-
value:
|
|
934
|
+
readonly value: Output;
|
|
1389
935
|
/**
|
|
1390
|
-
* The
|
|
936
|
+
* The non-existent issues.
|
|
1391
937
|
*/
|
|
1392
|
-
|
|
1393
|
-
}
|
|
938
|
+
readonly issues?: undefined;
|
|
939
|
+
}
|
|
1394
940
|
/**
|
|
1395
|
-
*
|
|
1396
|
-
* An object type representing the options for a field in a form.
|
|
941
|
+
* The result interface if validation fails.
|
|
1397
942
|
*/
|
|
1398
|
-
interface
|
|
1399
|
-
/**
|
|
1400
|
-
* The field name. The type will be `DeepKeys<TParentData>` to ensure your name is a deep key of the parent dataset.
|
|
1401
|
-
*/
|
|
1402
|
-
name: TName;
|
|
1403
|
-
/**
|
|
1404
|
-
* An optional default value for the field.
|
|
1405
|
-
*/
|
|
1406
|
-
defaultValue?: NoInfer<TData>;
|
|
1407
|
-
/**
|
|
1408
|
-
* The default time to debounce async validation if there is not a more specific debounce time passed.
|
|
1409
|
-
*/
|
|
1410
|
-
asyncDebounceMs?: number;
|
|
943
|
+
interface StandardSchemaV1FailureResult {
|
|
1411
944
|
/**
|
|
1412
|
-
*
|
|
945
|
+
* The issues of failed validation.
|
|
1413
946
|
*/
|
|
1414
|
-
|
|
947
|
+
readonly issues: ReadonlyArray<StandardSchemaV1Issue>;
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* The issue interface of the failure output.
|
|
951
|
+
*/
|
|
952
|
+
interface StandardSchemaV1Issue {
|
|
1415
953
|
/**
|
|
1416
|
-
*
|
|
954
|
+
* The error message of the issue.
|
|
1417
955
|
*/
|
|
1418
|
-
|
|
956
|
+
readonly message: string;
|
|
1419
957
|
/**
|
|
1420
|
-
*
|
|
958
|
+
* The path of the issue, if any.
|
|
1421
959
|
*/
|
|
1422
|
-
|
|
960
|
+
readonly path?: ReadonlyArray<PropertyKey | StandardSchemaV1PathSegment> | undefined;
|
|
1423
961
|
}
|
|
1424
962
|
/**
|
|
1425
|
-
*
|
|
1426
|
-
* An object type representing the required options for the FieldApi class.
|
|
963
|
+
* The path segment interface of the issue.
|
|
1427
964
|
*/
|
|
1428
|
-
interface
|
|
1429
|
-
|
|
965
|
+
interface StandardSchemaV1PathSegment {
|
|
966
|
+
/**
|
|
967
|
+
* The key representing a path segment.
|
|
968
|
+
*/
|
|
969
|
+
readonly key: PropertyKey;
|
|
1430
970
|
}
|
|
1431
971
|
/**
|
|
1432
|
-
*
|
|
972
|
+
* The Standard Schema types interface.
|
|
1433
973
|
*/
|
|
1434
|
-
interface
|
|
1435
|
-
form: AnyFormApi;
|
|
1436
|
-
options: FieldLikeApiOptions<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync, TFormOnServer, TParentSubmitMeta> & TExtraOptions;
|
|
1437
|
-
store: ReadonlyStore<FieldLikeState<TParentData, TName, TData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TFormOnMount, TFormOnChange, TFormOnChangeAsync, TFormOnBlur, TFormOnBlurAsync, TFormOnSubmit, TFormOnSubmitAsync, TFormOnDynamic, TFormOnDynamicAsync>>;
|
|
1438
|
-
/**
|
|
1439
|
-
* The field name.
|
|
1440
|
-
*/
|
|
1441
|
-
name: TName;
|
|
1442
|
-
mount: () => () => void;
|
|
1443
|
-
setValue: (updater: Updater<TData>, options?: UpdateMetaOptions) => void;
|
|
1444
|
-
getMeta: () => AnyFieldLikeMeta;
|
|
1445
|
-
setMeta: (updater: Updater<AnyFieldLikeMetaBase>) => void;
|
|
1446
|
-
getInfo: () => FieldInfo<TParentData>;
|
|
1447
|
-
validate: (cause: ValidationCause, opts?: {
|
|
1448
|
-
skipFormValidation?: boolean;
|
|
1449
|
-
skipGroupValidation?: boolean;
|
|
1450
|
-
}) => ValidationError[] | Promise<ValidationError[]>;
|
|
974
|
+
interface StandardSchemaV1Types<Input = unknown, Output = Input> {
|
|
1451
975
|
/**
|
|
1452
|
-
*
|
|
976
|
+
* The input type of the schema.
|
|
1453
977
|
*/
|
|
1454
|
-
|
|
978
|
+
readonly input: Input;
|
|
1455
979
|
/**
|
|
1456
|
-
*
|
|
980
|
+
* The output type of the schema.
|
|
1457
981
|
*/
|
|
1458
|
-
|
|
1459
|
-
}
|
|
1460
|
-
/**
|
|
1461
|
-
* @private
|
|
1462
|
-
*/
|
|
1463
|
-
interface FieldInfo<TParentData> {
|
|
1464
|
-
instance: FieldLikeAPI<TParentData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> | null;
|
|
1465
|
-
validationMetaMap: Record<ValidationErrorMapKeys, ValidationMeta | undefined>;
|
|
982
|
+
readonly output: Output;
|
|
1466
983
|
}
|
|
1467
984
|
//#endregion
|
|
1468
985
|
//#region node_modules/@tanstack/form-core/dist/esm/FormApi.d.ts
|
|
@@ -1496,11 +1013,11 @@ interface FormValidators<TFormData, TOnMount extends undefined | FormValidateOrF
|
|
|
1496
1013
|
/**
|
|
1497
1014
|
* Optional function that fires as soon as the component mounts.
|
|
1498
1015
|
*/
|
|
1499
|
-
onMount?:
|
|
1016
|
+
onMount?: TOnMount;
|
|
1500
1017
|
/**
|
|
1501
1018
|
* Optional function that checks the validity of your data whenever a value changes
|
|
1502
1019
|
*/
|
|
1503
|
-
onChange?:
|
|
1020
|
+
onChange?: TOnChange;
|
|
1504
1021
|
/**
|
|
1505
1022
|
* Optional onChange asynchronous counterpart to onChange. Useful for more complex validation logic that might involve server requests.
|
|
1506
1023
|
*/
|
|
@@ -1512,7 +1029,7 @@ interface FormValidators<TFormData, TOnMount extends undefined | FormValidateOrF
|
|
|
1512
1029
|
/**
|
|
1513
1030
|
* Optional function that validates the form data when a field loses focus, returns a `FormValidationError`
|
|
1514
1031
|
*/
|
|
1515
|
-
onBlur?:
|
|
1032
|
+
onBlur?: TOnBlur;
|
|
1516
1033
|
/**
|
|
1517
1034
|
* Optional onBlur asynchronous validation method for when a field loses focus returns a ` FormValidationError` or a promise of `Promise<FormValidationError>`
|
|
1518
1035
|
*/
|
|
@@ -1521,25 +1038,18 @@ interface FormValidators<TFormData, TOnMount extends undefined | FormValidateOrF
|
|
|
1521
1038
|
* The default time in milliseconds that if set to a number larger than 0, will debounce the async validation event by this length of time in milliseconds.
|
|
1522
1039
|
*/
|
|
1523
1040
|
onBlurAsyncDebounceMs?: number;
|
|
1524
|
-
onSubmit?:
|
|
1041
|
+
onSubmit?: TOnSubmit;
|
|
1525
1042
|
onSubmitAsync?: TOnSubmitAsync;
|
|
1526
|
-
onDynamic?:
|
|
1043
|
+
onDynamic?: TOnDynamic;
|
|
1527
1044
|
onDynamicAsync?: TOnDynamicAsync;
|
|
1528
1045
|
onDynamicAsyncDebounceMs?: number;
|
|
1529
1046
|
}
|
|
1530
|
-
interface FormListenersPropsGroup<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 = never> {
|
|
1531
|
-
formApi: FormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>;
|
|
1532
|
-
groupApi: AnyFormGroupApi;
|
|
1533
|
-
}
|
|
1534
|
-
interface FormListenersPropsField<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 = never> {
|
|
1535
|
-
formApi: FormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>;
|
|
1536
|
-
fieldApi: AnyFieldApi;
|
|
1537
|
-
}
|
|
1538
1047
|
interface FormListeners<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 = never> {
|
|
1539
|
-
onChange?: (props:
|
|
1048
|
+
onChange?: (props: {
|
|
1049
|
+
formApi: FormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>;
|
|
1050
|
+
fieldApi: AnyFieldApi;
|
|
1051
|
+
}) => void;
|
|
1540
1052
|
onChangeDebounceMs?: number;
|
|
1541
|
-
onChangeGroup?: (props: FormListenersPropsGroup<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>) => void;
|
|
1542
|
-
onChangeGroupDebounceMs?: number;
|
|
1543
1053
|
onBlur?: (props: {
|
|
1544
1054
|
formApi: FormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>;
|
|
1545
1055
|
fieldApi: AnyFieldApi;
|
|
@@ -1552,8 +1062,10 @@ interface FormListeners<TFormData, TOnMount extends undefined | FormValidateOrFn
|
|
|
1552
1062
|
formApi: FormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>;
|
|
1553
1063
|
meta: TSubmitMeta;
|
|
1554
1064
|
}) => void;
|
|
1555
|
-
onFieldUnmount?: (props:
|
|
1556
|
-
|
|
1065
|
+
onFieldUnmount?: (props: {
|
|
1066
|
+
formApi: FormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>;
|
|
1067
|
+
fieldApi: AnyFieldApi;
|
|
1068
|
+
}) => void;
|
|
1557
1069
|
}
|
|
1558
1070
|
/**
|
|
1559
1071
|
* An object representing the base properties of a form, unrelated to any validators
|
|
@@ -1628,6 +1140,19 @@ type ValidationMeta = {
|
|
|
1628
1140
|
*/
|
|
1629
1141
|
lastAbortController: AbortController;
|
|
1630
1142
|
};
|
|
1143
|
+
/**
|
|
1144
|
+
* An object representing the field information for a specific field within the form.
|
|
1145
|
+
*/
|
|
1146
|
+
type FieldInfo<TFormData> = {
|
|
1147
|
+
/**
|
|
1148
|
+
* An instance of the FieldAPI.
|
|
1149
|
+
*/
|
|
1150
|
+
instance: FieldApi<TFormData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any> | null;
|
|
1151
|
+
/**
|
|
1152
|
+
* A record of field validation internal handling.
|
|
1153
|
+
*/
|
|
1154
|
+
validationMetaMap: Record<ValidationErrorMapKeys, ValidationMeta | undefined>;
|
|
1155
|
+
};
|
|
1631
1156
|
/**
|
|
1632
1157
|
* An object representing the current state of the form.
|
|
1633
1158
|
*/
|
|
@@ -1647,14 +1172,7 @@ type BaseFormState<in out TFormData, in out TOnMount extends undefined | FormVal
|
|
|
1647
1172
|
/**
|
|
1648
1173
|
* A record of field metadata for each field in the form, not including the derived properties, like `errors` and such
|
|
1649
1174
|
*/
|
|
1650
|
-
fieldMetaBase: Partial<Record<DeepKeys<TFormData>,
|
|
1651
|
-
/**
|
|
1652
|
-
* A record of submission lifecycle state for each mounted `FormGroupApi`,
|
|
1653
|
-
* keyed by the group's fully-qualified field name. Stored on the form so
|
|
1654
|
-
* group-level state can be read from `FormApi` without having to walk the
|
|
1655
|
-
* mounted group instances.
|
|
1656
|
-
*/
|
|
1657
|
-
formGroupStateBase: Partial<Record<string, FormGroupState>>;
|
|
1175
|
+
fieldMetaBase: Partial<Record<DeepKeys<TFormData>, AnyFieldMetaBase>>;
|
|
1658
1176
|
/**
|
|
1659
1177
|
* A boolean indicating if the form is currently in the process of being submitted after `handleSubmit` is called.
|
|
1660
1178
|
*
|
|
@@ -1705,7 +1223,7 @@ type DerivedFormState<in out TFormData, in out TOnMount extends undefined | Form
|
|
|
1705
1223
|
/**
|
|
1706
1224
|
* The error array for the form itself.
|
|
1707
1225
|
*/
|
|
1708
|
-
errors: Array<
|
|
1226
|
+
errors: Array<UnwrapFormValidateOrFn<TOnMount> | UnwrapFormValidateOrFn<TOnChange> | UnwrapFormAsyncValidateOrFn<TOnChangeAsync> | UnwrapFormValidateOrFn<TOnBlur> | UnwrapFormAsyncValidateOrFn<TOnBlurAsync> | UnwrapFormValidateOrFn<TOnSubmit> | UnwrapFormAsyncValidateOrFn<TOnSubmitAsync> | UnwrapFormValidateOrFn<TOnDynamic> | UnwrapFormAsyncValidateOrFn<TOnDynamicAsync> | UnwrapFormAsyncValidateOrFn<TOnServer>>;
|
|
1709
1227
|
/**
|
|
1710
1228
|
* A boolean indicating if any of the form fields are currently validating.
|
|
1711
1229
|
*/
|
|
@@ -1745,7 +1263,7 @@ type DerivedFormState<in out TFormData, in out TOnMount extends undefined | Form
|
|
|
1745
1263
|
/**
|
|
1746
1264
|
* A record of field metadata for each field in the form.
|
|
1747
1265
|
*/
|
|
1748
|
-
fieldMeta: Partial<Record<DeepKeys<TFormData>,
|
|
1266
|
+
fieldMeta: Partial<Record<DeepKeys<TFormData>, AnyFieldMeta>>;
|
|
1749
1267
|
};
|
|
1750
1268
|
interface FormState<in out TFormData, in out TOnMount extends undefined | FormValidateOrFn<TFormData>, in out TOnChange extends undefined | FormValidateOrFn<TFormData>, in out TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>, in out TOnBlur extends undefined | FormValidateOrFn<TFormData>, in out TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>, in out TOnSubmit extends undefined | FormValidateOrFn<TFormData>, in out TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>, in out TOnDynamic extends undefined | FormValidateOrFn<TFormData>, in out TOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TFormData>, in out TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>> extends BaseFormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer>, DerivedFormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer> {}
|
|
1751
1269
|
/**
|
|
@@ -1754,11 +1272,6 @@ interface FormState<in out TFormData, in out TOnMount extends undefined | FormVa
|
|
|
1754
1272
|
* A type representing the Form API with all generics set to `any` for convenience.
|
|
1755
1273
|
*/
|
|
1756
1274
|
type AnyFormApi = FormApi<any, any, any, any, any, any, any, any, any, any, any, any>;
|
|
1757
|
-
interface ValidateOpts<TFormData> {
|
|
1758
|
-
dontUpdateFormErrorMap?: boolean;
|
|
1759
|
-
filterFieldNames?: (fieldName: DeepKeys<TFormData>) => boolean;
|
|
1760
|
-
group?: AnyFormGroupApi;
|
|
1761
|
-
}
|
|
1762
1275
|
/**
|
|
1763
1276
|
* We cannot use methods and must use arrow functions. Otherwise, our React adapters
|
|
1764
1277
|
* will break due to loss of the method when using spread.
|
|
@@ -1770,32 +1283,18 @@ interface ValidateOpts<TFormData> {
|
|
|
1770
1283
|
* hook/function like `useForm` or `createForm` to create a new instance for you that uses your framework's reactivity model.
|
|
1771
1284
|
* However, if you need to create a new instance manually, you can do so by calling the `new FormApi` constructor.
|
|
1772
1285
|
*/
|
|
1773
|
-
declare class FormApi<in out TFormData, in out TOnMount extends undefined | FormValidateOrFn<TFormData>, in out TOnChange extends undefined | FormValidateOrFn<TFormData>, in out TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>, in out TOnBlur extends undefined | FormValidateOrFn<TFormData>, in out TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>, in out TOnSubmit extends undefined | FormValidateOrFn<TFormData>, in out TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>, in out TOnDynamic extends undefined | FormValidateOrFn<TFormData>, in out TOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TFormData>, in out TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>, in out TSubmitMeta = never> implements
|
|
1286
|
+
declare class FormApi<in out TFormData, in out TOnMount extends undefined | FormValidateOrFn<TFormData>, in out TOnChange extends undefined | FormValidateOrFn<TFormData>, in out TOnChangeAsync extends undefined | FormAsyncValidateOrFn<TFormData>, in out TOnBlur extends undefined | FormValidateOrFn<TFormData>, in out TOnBlurAsync extends undefined | FormAsyncValidateOrFn<TFormData>, in out TOnSubmit extends undefined | FormValidateOrFn<TFormData>, in out TOnSubmitAsync extends undefined | FormAsyncValidateOrFn<TFormData>, in out TOnDynamic extends undefined | FormValidateOrFn<TFormData>, in out TOnDynamicAsync extends undefined | FormAsyncValidateOrFn<TFormData>, in out TOnServer extends undefined | FormAsyncValidateOrFn<TFormData>, in out TSubmitMeta = never> implements FieldManipulator<TFormData, TSubmitMeta> {
|
|
1774
1287
|
/**
|
|
1775
1288
|
* The options for the form.
|
|
1776
1289
|
*/
|
|
1777
1290
|
options: FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>;
|
|
1778
1291
|
baseStore: Store<BaseFormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer>>;
|
|
1779
1292
|
fieldMetaDerived: Store<FormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer>['fieldMeta']>;
|
|
1780
|
-
/**
|
|
1781
|
-
* A derived store of every mounted `FormGroupApi`'s `meta`, keyed by
|
|
1782
|
-
* group name. Mirrors `fieldMetaDerived` for fields: per-group `meta`
|
|
1783
|
-
* is computed once on the form (from `baseStore.formGroupStateBase`,
|
|
1784
|
-
* `fieldMetaDerived`, and the registered `formGroupApis`) so reads
|
|
1785
|
-
* from a `FormGroupApi.store` instance stay minimal.
|
|
1786
|
-
*/
|
|
1787
|
-
formGroupMetaDerived: ReadonlyStore<Record<string, AnyFormGroupMeta>>;
|
|
1788
1293
|
store: ReadonlyStore<FormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer>>;
|
|
1789
1294
|
/**
|
|
1790
1295
|
* A record of field information for each field in the form.
|
|
1791
1296
|
*/
|
|
1792
1297
|
fieldInfo: Partial<Record<DeepKeys<TFormData>, FieldInfo<TFormData>>>;
|
|
1793
|
-
/**
|
|
1794
|
-
* The set of currently-mounted `FormGroupApi` instances belonging to
|
|
1795
|
-
* this form. Used by `FieldApi.validate` to cascade field-level changes
|
|
1796
|
-
* into the validators of any group that encompasses the field.
|
|
1797
|
-
*/
|
|
1798
|
-
formGroupApis: Set<AnyFormGroupApi>;
|
|
1799
1298
|
get state(): FormState<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer>;
|
|
1800
1299
|
/**
|
|
1801
1300
|
* @private
|
|
@@ -1860,18 +1359,18 @@ declare class FormApi<in out TFormData, in out TOnMount extends undefined | Form
|
|
|
1860
1359
|
* TODO: This code is copied from FieldApi, we should refactor to share
|
|
1861
1360
|
* @private
|
|
1862
1361
|
*/
|
|
1863
|
-
validateSync: (cause: ValidationCause
|
|
1362
|
+
validateSync: (cause: ValidationCause) => {
|
|
1864
1363
|
hasErrored: boolean;
|
|
1865
1364
|
fieldsErrorMap: FormErrorMapFromValidator<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync>;
|
|
1866
1365
|
};
|
|
1867
1366
|
/**
|
|
1868
1367
|
* @private
|
|
1869
1368
|
*/
|
|
1870
|
-
validateAsync: (cause: ValidationCause
|
|
1369
|
+
validateAsync: (cause: ValidationCause) => Promise<FormErrorMapFromValidator<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync>>;
|
|
1871
1370
|
/**
|
|
1872
1371
|
* @private
|
|
1873
1372
|
*/
|
|
1874
|
-
validate: (cause: ValidationCause
|
|
1373
|
+
validate: (cause: ValidationCause) => FormErrorMapFromValidator<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync> | Promise<FormErrorMapFromValidator<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync>>;
|
|
1875
1374
|
handleSubmit(): Promise<void>;
|
|
1876
1375
|
handleSubmit(submitMeta: TSubmitMeta): Promise<void>;
|
|
1877
1376
|
/**
|
|
@@ -1885,13 +1384,7 @@ declare class FormApi<in out TFormData, in out TOnMount extends undefined | Form
|
|
|
1885
1384
|
/**
|
|
1886
1385
|
* Gets the metadata of the specified field.
|
|
1887
1386
|
*/
|
|
1888
|
-
getFieldMeta: <TField extends DeepKeys<TFormData>>(field: TField) =>
|
|
1889
|
-
/**
|
|
1890
|
-
* Gets the derived `meta` of the form group registered at the given
|
|
1891
|
-
* name. Mirrors `getFieldMeta` for fields. Returns `undefined` if no
|
|
1892
|
-
* `FormGroupApi` with that name is currently mounted.
|
|
1893
|
-
*/
|
|
1894
|
-
getFormGroupMeta: (name: string) => AnyFormGroupMeta | undefined;
|
|
1387
|
+
getFieldMeta: <TField extends DeepKeys<TFormData>>(field: TField) => AnyFieldMeta | undefined;
|
|
1895
1388
|
/**
|
|
1896
1389
|
* Gets the field info of the specified field.
|
|
1897
1390
|
*/
|
|
@@ -1899,11 +1392,11 @@ declare class FormApi<in out TFormData, in out TOnMount extends undefined | Form
|
|
|
1899
1392
|
/**
|
|
1900
1393
|
* Updates the metadata of the specified field.
|
|
1901
1394
|
*/
|
|
1902
|
-
setFieldMeta: <TField extends DeepKeys<TFormData>>(field: TField, updater: Updater<
|
|
1395
|
+
setFieldMeta: <TField extends DeepKeys<TFormData>>(field: TField, updater: Updater<AnyFieldMetaBase>) => void;
|
|
1903
1396
|
/**
|
|
1904
1397
|
* resets every field's meta
|
|
1905
1398
|
*/
|
|
1906
|
-
resetFieldMeta: <TField extends DeepKeys<TFormData>>(fieldMeta: Partial<Record<TField,
|
|
1399
|
+
resetFieldMeta: <TField extends DeepKeys<TFormData>>(fieldMeta: Partial<Record<TField, AnyFieldMeta>>) => Partial<Record<TField, AnyFieldMeta>>;
|
|
1907
1400
|
/**
|
|
1908
1401
|
* Sets the value of the specified field and optionally updates the touched state.
|
|
1909
1402
|
*/
|
|
@@ -1947,7 +1440,7 @@ declare class FormApi<in out TFormData, in out TOnMount extends undefined | Form
|
|
|
1947
1440
|
*/
|
|
1948
1441
|
getAllErrors: () => {
|
|
1949
1442
|
form: {
|
|
1950
|
-
errors: Array<
|
|
1443
|
+
errors: Array<UnwrapFormValidateOrFn<TOnMount> | UnwrapFormValidateOrFn<TOnChange> | UnwrapFormAsyncValidateOrFn<TOnChangeAsync> | UnwrapFormValidateOrFn<TOnBlur> | UnwrapFormAsyncValidateOrFn<TOnBlurAsync> | UnwrapFormValidateOrFn<TOnSubmit> | UnwrapFormAsyncValidateOrFn<TOnSubmitAsync> | UnwrapFormValidateOrFn<TOnDynamic> | UnwrapFormAsyncValidateOrFn<TOnDynamicAsync> | UnwrapFormAsyncValidateOrFn<TOnServer>>;
|
|
1951
1444
|
errorMap: ValidationErrorMap<UnwrapFormValidateOrFn<TOnMount>, UnwrapFormValidateOrFn<TOnChange>, UnwrapFormAsyncValidateOrFn<TOnChangeAsync>, UnwrapFormValidateOrFn<TOnBlur>, UnwrapFormAsyncValidateOrFn<TOnBlurAsync>, UnwrapFormValidateOrFn<TOnSubmit>, UnwrapFormAsyncValidateOrFn<TOnSubmitAsync>, UnwrapFormValidateOrFn<TOnDynamic>, UnwrapFormAsyncValidateOrFn<TOnDynamicAsync>, UnwrapFormAsyncValidateOrFn<TOnServer>>;
|
|
1952
1445
|
};
|
|
1953
1446
|
fields: Record<DeepKeys<TFormData>, {
|
|
@@ -3338,4 +2831,4 @@ declare const useTanStackForm: <TFormData, TOnMount extends FormValidateOrFn<TFo
|
|
|
3338
2831
|
}>) => ReturnType<import("react").FunctionComponent>;
|
|
3339
2832
|
//#endregion
|
|
3340
2833
|
export { SimpleTextFieldProps as A, NumberFieldProps as C, RadioOption as D, RadioGroupFieldProps as E, TextareaFieldProps as F, TextEditorFieldProps as M, TextFieldProps as N, SelectFieldProps as O, TextFieldValue as P, MultiSelectFieldValue as S, PasswordFieldProps as T, DateFieldValue as _, withTanStackForm as a, FieldRounding as b, FieldContentMain as c, FieldSeparator as d, AnyFieldProps as f, DateFieldProps as g, ComboboxFieldProps as h, withTanStackFieldGroup as i, SwitchFieldProps as j, SelectOption as k, FieldError as l, CheckboxFieldProps as m, useTanStackForm as n, Field as o, BooleanFieldValue as p, useTanStackFormContext as r, FieldContent as s, useTanStackFieldContext as t, FieldGroup as u, EmailFieldProps as v, NumberFieldValue as w, FieldType as x, FieldOrientation as y };
|
|
3341
|
-
//# sourceMappingURL=index-
|
|
2834
|
+
//# sourceMappingURL=index-BBViMxM1.d.mts.map
|