Skip to content

Commit d67dffe

Browse files
authored
Merge pull request #26 from erikras/mutators
Mutators!!
2 parents a7d261d + 5a2af3e commit d67dffe

File tree

8 files changed

+249
-279
lines changed

8 files changed

+249
-279
lines changed

.flowconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[ignore]
2+
dist
23

34
[include]
45

README.md

Lines changed: 85 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -97,76 +97,81 @@ const MyForm = () =>
9797
## Table of Contents
9898

9999
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
100+
100101
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
102+
101103
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
102104

103-
- [Examples](#examples)
104-
- [Simple Example](#simple-example)
105-
- [Synchronous Record-Level Validation](#synchronous-record-level-validation)
106-
- [Synchronous Field-Level Validation](#synchronous-field-level-validation)
107-
- [Asynchronous Field-Level Validation](#asynchronous-field-level-validation)
108-
- [Hybrid Synchronous/Asynchronous Record-Level Validation](#hybrid-synchronousasynchronous-record-level-validation)
109-
- [Submission Errors](#submission-errors)
110-
- [Third Party Components](#third-party-components)
111-
- [💥 Performance Optimization Through Subscriptions 💥](#-performance-optimization-through-subscriptions-)
112-
- [Rendering](#rendering)
113-
- [API](#api)
114-
- [`Field : React.ComponentType<FieldProps>`](#field--reactcomponenttypefieldprops)
115-
- [`Form : React.ComponentType<FormProps>`](#form--reactcomponenttypeformprops)
116-
- [`FormSpy : React.ComponentType<FormSpyProps>`](#formspy--reactcomponenttypeformspyprops)
117-
- [`version: string`](#version-string)
118-
- [Types](#types)
119-
- [`FieldProps`](#fieldprops)
120-
- [`allowNull?: boolean`](#allownull-boolean)
121-
- [`children?: ((props: FieldRenderProps) => React.Node) | React.Node`](#children-props-fieldrenderprops--reactnode--reactnode)
122-
- [`component?: React.ComponentType<FieldRenderProps>`](#component-reactcomponenttypefieldrenderprops)
123-
- [`name: string`](#name-string)
124-
- [`render?: (props: FieldRenderProps) => React.Node`](#render-props-fieldrenderprops--reactnode)
125-
- [`subscription?: FieldSubscription`](#subscription-fieldsubscription)
126-
- [`validate?: (value: ?any, allValues: Object) => ?any`](#validate-value-any-allvalues-object--any)
127-
- [`value?: any`](#value-any)
128-
- [`FieldRenderProps`](#fieldrenderprops)
129-
- [`input.name: string`](#inputname-string)
130-
- [`input.onBlur: (?SyntheticFocusEvent<*>) => void`](#inputonblur-syntheticfocusevent--void)
131-
- [`input.onChange: (SyntheticInputEvent<*> | any) => void`](#inputonchange-syntheticinputevent--any--void)
132-
- [`input.onFocus: (?SyntheticFocusEvent<*>) => void`](#inputonfocus-syntheticfocusevent--void)
133-
- [`input.value: any`](#inputvalue-any)
134-
- [`meta.active?: boolean`](#metaactive-boolean)
135-
- [`meta.dirty?: boolean`](#metadirty-boolean)
136-
- [`meta.error?: any`](#metaerror-any)
137-
- [`meta.initial?: any`](#metainitial-any)
138-
- [`meta.invalid?: boolean`](#metainvalid-boolean)
139-
- [`meta.pristine?: boolean`](#metapristine-boolean)
140-
- [`meta.submitError?: any`](#metasubmiterror-any)
141-
- [`meta.submitFailed?: boolean`](#metasubmitfailed-boolean)
142-
- [`meta.submitSucceeded?: boolean`](#metasubmitsucceeded-boolean)
143-
- [`meta.touched?: boolean`](#metatouched-boolean)
144-
- [`meta.valid?: boolean`](#metavalid-boolean)
145-
- [`meta.visited?: boolean`](#metavisited-boolean)
146-
- [`FormProps`](#formprops)
147-
- [`children?: ((props: FormRenderProps) => React.Node) | React.Node`](#children-props-formrenderprops--reactnode--reactnode)
148-
- [`component?: React.ComponentType<FormRenderProps>`](#component-reactcomponenttypeformrenderprops)
149-
- [`debug?: DebugFunction`](#debug-debugfunction)
150-
- [`initialValues?: Object`](#initialvalues-object)
151-
- [`onSubmit: (values: Object, callback: ?(errors: ?Object) => void) => ?Object | Promise<?Object> | void`](#onsubmit-values-object-callback-errors-object--void--object--promiseobject--void)
152-
- [`render?: (props: FormRenderProps) => React.Node`](#render-props-formrenderprops--reactnode)
153-
- [`subscription?: FormSubscription`](#subscription-formsubscription)
154-
- [`validate?: (values: Object) => Object | Promise<Object>`](#validate-values-object--object--promiseobject)
155-
- [`validateOnBlur?: boolean`](#validateonblur-boolean)
156-
- [`FormRenderProps`](#formrenderprops)
157-
- [`batch: (fn: () => void) => void)`](#batch-fn---void--void)
158-
- [`blur: (name: string) => void`](#blur-name-string--void)
159-
- [`change: (name: string, value: any) => void`](#change-name-string-value-any--void)
160-
- [`focus: (name: string) => void`](#focus-name-string--void)
161-
- [`handleSubmit: (SyntheticEvent<HTMLFormElement>) => void`](#handlesubmit-syntheticeventhtmlformelement--void)
162-
- [`initialize: (values: Object) => void`](#initialize-values-object--void)
163-
- [`reset: () => void`](#reset---void)
164-
- [`FormSpyProps`](#formspyprops)
165-
- [`children?: ((props: FormSpyRenderProps) => React.Node) | React.Node`](#children-props-formspyrenderprops--reactnode--reactnode)
166-
- [`component?: React.ComponentType<FormSpyRenderProps>`](#component-reactcomponenttypeformspyrenderprops)
167-
- [`render?: (props: FormSpyRenderProps) => React.Node`](#render-props-formspyrenderprops--reactnode)
168-
- [`subscription?: FormSubscription`](#subscription-formsubscription-1)
169-
- [`FormSpyRenderProps`](#formspyrenderprops)
105+
* [Examples](#examples)
106+
* [Simple Example](#simple-example)
107+
* [Synchronous Record-Level Validation](#synchronous-record-level-validation)
108+
* [Synchronous Field-Level Validation](#synchronous-field-level-validation)
109+
* [Asynchronous Field-Level Validation](#asynchronous-field-level-validation)
110+
* [Hybrid Synchronous/Asynchronous Record-Level Validation](#hybrid-synchronousasynchronous-record-level-validation)
111+
* [Submission Errors](#submission-errors)
112+
* [Third Party Components](#third-party-components)
113+
* [💥 Performance Optimization Through Subscriptions 💥](#-performance-optimization-through-subscriptions-)
114+
* [Rendering](#rendering)
115+
* [API](#api)
116+
* [`Field : React.ComponentType<FieldProps>`](#field--reactcomponenttypefieldprops)
117+
* [`Form : React.ComponentType<FormProps>`](#form--reactcomponenttypeformprops)
118+
* [`FormSpy : React.ComponentType<FormSpyProps>`](#formspy--reactcomponenttypeformspyprops)
119+
* [`version: string`](#version-string)
120+
* [Types](#types)
121+
* [`FieldProps`](#fieldprops)
122+
* [`allowNull?: boolean`](#allownull-boolean)
123+
* [`children?: ((props: FieldRenderProps) => React.Node) | React.Node`](#children-props-fieldrenderprops--reactnode--reactnode)
124+
* [`component?: React.ComponentType<FieldRenderProps>`](#component-reactcomponenttypefieldrenderprops)
125+
* [`name: string`](#name-string)
126+
* [`render?: (props: FieldRenderProps) => React.Node`](#render-props-fieldrenderprops--reactnode)
127+
* [`subscription?: FieldSubscription`](#subscription-fieldsubscription)
128+
* [`validate?: (value: ?any, allValues: Object) => ?any`](#validate-value-any-allvalues-object--any)
129+
* [`value?: any`](#value-any)
130+
* [`FieldRenderProps`](#fieldrenderprops)
131+
* [`input.name: string`](#inputname-string)
132+
* [`input.onBlur: (?SyntheticFocusEvent<*>) => void`](#inputonblur-syntheticfocusevent--void)
133+
* [`input.onChange: (SyntheticInputEvent<*> | any) => void`](#inputonchange-syntheticinputevent--any--void)
134+
* [`input.onFocus: (?SyntheticFocusEvent<*>) => void`](#inputonfocus-syntheticfocusevent--void)
135+
* [`input.value: any`](#inputvalue-any)
136+
* [`meta.active?: boolean`](#metaactive-boolean)
137+
* [`meta.data: Object`](#metadata-object)
138+
* [`meta.dirty?: boolean`](#metadirty-boolean)
139+
* [`meta.error?: any`](#metaerror-any)
140+
* [`meta.initial?: any`](#metainitial-any)
141+
* [`meta.invalid?: boolean`](#metainvalid-boolean)
142+
* [`meta.pristine?: boolean`](#metapristine-boolean)
143+
* [`meta.submitError?: any`](#metasubmiterror-any)
144+
* [`meta.submitFailed?: boolean`](#metasubmitfailed-boolean)
145+
* [`meta.submitSucceeded?: boolean`](#metasubmitsucceeded-boolean)
146+
* [`meta.touched?: boolean`](#metatouched-boolean)
147+
* [`meta.valid?: boolean`](#metavalid-boolean)
148+
* [`meta.visited?: boolean`](#metavisited-boolean)
149+
* [`FormProps`](#formprops)
150+
* [`children?: ((props: FormRenderProps) => React.Node) | React.Node`](#children-props-formrenderprops--reactnode--reactnode)
151+
* [`component?: React.ComponentType<FormRenderProps>`](#component-reactcomponenttypeformrenderprops)
152+
* [`debug?: DebugFunction`](#debug-debugfunction)
153+
* [`initialValues?: Object`](#initialvalues-object)
154+
* [`mutators?: { [string]: Mutator }`](#mutators--string-mutator-)
155+
* [`onSubmit: (values: Object, callback: ?(errors: ?Object) => void) => ?Object | Promise<?Object> | void`](#onsubmit-values-object-callback-errors-object--void--object--promiseobject--void)
156+
* [`render?: (props: FormRenderProps) => React.Node`](#render-props-formrenderprops--reactnode)
157+
* [`subscription?: FormSubscription`](#subscription-formsubscription)
158+
* [`validate?: (values: Object) => Object | Promise<Object>`](#validate-values-object--object--promiseobject)
159+
* [`validateOnBlur?: boolean`](#validateonblur-boolean)
160+
* [`FormRenderProps`](#formrenderprops)
161+
* [`batch: (fn: () => void) => void)`](#batch-fn---void--void)
162+
* [`blur: (name: string) => void`](#blur-name-string--void)
163+
* [`change: (name: string, value: any) => void`](#change-name-string-value-any--void)
164+
* [`focus: (name: string) => void`](#focus-name-string--void)
165+
* [`handleSubmit: (SyntheticEvent<HTMLFormElement>) => void`](#handlesubmit-syntheticeventhtmlformelement--void)
166+
* [`initialize: (values: Object) => void`](#initialize-values-object--void)
167+
* [`mutators?: { [string]: Function }`](#mutators--string-function-)
168+
* [`reset: () => void`](#reset---void)
169+
* [`FormSpyProps`](#formspyprops)
170+
* [`children?: ((props: FormSpyRenderProps) => React.Node) | React.Node`](#children-props-formspyrenderprops--reactnode--reactnode)
171+
* [`component?: React.ComponentType<FormSpyRenderProps>`](#component-reactcomponenttypeformspyrenderprops)
172+
* [`render?: (props: FormSpyRenderProps) => React.Node`](#render-props-formspyrenderprops--reactnode)
173+
* [`formSubscription?: FormSubscription`](#formsubscription-formsubscription)
174+
* [`FormSpyRenderProps`](#formspyrenderprops)
170175

171176
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
172177

@@ -349,6 +354,10 @@ The current value of the field.
349354

350355
[See the 🏁 Final Form docs on `active`](https://github.com/erikras/final-form#active-boolean).
351356

357+
#### `meta.data: Object`
358+
359+
[See the 🏁 Final Form docs on `data`](https://github.com/erikras/final-form#data-object).
360+
352361
#### `meta.dirty?: boolean`
353362

354363
[See the 🏁 Final Form docs on `dirty`](https://github.com/erikras/final-form#dirty-boolean).
@@ -417,6 +426,10 @@ well as any non-API props passed into the `<Form/>` component.
417426

418427
[See the 🏁 Final Form docs on `initialValues`](https://github.com/erikras/final-form#initialvalues-object).
419428

429+
#### `mutators?: { [string]: Mutator }`
430+
431+
[See the 🏁 Final Form docs on `mutators`](https://github.com/erikras/final-form#mutators--string-function-).
432+
420433
#### `onSubmit: (values: Object, callback: ?(errors: ?Object) => void) => ?Object | Promise<?Object> | void`
421434

422435
[See the 🏁 Final Form docs on `onSubmit`](https://github.com/erikras/final-form#onsubmit-values-object-callback-errors-object--void--object--promiseobject--void).
@@ -482,6 +495,10 @@ onSubmit={handleSubmit}/>`.
482495
A function that initializes the form values.
483496
[See the 🏁 Final Form docs on `initialize`](https://github.com/erikras/final-form#initialize-values-object--void).
484497

498+
#### `mutators?: { [string]: Function }`
499+
500+
[See the 🏁 Final Form docs on `mutators`](https://github.com/erikras/final-form#mutators--string-function-).
501+
485502
#### `reset: () => void`
486503

487504
A function that resets the form values to their last initialized values.
@@ -508,7 +525,7 @@ as well as any non-API props passed into the `<FormSpy/>` component.
508525
A render function that is given [`FormSpyRenderProps`](#formspyrenderprops), as
509526
well as any non-API props passed into the `<FormSpy/>` component.
510527

511-
#### `subscription?: FormSubscription`
528+
#### `formSubscription?: FormSubscription`
512529

513530
A
514531
[`FormSubscription`](https://github.com/erikras/final-form#formsubscription--string-boolean-)

0 commit comments

Comments
 (0)