@deckstar/final-form
Advanced tools
Comparing version 1.0.11 to 1.0.12
@@ -886,4 +886,4 @@ "use strict"; | ||
// still waiting on async validation to complete... | ||
Promise.all(asyncValidationPromisesKeys.map((key) => asyncValidationPromises[Number(key)])).then(api.submit, console.error); | ||
return; | ||
const submissionPromise = Promise.all(asyncValidationPromisesKeys.map((key) => asyncValidationPromises[Number(key)])).then(api.submit, console.error); | ||
return submissionPromise; | ||
} | ||
@@ -890,0 +890,0 @@ const submitIsBlocked = beforeSubmit(); |
@@ -161,3 +161,3 @@ import fieldSubscriptionItems from "./fieldSubscriptionItems"; | ||
* `true` if the form values have ever been changed | ||
* since the last submission. false otherwise. | ||
* since the last submission. `false` otherwise. | ||
*/ | ||
@@ -185,3 +185,3 @@ modifiedSinceLastSubmit: boolean; | ||
* The whole-form submission error returned by | ||
* `onSubmit` under the `FORM_ERROR` key. | ||
* {@linkcode Config.onSubmit | onSubmit} under the `FORM_ERROR` key. | ||
*/ | ||
@@ -252,3 +252,3 @@ submitError: any | undefined; | ||
* values. **Depending on your subscription when calling | ||
* `form.registerField()`, some of the values may not be | ||
* {@linkcode FormApi.registerField | form.registerField()}, some of the values may not be | ||
* present.** | ||
@@ -271,3 +271,3 @@ */ | ||
* `true` when the value of the field is not equal to | ||
* the initial value (using the `isEqual` comparator | ||
* the initial value (using the {@linkcode FieldConfig.isEqual | isEqual} comparator | ||
* provided at field registration), `false` if the | ||
@@ -279,3 +279,3 @@ * values are equal. | ||
* `true` when the value of the field is not equal to | ||
* the value last submitted (using the `isEqual` | ||
* the value last submitted (using the {@linkcode FieldConfig.isEqual | isEqual} | ||
* comparator provided at field registration), `false` | ||
@@ -310,3 +310,4 @@ * if the values are equal. | ||
* | ||
* Once `true`, it will remain `true` for the lifetime * of the field, or until the form or field state is | ||
* Once `true`, it will remain `true` for the lifetime | ||
* of the field, or until the form or field state is | ||
* reset. | ||
@@ -417,3 +418,3 @@ */ | ||
/** | ||
* A function to call just before calling `onSubmit`. | ||
* A function to call just before calling {@linkcode Config.onSubmit | onSubmit}. | ||
* | ||
@@ -434,4 +435,4 @@ * If `beforeSubmit` returns `false`, the submission | ||
* The value of the field upon creation only if both | ||
* the field's `initialValue` is `undefined` and the | ||
* value from the form's `initialValues` is also | ||
* the field's {@linkcode FieldConfig.initialValue | initialValue} is `undefined` and the | ||
* value from the form's {@linkcode Config.initialValues | initialValues} is also | ||
* `undefined`. The field will be `dirty` when | ||
@@ -455,3 +456,3 @@ * `defaultValue` is used. | ||
* set one value with `initialValue` and set the value | ||
* of the field with `defaultValue`. | ||
* of the field with {@linkcode FieldConfig.defaultValue | defaultValue}. | ||
* | ||
@@ -531,3 +532,3 @@ * The value given here will override any | ||
* Whether the form was reset while in the process | ||
* of being submitted (i.e. while `submitting` was | ||
* of being submitted (i.e. while {@linkcode FormState.submitting | submitting} was | ||
* `true`). | ||
@@ -575,3 +576,3 @@ */ | ||
* A read/write property to get and set the | ||
* `destroyOnUnregister` config setting. | ||
* {@linkcode Config.destroyOnUnregister | destroyOnUnregister} config setting. | ||
*/ | ||
@@ -583,3 +584,3 @@ destroyOnUnregister: boolean; | ||
* Returns the state of a specific field, of type | ||
* `FieldState`, as it was last reported to its | ||
* {@linkcode FieldState}, as it was last reported to its | ||
* listeners, or `undefined` if the field has not been | ||
@@ -615,3 +616,3 @@ * registered. | ||
* The state-bound versions of the mutators provided to | ||
* `Config`. | ||
* {@linkcode Config}. | ||
*/ | ||
@@ -621,3 +622,3 @@ mutators: BoundMutators<Mutators<FormValues>, FormValues>; | ||
* If called, validation will be paused until | ||
* `resumeValidation()` is called. | ||
* {@linkcode FormApi.resumeValidation | resumeValidation()} is called. | ||
* | ||
@@ -645,5 +646,5 @@ * By default, `pauseValidation` also prevents all | ||
* Related: | ||
* - [`FieldState`](FieldState) | ||
* - [`FieldConfig`](FieldConfig) | ||
* - [`Unsubscribe`](Unsubscribe) | ||
* - {@linkcode FieldState} | ||
* - {@linkcode FieldConfig} | ||
* - {@linkcode Unsubscribe} | ||
*/ | ||
@@ -655,4 +656,4 @@ registerField: RegisterField<FormValues>; | ||
* if the form was not initialized. If you provide | ||
* `initialValues` they will be used as the new initial | ||
* values. | ||
* {@linkcode Config.initialValues | initialValues} | ||
* they will be used as the new initial values. | ||
* | ||
@@ -675,3 +676,3 @@ * Note that if you are calling `reset()` and not | ||
* `reset(initialValues)` on the form and | ||
* `resetFieldState()` for each field. Form should be | ||
* {@linkcode FormApi.resetFieldState | resetFieldState()} for each field. Form should be | ||
* just as it was when it was first created. | ||
@@ -681,3 +682,3 @@ */ | ||
/** | ||
* Resumes validation paused by `pauseValidation()`. If | ||
* Resumes validation paused by {@linkcode FormApi.pauseValidation | pauseValidation()}. If | ||
* validation was blocked while it was paused, | ||
@@ -688,3 +689,3 @@ * validation will be run. | ||
/** | ||
* Sets fields on the `Config` object. | ||
* Sets fields on the {@linkcode Config} object. | ||
*/ | ||
@@ -706,3 +707,3 @@ setConfig: <K extends ConfigKey>(name: K, value: Config<FormValues>[K]) => void; | ||
* validation errors. It may return `undefined` or a | ||
* `Promise` depending on the nature of the `onSubmit` | ||
* `Promise` depending on the nature of the {@linkcode Config.onSubmit | onSubmit} | ||
* configuration value given to the form when it was | ||
@@ -719,4 +720,4 @@ * created. | ||
* Related: | ||
* - [`FormState`](FormState) | ||
* - [`Unsubscribe`](Unsubscribe) | ||
* - {@linkcode FormState} | ||
* - {@linkcode Unsubscribe} | ||
*/ | ||
@@ -729,3 +730,3 @@ subscribe: <Subscription extends FormSubscription = {}>(subscriber: FormSubscriber<FormValues, Subscription>, subscription: Subscription) => Unsubscribe; | ||
/** | ||
* Unless you're writing a `Mutator`, ignore this. | ||
* Unless you're writing a {@linkcode Mutator}, ignore this. | ||
*/ | ||
@@ -738,3 +739,3 @@ export interface MutableState<FormValues extends FormValuesShape = FormValuesShape> { | ||
/** | ||
* An object of values very similar to `FieldState`. | ||
* An object of values very similar to {@linkcode FieldState}. | ||
* | ||
@@ -749,7 +750,7 @@ * Note that the fields are kept in a flat structure, | ||
}; | ||
/** An object very similar to `FormState`. */ | ||
/** An object very similar to {@linkcode FormState}. */ | ||
formState: InternalFormState<FormValues>; | ||
/** | ||
* The last form state sent to form subscribers. The | ||
* object very similar to `FormState`. | ||
* object is very similar to {@linkcode FormState}. | ||
*/ | ||
@@ -763,3 +764,3 @@ lastFormState?: FormState<FormValues>; | ||
* | ||
* This is the bound version of the mutator that's available from the `FormApi`. | ||
* This is the bound version of the mutator that's available from the {@linkcode FormApi}. | ||
*/ | ||
@@ -770,3 +771,3 @@ export type BoundMutator<UnboundMutator extends Mutator<Arguments, Result, FormValues>, Arguments extends any[] = [], Result extends any = any, FormValues extends FormValuesShape = FormValuesShape> = (...args: Parameters<UnboundMutator>[0]) => ReturnType<UnboundMutator>; | ||
* | ||
* These are the bound versions of the mutators that are available from the `FormApi`. | ||
* These are the bound versions of the mutators that are available from the {@linkcode FormApi}. | ||
*/ | ||
@@ -776,3 +777,3 @@ export type BoundMutators<UnboundMutators extends Mutators<FormValues> = {}, FormValues extends FormValuesShape = FormValuesShape> = { | ||
}; | ||
/** Tools that will be passed into the functions used as `mutators`. */ | ||
/** Tools that will be passed into the functions used as {@linkcode Config.mutators | mutators}. */ | ||
export interface Tools<FormValues extends FormValuesShape = FormValuesShape> extends Pick<FormApi, "resetFieldState" | "setStatus"> { | ||
@@ -785,3 +786,3 @@ /** | ||
* Related: | ||
* - `MutableState` | ||
* - {@linkcode MutableState} | ||
*/ | ||
@@ -804,3 +805,3 @@ changeValue: ChangeValue<FormValues>; | ||
* Related: | ||
* - `MutableState` | ||
* - {@linkcode MutableState} | ||
*/ | ||
@@ -868,4 +869,4 @@ renameField: RenameField<FormValues>; | ||
* Related: | ||
* - [`FormState`](FormState) | ||
* - [`FieldState`](FieldState) | ||
* - {@linkcode FormState} | ||
* - {@linkcode FieldState} | ||
*/ | ||
@@ -892,3 +893,3 @@ debug?: DebugFunction<FormValues>; | ||
* the same type as the object given to your | ||
* `onSubmit` function. | ||
* {@linkcode Config.onSubmit | onSubmit} function. | ||
*/ | ||
@@ -906,7 +907,7 @@ initialValues?: InitialFormValues<FormValues>; | ||
keepDirtyOnReinitialize?: boolean; | ||
/** Named `Mutator` functions. */ | ||
/** Named {@linkcode Mutator} functions. */ | ||
mutators?: Mutators | Mutators<FormValues>; | ||
/** | ||
* Function to call when the form is submitted. There | ||
* are three possible ways to write an `onSubmit` | ||
* are three possible ways to write an {@linkcode Config.onSubmit | onSubmit} | ||
* function: | ||
@@ -942,3 +943,3 @@ * | ||
* Related: | ||
* - `FormApi` | ||
* - {@linkcode FormApi} | ||
*/ | ||
@@ -985,3 +986,3 @@ onSubmit: (values: FormValues, form: FormApi<FormValues>, callback?: (errors?: SubmissionErrors) => void) => SubmissionErrors | Promise<SubmissionErrors> | void; | ||
* a form by subscribing to it and making changes as the | ||
* form state changes, and returns an `Unsubscribe` | ||
* form state changes, and returns an {@linkcode Unsubscribe} | ||
* function to detach itself from the form. e.g. | ||
@@ -991,4 +992,4 @@ * [Final Form Calculate](https://github.com/final-form/final-form-calculate). | ||
* Related: | ||
* - `FormApi` | ||
* - `Unsubscribe` | ||
* - {@linkcode FormApi} | ||
* - {@linkcode Unsubscribe} | ||
* | ||
@@ -995,0 +996,0 @@ * ## Example Usage |
@@ -880,4 +880,4 @@ /* eslint-disable @typescript-eslint/no-dynamic-delete */ | ||
// still waiting on async validation to complete... | ||
Promise.all(asyncValidationPromisesKeys.map((key) => asyncValidationPromises[Number(key)])).then(api.submit, console.error); | ||
return; | ||
const submissionPromise = Promise.all(asyncValidationPromisesKeys.map((key) => asyncValidationPromises[Number(key)])).then(api.submit, console.error); | ||
return submissionPromise; | ||
} | ||
@@ -884,0 +884,0 @@ const submitIsBlocked = beforeSubmit(); |
@@ -161,3 +161,3 @@ import fieldSubscriptionItems from "./fieldSubscriptionItems"; | ||
* `true` if the form values have ever been changed | ||
* since the last submission. false otherwise. | ||
* since the last submission. `false` otherwise. | ||
*/ | ||
@@ -185,3 +185,3 @@ modifiedSinceLastSubmit: boolean; | ||
* The whole-form submission error returned by | ||
* `onSubmit` under the `FORM_ERROR` key. | ||
* {@linkcode Config.onSubmit | onSubmit} under the `FORM_ERROR` key. | ||
*/ | ||
@@ -252,3 +252,3 @@ submitError: any | undefined; | ||
* values. **Depending on your subscription when calling | ||
* `form.registerField()`, some of the values may not be | ||
* {@linkcode FormApi.registerField | form.registerField()}, some of the values may not be | ||
* present.** | ||
@@ -271,3 +271,3 @@ */ | ||
* `true` when the value of the field is not equal to | ||
* the initial value (using the `isEqual` comparator | ||
* the initial value (using the {@linkcode FieldConfig.isEqual | isEqual} comparator | ||
* provided at field registration), `false` if the | ||
@@ -279,3 +279,3 @@ * values are equal. | ||
* `true` when the value of the field is not equal to | ||
* the value last submitted (using the `isEqual` | ||
* the value last submitted (using the {@linkcode FieldConfig.isEqual | isEqual} | ||
* comparator provided at field registration), `false` | ||
@@ -310,3 +310,4 @@ * if the values are equal. | ||
* | ||
* Once `true`, it will remain `true` for the lifetime * of the field, or until the form or field state is | ||
* Once `true`, it will remain `true` for the lifetime | ||
* of the field, or until the form or field state is | ||
* reset. | ||
@@ -417,3 +418,3 @@ */ | ||
/** | ||
* A function to call just before calling `onSubmit`. | ||
* A function to call just before calling {@linkcode Config.onSubmit | onSubmit}. | ||
* | ||
@@ -434,4 +435,4 @@ * If `beforeSubmit` returns `false`, the submission | ||
* The value of the field upon creation only if both | ||
* the field's `initialValue` is `undefined` and the | ||
* value from the form's `initialValues` is also | ||
* the field's {@linkcode FieldConfig.initialValue | initialValue} is `undefined` and the | ||
* value from the form's {@linkcode Config.initialValues | initialValues} is also | ||
* `undefined`. The field will be `dirty` when | ||
@@ -455,3 +456,3 @@ * `defaultValue` is used. | ||
* set one value with `initialValue` and set the value | ||
* of the field with `defaultValue`. | ||
* of the field with {@linkcode FieldConfig.defaultValue | defaultValue}. | ||
* | ||
@@ -531,3 +532,3 @@ * The value given here will override any | ||
* Whether the form was reset while in the process | ||
* of being submitted (i.e. while `submitting` was | ||
* of being submitted (i.e. while {@linkcode FormState.submitting | submitting} was | ||
* `true`). | ||
@@ -575,3 +576,3 @@ */ | ||
* A read/write property to get and set the | ||
* `destroyOnUnregister` config setting. | ||
* {@linkcode Config.destroyOnUnregister | destroyOnUnregister} config setting. | ||
*/ | ||
@@ -583,3 +584,3 @@ destroyOnUnregister: boolean; | ||
* Returns the state of a specific field, of type | ||
* `FieldState`, as it was last reported to its | ||
* {@linkcode FieldState}, as it was last reported to its | ||
* listeners, or `undefined` if the field has not been | ||
@@ -615,3 +616,3 @@ * registered. | ||
* The state-bound versions of the mutators provided to | ||
* `Config`. | ||
* {@linkcode Config}. | ||
*/ | ||
@@ -621,3 +622,3 @@ mutators: BoundMutators<Mutators<FormValues>, FormValues>; | ||
* If called, validation will be paused until | ||
* `resumeValidation()` is called. | ||
* {@linkcode FormApi.resumeValidation | resumeValidation()} is called. | ||
* | ||
@@ -645,5 +646,5 @@ * By default, `pauseValidation` also prevents all | ||
* Related: | ||
* - [`FieldState`](FieldState) | ||
* - [`FieldConfig`](FieldConfig) | ||
* - [`Unsubscribe`](Unsubscribe) | ||
* - {@linkcode FieldState} | ||
* - {@linkcode FieldConfig} | ||
* - {@linkcode Unsubscribe} | ||
*/ | ||
@@ -655,4 +656,4 @@ registerField: RegisterField<FormValues>; | ||
* if the form was not initialized. If you provide | ||
* `initialValues` they will be used as the new initial | ||
* values. | ||
* {@linkcode Config.initialValues | initialValues} | ||
* they will be used as the new initial values. | ||
* | ||
@@ -675,3 +676,3 @@ * Note that if you are calling `reset()` and not | ||
* `reset(initialValues)` on the form and | ||
* `resetFieldState()` for each field. Form should be | ||
* {@linkcode FormApi.resetFieldState | resetFieldState()} for each field. Form should be | ||
* just as it was when it was first created. | ||
@@ -681,3 +682,3 @@ */ | ||
/** | ||
* Resumes validation paused by `pauseValidation()`. If | ||
* Resumes validation paused by {@linkcode FormApi.pauseValidation | pauseValidation()}. If | ||
* validation was blocked while it was paused, | ||
@@ -688,3 +689,3 @@ * validation will be run. | ||
/** | ||
* Sets fields on the `Config` object. | ||
* Sets fields on the {@linkcode Config} object. | ||
*/ | ||
@@ -706,3 +707,3 @@ setConfig: <K extends ConfigKey>(name: K, value: Config<FormValues>[K]) => void; | ||
* validation errors. It may return `undefined` or a | ||
* `Promise` depending on the nature of the `onSubmit` | ||
* `Promise` depending on the nature of the {@linkcode Config.onSubmit | onSubmit} | ||
* configuration value given to the form when it was | ||
@@ -719,4 +720,4 @@ * created. | ||
* Related: | ||
* - [`FormState`](FormState) | ||
* - [`Unsubscribe`](Unsubscribe) | ||
* - {@linkcode FormState} | ||
* - {@linkcode Unsubscribe} | ||
*/ | ||
@@ -729,3 +730,3 @@ subscribe: <Subscription extends FormSubscription = {}>(subscriber: FormSubscriber<FormValues, Subscription>, subscription: Subscription) => Unsubscribe; | ||
/** | ||
* Unless you're writing a `Mutator`, ignore this. | ||
* Unless you're writing a {@linkcode Mutator}, ignore this. | ||
*/ | ||
@@ -738,3 +739,3 @@ export interface MutableState<FormValues extends FormValuesShape = FormValuesShape> { | ||
/** | ||
* An object of values very similar to `FieldState`. | ||
* An object of values very similar to {@linkcode FieldState}. | ||
* | ||
@@ -749,7 +750,7 @@ * Note that the fields are kept in a flat structure, | ||
}; | ||
/** An object very similar to `FormState`. */ | ||
/** An object very similar to {@linkcode FormState}. */ | ||
formState: InternalFormState<FormValues>; | ||
/** | ||
* The last form state sent to form subscribers. The | ||
* object very similar to `FormState`. | ||
* object is very similar to {@linkcode FormState}. | ||
*/ | ||
@@ -763,3 +764,3 @@ lastFormState?: FormState<FormValues>; | ||
* | ||
* This is the bound version of the mutator that's available from the `FormApi`. | ||
* This is the bound version of the mutator that's available from the {@linkcode FormApi}. | ||
*/ | ||
@@ -770,3 +771,3 @@ export type BoundMutator<UnboundMutator extends Mutator<Arguments, Result, FormValues>, Arguments extends any[] = [], Result extends any = any, FormValues extends FormValuesShape = FormValuesShape> = (...args: Parameters<UnboundMutator>[0]) => ReturnType<UnboundMutator>; | ||
* | ||
* These are the bound versions of the mutators that are available from the `FormApi`. | ||
* These are the bound versions of the mutators that are available from the {@linkcode FormApi}. | ||
*/ | ||
@@ -776,3 +777,3 @@ export type BoundMutators<UnboundMutators extends Mutators<FormValues> = {}, FormValues extends FormValuesShape = FormValuesShape> = { | ||
}; | ||
/** Tools that will be passed into the functions used as `mutators`. */ | ||
/** Tools that will be passed into the functions used as {@linkcode Config.mutators | mutators}. */ | ||
export interface Tools<FormValues extends FormValuesShape = FormValuesShape> extends Pick<FormApi, "resetFieldState" | "setStatus"> { | ||
@@ -785,3 +786,3 @@ /** | ||
* Related: | ||
* - `MutableState` | ||
* - {@linkcode MutableState} | ||
*/ | ||
@@ -804,3 +805,3 @@ changeValue: ChangeValue<FormValues>; | ||
* Related: | ||
* - `MutableState` | ||
* - {@linkcode MutableState} | ||
*/ | ||
@@ -868,4 +869,4 @@ renameField: RenameField<FormValues>; | ||
* Related: | ||
* - [`FormState`](FormState) | ||
* - [`FieldState`](FieldState) | ||
* - {@linkcode FormState} | ||
* - {@linkcode FieldState} | ||
*/ | ||
@@ -892,3 +893,3 @@ debug?: DebugFunction<FormValues>; | ||
* the same type as the object given to your | ||
* `onSubmit` function. | ||
* {@linkcode Config.onSubmit | onSubmit} function. | ||
*/ | ||
@@ -906,7 +907,7 @@ initialValues?: InitialFormValues<FormValues>; | ||
keepDirtyOnReinitialize?: boolean; | ||
/** Named `Mutator` functions. */ | ||
/** Named {@linkcode Mutator} functions. */ | ||
mutators?: Mutators | Mutators<FormValues>; | ||
/** | ||
* Function to call when the form is submitted. There | ||
* are three possible ways to write an `onSubmit` | ||
* are three possible ways to write an {@linkcode Config.onSubmit | onSubmit} | ||
* function: | ||
@@ -942,3 +943,3 @@ * | ||
* Related: | ||
* - `FormApi` | ||
* - {@linkcode FormApi} | ||
*/ | ||
@@ -985,3 +986,3 @@ onSubmit: (values: FormValues, form: FormApi<FormValues>, callback?: (errors?: SubmissionErrors) => void) => SubmissionErrors | Promise<SubmissionErrors> | void; | ||
* a form by subscribing to it and making changes as the | ||
* form state changes, and returns an `Unsubscribe` | ||
* form state changes, and returns an {@linkcode Unsubscribe} | ||
* function to detach itself from the form. e.g. | ||
@@ -991,4 +992,4 @@ * [Final Form Calculate](https://github.com/final-form/final-form-calculate). | ||
* Related: | ||
* - `FormApi` | ||
* - `Unsubscribe` | ||
* - {@linkcode FormApi} | ||
* - {@linkcode Unsubscribe} | ||
* | ||
@@ -995,0 +996,0 @@ * ## Example Usage |
{ | ||
"name": "@deckstar/final-form", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "🏁 Framework agnostic, high performance, subscription-based form state management. Made with TypeScript.", | ||
@@ -35,3 +35,3 @@ "main": "dist/cjs", | ||
], | ||
"gitHead": "584f335dbb8f0dee28a21c85e21da0f3ce5e09a8" | ||
"gitHead": "94877ffd58045410dd9f9cd9cd0b0c6212bfc6c1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
299619
5012