mobx-formly 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/create-form.d.ts +17 -0
- package/dist/create-form.js +5 -0
- package/dist/form.d.ts +411 -0
- package/dist/form.js +612 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +2 -0
- package/dist/path-store.d.ts +38 -0
- package/dist/path-store.js +132 -0
- package/dist/types.d.ts +219 -0
- package/dist/types.js +1 -0
- package/dist/utils.d.ts +16 -0
- package/dist/utils.js +208 -0
- package/dist/validation.d.ts +52 -0
- package/dist/validation.js +232 -0
- package/package.json +10 -2
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Form } from './form.js';
|
|
2
|
+
import type { FieldValues, FormOptions, FormSchema, SchemaOutput } from './types.js';
|
|
3
|
+
export type InferredFormValues<S> = Extract<SchemaOutput<S>, FieldValues>;
|
|
4
|
+
/**
|
|
5
|
+
* Creates a form with values inferred from its schema.
|
|
6
|
+
*
|
|
7
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/guide/getting-started.html)
|
|
8
|
+
*/
|
|
9
|
+
export declare function createForm<S extends FormSchema<any>>(options: FormOptions<InferredFormValues<S>> & {
|
|
10
|
+
schema: S;
|
|
11
|
+
}): Form<InferredFormValues<S>>;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a form with an explicit values type.
|
|
14
|
+
*
|
|
15
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/guide/getting-started.html)
|
|
16
|
+
*/
|
|
17
|
+
export declare function createForm<T extends FieldValues = FieldValues>(options?: FormOptions<T>): Form<T>;
|
package/dist/form.d.ts
ADDED
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { type Ref } from 'yummies/mobx';
|
|
2
|
+
import type { ErrorNamespacePath, FieldError, FieldErrors, FieldPath, FieldPathValue, FieldStateTree, FieldValues, FormOptions, RegisterOptions, RegisterReturn, ResetFieldOptions, ResetOptions, SetErrorConfig, SetValueConfig, SubmitHandlers, TriggerConfig } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Public form contract returned by `createForm()` and implemented by `BaseForm`.
|
|
5
|
+
*
|
|
6
|
+
* Coordinates form values, field registration, validation, and submission
|
|
7
|
+
* without any rendering concerns.
|
|
8
|
+
*
|
|
9
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html)
|
|
10
|
+
*/
|
|
11
|
+
export interface Form<T extends FieldValues = FieldValues> {
|
|
12
|
+
/**
|
|
13
|
+
* Current form values.
|
|
14
|
+
*
|
|
15
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#values)
|
|
16
|
+
*/
|
|
17
|
+
values: T;
|
|
18
|
+
/**
|
|
19
|
+
* Cached default values used by reset, resetField, and dirty comparison.
|
|
20
|
+
* Updated by reset unless `keepDefaultValues` is passed.
|
|
21
|
+
*
|
|
22
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#defaultvalues)
|
|
23
|
+
*/
|
|
24
|
+
defaultValues: T;
|
|
25
|
+
/**
|
|
26
|
+
* Validation errors nested by field path.
|
|
27
|
+
*
|
|
28
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#errors)
|
|
29
|
+
*/
|
|
30
|
+
readonly errors: FieldErrors<T>;
|
|
31
|
+
/**
|
|
32
|
+
* Field paths whose values differ from their defaults.
|
|
33
|
+
*
|
|
34
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#dirtyfields)
|
|
35
|
+
*/
|
|
36
|
+
dirtyFields: Record<string, true | undefined>;
|
|
37
|
+
/**
|
|
38
|
+
* Field paths that have been touched.
|
|
39
|
+
*
|
|
40
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#touchedfields)
|
|
41
|
+
*/
|
|
42
|
+
touchedFields: Record<string, true | undefined>;
|
|
43
|
+
/**
|
|
44
|
+
* Field paths that are currently being validated.
|
|
45
|
+
*
|
|
46
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#validatingfields)
|
|
47
|
+
*/
|
|
48
|
+
validatingFields: Record<string, true | undefined>;
|
|
49
|
+
/**
|
|
50
|
+
* Observable state for each registered field, nested by field path.
|
|
51
|
+
*
|
|
52
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#fieldstate)
|
|
53
|
+
*/
|
|
54
|
+
readonly fieldState: FieldStateTree<T>;
|
|
55
|
+
/**
|
|
56
|
+
* Whether a submission is currently running.
|
|
57
|
+
*
|
|
58
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#issubmitting)
|
|
59
|
+
*/
|
|
60
|
+
isSubmitting: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Whether the form has been submitted at least once.
|
|
63
|
+
*
|
|
64
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#issubmitted)
|
|
65
|
+
*/
|
|
66
|
+
isSubmitted: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Whether the latest submission succeeded.
|
|
69
|
+
*
|
|
70
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#issubmitsuccessful)
|
|
71
|
+
*/
|
|
72
|
+
isSubmitSuccessful: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Number of submission attempts.
|
|
75
|
+
*
|
|
76
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#submitcount)
|
|
77
|
+
*/
|
|
78
|
+
submitCount: number;
|
|
79
|
+
/**
|
|
80
|
+
* Refs registered for fields.
|
|
81
|
+
*
|
|
82
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#refs)
|
|
83
|
+
*/
|
|
84
|
+
readonly refs: Map<string, Ref<HTMLElement | null>>;
|
|
85
|
+
/**
|
|
86
|
+
* Whether registered event handlers ignore changes and blur events.
|
|
87
|
+
*
|
|
88
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#disabled)
|
|
89
|
+
*/
|
|
90
|
+
readonly disabled: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Whether any field is dirty.
|
|
93
|
+
*
|
|
94
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#isdirty)
|
|
95
|
+
*/
|
|
96
|
+
readonly isDirty: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Whether any field has been touched.
|
|
99
|
+
*
|
|
100
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#istouched)
|
|
101
|
+
*/
|
|
102
|
+
readonly isTouched: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Whether any field validation is currently running.
|
|
105
|
+
*
|
|
106
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#isvalidating)
|
|
107
|
+
*/
|
|
108
|
+
readonly isValidating: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Whether the form has no errors. With a schema or resolver the first read
|
|
111
|
+
* schedules a full validation pass, so validity reflects the schema instead
|
|
112
|
+
* of defaulting to true until something validates.
|
|
113
|
+
*
|
|
114
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#isvalid)
|
|
115
|
+
*/
|
|
116
|
+
readonly isValid: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Returns a plain copy of the current values.
|
|
119
|
+
*
|
|
120
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#snapshot)
|
|
121
|
+
*/
|
|
122
|
+
readonly snapshot: T;
|
|
123
|
+
/**
|
|
124
|
+
* Registers a field and returns its ref and event handlers.
|
|
125
|
+
*
|
|
126
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#registername-options)
|
|
127
|
+
*/
|
|
128
|
+
register(name: FieldPath<T>, options?: RegisterOptions<T>): RegisterReturn;
|
|
129
|
+
/**
|
|
130
|
+
* Returns the stable MobX-aware ref for a field path, creating it on demand.
|
|
131
|
+
* The ref can be used by a view adapter before the field is registered.
|
|
132
|
+
*/
|
|
133
|
+
ref(name: FieldPath<T>): Ref<HTMLElement | null>;
|
|
134
|
+
/**
|
|
135
|
+
* Removes a field, its value, and its associated state.
|
|
136
|
+
*
|
|
137
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#unregistername)
|
|
138
|
+
*/
|
|
139
|
+
unregister(name: FieldPath<T>): void;
|
|
140
|
+
/**
|
|
141
|
+
* Updates a field value and optionally changes its state or validates it.
|
|
142
|
+
*
|
|
143
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#setvaluename-value-config)
|
|
144
|
+
*/
|
|
145
|
+
setValue<P extends FieldPath<T>>(name: P, value: FieldPathValue<T, P>, config?: SetValueConfig): void;
|
|
146
|
+
/**
|
|
147
|
+
* Groups direct value changes, reconciles all dirty paths, and optionally
|
|
148
|
+
* validates the complete form.
|
|
149
|
+
*
|
|
150
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#mutatemutator-config)
|
|
151
|
+
*/
|
|
152
|
+
mutate(mutator: () => Promise<void>, config?: SetValueConfig): Promise<void>;
|
|
153
|
+
mutate(mutator: () => void, config?: SetValueConfig): void;
|
|
154
|
+
/**
|
|
155
|
+
* Sets an error for a field and can focus it.
|
|
156
|
+
*
|
|
157
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#seterrorname-error)
|
|
158
|
+
*/
|
|
159
|
+
setError(name: FieldPath<T> | ErrorNamespacePath, error: FieldError, config?: SetErrorConfig): void;
|
|
160
|
+
/**
|
|
161
|
+
* Clears one, several, or all field errors.
|
|
162
|
+
*
|
|
163
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#clearerrorsname)
|
|
164
|
+
*/
|
|
165
|
+
clearErrors(name?: FieldPath<T> | ErrorNamespacePath | Array<FieldPath<T> | ErrorNamespacePath>): void;
|
|
166
|
+
/**
|
|
167
|
+
* Validates one field, several fields, or the complete form.
|
|
168
|
+
*
|
|
169
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#triggername)
|
|
170
|
+
*/
|
|
171
|
+
trigger(name?: FieldPath<T> | FieldPath<T>[], config?: TriggerConfig): Promise<boolean>;
|
|
172
|
+
/**
|
|
173
|
+
* Creates an asynchronous submit handler with validation and result callbacks.
|
|
174
|
+
*
|
|
175
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#handlesubmithandlers)
|
|
176
|
+
*/
|
|
177
|
+
handleSubmit(handlers: SubmitHandlers<T>): () => Promise<void>;
|
|
178
|
+
/**
|
|
179
|
+
* Resets values and selected form state.
|
|
180
|
+
*
|
|
181
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#resetvalues-options)
|
|
182
|
+
*/
|
|
183
|
+
reset(values?: Partial<T>, options?: ResetOptions): void;
|
|
184
|
+
/**
|
|
185
|
+
* Resets one field to its current default value and clears its state.
|
|
186
|
+
*
|
|
187
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#resetfieldname)
|
|
188
|
+
*/
|
|
189
|
+
resetField<P extends FieldPath<T>>(name: P, options?: ResetFieldOptions<T, P>): void;
|
|
190
|
+
/**
|
|
191
|
+
* Focuses a registered field when its ref points to a focusable element.
|
|
192
|
+
*
|
|
193
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#setfocusname)
|
|
194
|
+
*/
|
|
195
|
+
setFocus(name: FieldPath<T>): void;
|
|
196
|
+
}
|
|
197
|
+
export declare class BaseForm<T extends FieldValues = FieldValues> implements Form<T> {
|
|
198
|
+
/**
|
|
199
|
+
* Current form values.
|
|
200
|
+
*
|
|
201
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#values)
|
|
202
|
+
*/
|
|
203
|
+
values: T;
|
|
204
|
+
/**
|
|
205
|
+
* Cached default values used by reset, resetField, and dirty comparison.
|
|
206
|
+
* Updated by reset unless `keepDefaultValues` is passed.
|
|
207
|
+
*
|
|
208
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#defaultvalues)
|
|
209
|
+
*/
|
|
210
|
+
defaultValues: T;
|
|
211
|
+
private readonly errorStore;
|
|
212
|
+
private readonly fieldStateStore;
|
|
213
|
+
/** Validation errors nested by field path. */
|
|
214
|
+
get errors(): FieldErrors<T>;
|
|
215
|
+
/**
|
|
216
|
+
* Field paths whose values differ from their defaults.
|
|
217
|
+
*
|
|
218
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#dirtyfields)
|
|
219
|
+
*/
|
|
220
|
+
dirtyFields: Record<string, true | undefined>;
|
|
221
|
+
/**
|
|
222
|
+
* Field paths that have been touched.
|
|
223
|
+
*
|
|
224
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#touchedfields)
|
|
225
|
+
*/
|
|
226
|
+
touchedFields: Record<string, true | undefined>;
|
|
227
|
+
/**
|
|
228
|
+
* Field paths that are currently being validated.
|
|
229
|
+
*
|
|
230
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#validatingfields)
|
|
231
|
+
*/
|
|
232
|
+
validatingFields: Record<string, true | undefined>;
|
|
233
|
+
/**
|
|
234
|
+
* Observable state for each registered field, nested by field path.
|
|
235
|
+
*
|
|
236
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#fieldstate)
|
|
237
|
+
*/
|
|
238
|
+
get fieldState(): FieldStateTree<T>;
|
|
239
|
+
/**
|
|
240
|
+
* Whether a submission is currently running.
|
|
241
|
+
*
|
|
242
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#issubmitting)
|
|
243
|
+
*/
|
|
244
|
+
isSubmitting: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Whether the form has been submitted at least once.
|
|
247
|
+
*
|
|
248
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#issubmitted)
|
|
249
|
+
*/
|
|
250
|
+
isSubmitted: boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Whether the latest submission succeeded.
|
|
253
|
+
*
|
|
254
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#issubmitsuccessful)
|
|
255
|
+
*/
|
|
256
|
+
isSubmitSuccessful: boolean;
|
|
257
|
+
/**
|
|
258
|
+
* Number of submission attempts.
|
|
259
|
+
*
|
|
260
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#submitcount)
|
|
261
|
+
*/
|
|
262
|
+
submitCount: number;
|
|
263
|
+
/**
|
|
264
|
+
* Refs registered for fields.
|
|
265
|
+
*
|
|
266
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#refs)
|
|
267
|
+
*/
|
|
268
|
+
readonly refs: Map<string, Ref<HTMLElement | null, import("yummies/types").AnyObject>>;
|
|
269
|
+
private readonly options;
|
|
270
|
+
private readonly fieldOptions;
|
|
271
|
+
private readonly touchedValidationFields;
|
|
272
|
+
private readonly validator;
|
|
273
|
+
private activeSubmissions;
|
|
274
|
+
private resetVersion;
|
|
275
|
+
private readonly isValidOverride;
|
|
276
|
+
private validationVersion;
|
|
277
|
+
private readonly fieldValidationVersions;
|
|
278
|
+
/** Whether at least one validation pass has completed since construction or reset. */
|
|
279
|
+
private hasValidationRun;
|
|
280
|
+
/** Creates a form with optional initial values, schema, and validation settings.
|
|
281
|
+
*
|
|
282
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#constructor-options)
|
|
283
|
+
*/
|
|
284
|
+
constructor(options?: FormOptions<T>);
|
|
285
|
+
/**
|
|
286
|
+
* Whether registered event handlers ignore changes and blur events.
|
|
287
|
+
*
|
|
288
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#disabled)
|
|
289
|
+
*/
|
|
290
|
+
get disabled(): boolean;
|
|
291
|
+
/**
|
|
292
|
+
* Whether any field is dirty.
|
|
293
|
+
*
|
|
294
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#isdirty)
|
|
295
|
+
*/
|
|
296
|
+
get isDirty(): boolean;
|
|
297
|
+
/**
|
|
298
|
+
* Whether any field has been touched.
|
|
299
|
+
*
|
|
300
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#istouched)
|
|
301
|
+
*/
|
|
302
|
+
get isTouched(): boolean;
|
|
303
|
+
/** Whether any field validation is currently running. */
|
|
304
|
+
get isValidating(): boolean;
|
|
305
|
+
/**
|
|
306
|
+
* Whether the form has no errors. With a schema or resolver the first read
|
|
307
|
+
* schedules a full validation pass, so validity reflects the schema instead
|
|
308
|
+
* of defaulting to true until something validates.
|
|
309
|
+
*
|
|
310
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#isvalid)
|
|
311
|
+
*/
|
|
312
|
+
get isValid(): boolean;
|
|
313
|
+
/**
|
|
314
|
+
* Registers a field and returns its ref and event handlers.
|
|
315
|
+
*
|
|
316
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#registername-options)
|
|
317
|
+
*/
|
|
318
|
+
register(name: FieldPath<T>, options?: RegisterOptions<T>): RegisterReturn;
|
|
319
|
+
/**
|
|
320
|
+
* Returns the stable MobX-aware ref for a field path, creating it on demand.
|
|
321
|
+
* The ref can be used by a view adapter before the field is registered.
|
|
322
|
+
*/
|
|
323
|
+
ref(name: FieldPath<T>): Ref<HTMLElement | null>;
|
|
324
|
+
/**
|
|
325
|
+
* Removes a field, its value, and its associated state.
|
|
326
|
+
*
|
|
327
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#unregistername)
|
|
328
|
+
*/
|
|
329
|
+
unregister(name: FieldPath<T>): void;
|
|
330
|
+
/**
|
|
331
|
+
* Updates a field value and optionally changes its state or validates it.
|
|
332
|
+
*
|
|
333
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#setvaluename-value-config)
|
|
334
|
+
*/
|
|
335
|
+
setValue<P extends FieldPath<T>>(name: P, value: FieldPathValue<T, P>, config?: SetValueConfig): void;
|
|
336
|
+
/**
|
|
337
|
+
* Groups direct value changes, reconciles all dirty paths, and optionally
|
|
338
|
+
* validates the complete form.
|
|
339
|
+
*
|
|
340
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#mutatemutator-config)
|
|
341
|
+
*/
|
|
342
|
+
mutate(mutator: () => Promise<void>, config?: SetValueConfig): Promise<void>;
|
|
343
|
+
mutate(mutator: () => void, config?: SetValueConfig): void;
|
|
344
|
+
private finishMutation;
|
|
345
|
+
private applyValueChange;
|
|
346
|
+
/**
|
|
347
|
+
* Sets an error for a field and can focus it.
|
|
348
|
+
*
|
|
349
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#seterrorname-error)
|
|
350
|
+
*/
|
|
351
|
+
setError(name: FieldPath<T> | ErrorNamespacePath, error: FieldError, config?: SetErrorConfig): void;
|
|
352
|
+
/**
|
|
353
|
+
* Clears one, several, or all field errors.
|
|
354
|
+
*
|
|
355
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#clearerrorsname)
|
|
356
|
+
*/
|
|
357
|
+
clearErrors(name?: FieldPath<T> | ErrorNamespacePath | Array<FieldPath<T> | ErrorNamespacePath>): void;
|
|
358
|
+
/**
|
|
359
|
+
* Validates one field, several fields, or the complete form.
|
|
360
|
+
*
|
|
361
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#triggername)
|
|
362
|
+
*/
|
|
363
|
+
trigger(name?: FieldPath<T> | FieldPath<T>[], config?: TriggerConfig): Promise<boolean>;
|
|
364
|
+
private runValidation;
|
|
365
|
+
/**
|
|
366
|
+
* Creates an asynchronous submit handler with validation and result callbacks.
|
|
367
|
+
*
|
|
368
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#handlesubmithandlers)
|
|
369
|
+
*/
|
|
370
|
+
handleSubmit({ onValid, onInvalid }: SubmitHandlers<T>): () => Promise<void>;
|
|
371
|
+
/**
|
|
372
|
+
* Resets values and selected form state.
|
|
373
|
+
*
|
|
374
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#resetvalues-options)
|
|
375
|
+
*/
|
|
376
|
+
reset(values?: Partial<T>, options?: ResetOptions): void;
|
|
377
|
+
/**
|
|
378
|
+
* Resets one field to its current default value and clears its state.
|
|
379
|
+
*
|
|
380
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#resetfieldname)
|
|
381
|
+
*/
|
|
382
|
+
resetField<P extends FieldPath<T>>(name: P, options?: ResetFieldOptions<T, P>): void;
|
|
383
|
+
/**
|
|
384
|
+
* Focuses a registered field when its ref points to a focusable element.
|
|
385
|
+
*
|
|
386
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#setfocusname)
|
|
387
|
+
*/
|
|
388
|
+
setFocus(name: FieldPath<T>): void;
|
|
389
|
+
/**
|
|
390
|
+
* Returns a plain copy of the current values.
|
|
391
|
+
*
|
|
392
|
+
* [**Documentation**](https://js2me.github.io/mobx-formly/api/form.html#snapshot)
|
|
393
|
+
*/
|
|
394
|
+
get snapshot(): T;
|
|
395
|
+
/** Reconciles dirty paths against the complete current value tree. */
|
|
396
|
+
private syncDirtyFields;
|
|
397
|
+
/** Clears an exact error path and every nested error below it. */
|
|
398
|
+
private clearErrorPath;
|
|
399
|
+
/** Focuses the first errored registered field, skipping form-level errors. */
|
|
400
|
+
private focusFirstError;
|
|
401
|
+
private dependentFields;
|
|
402
|
+
private markTouched;
|
|
403
|
+
private updateDirty;
|
|
404
|
+
private shouldValidateOnChange;
|
|
405
|
+
private isValidationCurrent;
|
|
406
|
+
private transformValue;
|
|
407
|
+
private ensureFieldState;
|
|
408
|
+
private applyFieldState;
|
|
409
|
+
private applyError;
|
|
410
|
+
private hasError;
|
|
411
|
+
}
|