@formisch/solid 0.11.0 → 0.12.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/README.md +1 -1
- package/dist/dev.js +125 -95
- package/dist/dev.jsx +130 -95
- package/dist/index.d.ts +477 -160
- package/dist/index.js +125 -95
- package/dist/index.jsx +130 -95
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,177 @@ import { JSX } from "solid-js";
|
|
|
3
3
|
|
|
4
4
|
//#region ../../packages/core/dist/index.solid.d.ts
|
|
5
5
|
|
|
6
|
+
//#region src/types/utils/utils.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Checks if a type is `any`.
|
|
9
|
+
*/
|
|
10
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
11
|
+
/**
|
|
12
|
+
* Checks if a type is `never`.
|
|
13
|
+
*/
|
|
14
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
15
|
+
/**
|
|
16
|
+
* Constructs a type that is maybe a promise.
|
|
17
|
+
*/
|
|
18
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
19
|
+
/**
|
|
20
|
+
* Makes all properties deeply optional.
|
|
21
|
+
*/
|
|
22
|
+
type DeepPartial<TValue> = TValue extends Record<PropertyKey, unknown> | readonly unknown[] ? { [TKey in keyof TValue]?: DeepPartial<TValue[TKey]> | undefined } : TValue | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Makes all value properties optional.
|
|
25
|
+
*
|
|
26
|
+
* Hint: For dynamic arrays, only plain objects and nested arrays have their
|
|
27
|
+
* values made optional. Primitives and class instances are kept as-is to avoid
|
|
28
|
+
* types like `(string | undefined)[]`.
|
|
29
|
+
*/
|
|
30
|
+
type PartialValues<TValue> = TValue extends readonly (infer TItem)[] ? number extends TValue["length"] ? (TItem extends Record<PropertyKey, unknown> | readonly unknown[] ? { [TKey in keyof TItem]: PartialValues<TItem[TKey]> } : TItem)[] : { [TKey in keyof TValue]: PartialValues<TValue[TKey]> } : TValue extends Record<PropertyKey, unknown> ? { [TKey in keyof TValue]: PartialValues<TValue[TKey]> } : TValue | undefined;
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/types/path/path.d.ts
|
|
33
|
+
/**
|
|
34
|
+
* Path key type.
|
|
35
|
+
*/
|
|
36
|
+
type PathKey = string | number;
|
|
37
|
+
/**
|
|
38
|
+
* Path type.
|
|
39
|
+
*/
|
|
40
|
+
type Path = readonly PathKey[];
|
|
41
|
+
/**
|
|
42
|
+
* Required path type.
|
|
43
|
+
*/
|
|
44
|
+
type RequiredPath = readonly [PathKey, ...Path];
|
|
45
|
+
/**
|
|
46
|
+
* Extracts the exact keys of a tuple, array or object. Tuples return their
|
|
47
|
+
* literal numeric indices, dynamic arrays return `number`, objects return
|
|
48
|
+
* their `keyof` keys, and any other input returns `never`.
|
|
49
|
+
*/
|
|
50
|
+
type ExactKeysOf<TValue> = IsAny<TValue> extends true ? never : TValue extends readonly unknown[] ? number extends TValue["length"] ? number : { [TKey in keyof TValue]: TKey extends `${infer TIndex extends number}` ? TIndex : never }[number] : TValue extends Record<PropertyKey, unknown> ? keyof TValue & PathKey : never;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the flat object of all indexable properties of `TValue`. For object
|
|
53
|
+
* unions, properties from every member are merged so that any single property
|
|
54
|
+
* is accessible. For primitives and other non-indexable types, the result is
|
|
55
|
+
* `{}`.
|
|
56
|
+
*
|
|
57
|
+
* Hint: This is necessary to make properties accessible across union members.
|
|
58
|
+
* By default, properties that do not exist in all union options are not
|
|
59
|
+
* accessible and result in "any" when accessed.
|
|
60
|
+
*/
|
|
61
|
+
type PropertiesOf<TValue> = { [TKey in ExactKeysOf<TValue>]: TValue extends Record<TKey, infer TItem> ? TItem : never };
|
|
62
|
+
/**
|
|
63
|
+
* Lazily evaluates only the first valid path segment based on the given value.
|
|
64
|
+
*/
|
|
65
|
+
type LazyPath<TValue, TPathToCheck extends Path, TValidPath extends Path = readonly []> = TPathToCheck extends readonly [] ? TValidPath : TPathToCheck extends readonly [infer TFirstKey extends ExactKeysOf<TValue>, ...infer TPathRest extends Path] ? LazyPath<Required<PropertiesOf<TValue>[TFirstKey]>, TPathRest, readonly [...TValidPath, TFirstKey]> : IsNever<ExactKeysOf<TValue>> extends false ? readonly [...TValidPath, ExactKeysOf<TValue>] : TValidPath;
|
|
66
|
+
/**
|
|
67
|
+
* Returns the path if valid, otherwise the first possible valid path based on
|
|
68
|
+
* the given value.
|
|
69
|
+
*/
|
|
70
|
+
type ValidPath<TValue, TPath extends RequiredPath> = TPath extends LazyPath<Required<TValue>, TPath> ? TPath : LazyPath<Required<TValue>, TPath>;
|
|
71
|
+
/**
|
|
72
|
+
* Detects whether the consuming project is configured with
|
|
73
|
+
* `exactOptionalPropertyTypes: true`.
|
|
74
|
+
*
|
|
75
|
+
* Hint: If `false` the built-in `Required<T>` strips `| undefined` from
|
|
76
|
+
* optional properties, so `Required<{ key?: undefined }>['key']` collapses
|
|
77
|
+
* to `never` — under strict mode the same expression yields `undefined`.
|
|
78
|
+
*/
|
|
79
|
+
type IsExactOptionalProps = Required<{
|
|
80
|
+
key?: undefined;
|
|
81
|
+
}>["key"] extends never ? false : true;
|
|
82
|
+
/**
|
|
83
|
+
* Like the built-in `Required<T>`, but preserves `| undefined` in two
|
|
84
|
+
* places where `Required<T>` strips it:
|
|
85
|
+
*
|
|
86
|
+
* 1. Optional property values under `exactOptionalPropertyTypes: false`
|
|
87
|
+
* — without this, input typings for `v.optional`/`v.nullish` schemas
|
|
88
|
+
* narrow incorrectly (issue #15).
|
|
89
|
+
* 2. Array/tuple element types — e.g. `(string | undefined)[]` stays
|
|
90
|
+
* `(string | undefined)[]` instead of becoming `string[]`. Arrays
|
|
91
|
+
* fall through unchanged because they only have a numeric index
|
|
92
|
+
* signature and don't structurally extend `Record<PropertyKey,
|
|
93
|
+
* unknown>` (which requires string keys).
|
|
94
|
+
*/
|
|
95
|
+
type ExactRequired<TValue> = TValue extends Record<PropertyKey, unknown> ? IsExactOptionalProps extends true ? Required<TValue> : { [TKey in keyof Required<TValue>]: TValue[TKey] } : TValue;
|
|
96
|
+
/**
|
|
97
|
+
* Extracts the value type at the given path.
|
|
98
|
+
*/
|
|
99
|
+
type PathValue<TValue, TPath extends Path> = TPath extends readonly [infer TKey, ...infer TRest extends Path] ? TKey extends ExactKeysOf<ExactRequired<TValue>> ? PathValue<PropertiesOf<ExactRequired<TValue>>[TKey], TRest> : unknown : TValue;
|
|
100
|
+
/**
|
|
101
|
+
* Checks whether a value is a dynamic array or contains one anywhere in its
|
|
102
|
+
* shape. A fixed-length tuple is not itself a dynamic array, but it counts when
|
|
103
|
+
* it contains one, so paths can still navigate through tuples to reach nested
|
|
104
|
+
* arrays.
|
|
105
|
+
*
|
|
106
|
+
* Hint: The inner conditionals (`TValue extends readonly unknown[]` and
|
|
107
|
+
* `TValue extends Record<PropertyKey, unknown>`) distribute over union members,
|
|
108
|
+
* so the inner expression returns the union of each member's result (e.g.
|
|
109
|
+
* `true | false` when some members contain arrays and others don't).
|
|
110
|
+
* Downstream code uses `IsOrHasArray<T> extends true`, but
|
|
111
|
+
* `boolean extends true` is `false` — so we collapse the result via
|
|
112
|
+
* `true extends ...`, which is `true` whenever at least one union member
|
|
113
|
+
* contributed `true`.
|
|
114
|
+
*/
|
|
115
|
+
type IsOrHasArray<TValue> = true extends (IsAny<TValue> extends true ? false : TValue extends readonly unknown[] ? number extends TValue["length"] ? true : IsOrHasArray<TValue[number]> : TValue extends Record<PropertyKey, unknown> ? { [TKey in keyof TValue]: IsOrHasArray<TValue[TKey]> }[keyof TValue] : false) ? true : false;
|
|
116
|
+
/**
|
|
117
|
+
* Extracts the exact keys of a tuple, array or object that contain arrays.
|
|
118
|
+
*/
|
|
119
|
+
type ExactKeysOfArrayPath<TValue> = IsAny<TValue> extends true ? never : TValue extends readonly (infer TItem)[] ? number extends TValue["length"] ? IsOrHasArray<TItem> extends true ? number : never : { [TKey in keyof TValue]: TKey extends `${infer TIndex extends number}` ? IsOrHasArray<NonNullable<TValue[TKey]>> extends true ? TIndex : never : never }[number] : TValue extends Record<PropertyKey, unknown> ? { [TKey in keyof TValue]: IsOrHasArray<NonNullable<TValue[TKey]>> extends true ? TKey : never }[keyof TValue] & PathKey : never;
|
|
120
|
+
/**
|
|
121
|
+
* Returns the flat object of indexable properties of `TValue` whose values
|
|
122
|
+
* are or contain arrays. Mirrors `PropertiesOf` but keyed by
|
|
123
|
+
* `ExactKeysOfArrayPath` so the lookup is provably valid for array-path
|
|
124
|
+
* navigation in `LazyArrayPath`.
|
|
125
|
+
*/
|
|
126
|
+
type PropertiesOfArrayPath<TValue> = { [TKey in ExactKeysOfArrayPath<TValue>]: TValue extends Record<TKey, infer TItem> ? TItem : never };
|
|
127
|
+
/**
|
|
128
|
+
* Lazily evaluates only the first valid array path segment based on the given value.
|
|
129
|
+
*/
|
|
130
|
+
type LazyArrayPath<TValue, TPathToCheck extends Path, TValidPath extends Path = readonly []> = TPathToCheck extends readonly [] ? TValue extends readonly unknown[] ? number extends TValue["length"] ? TValidPath : IsNever<ExactKeysOfArrayPath<TValue>> extends false ? readonly [...TValidPath, ExactKeysOfArrayPath<TValue>] : never : readonly [...TValidPath, ExactKeysOfArrayPath<TValue>] : TPathToCheck extends readonly [infer TFirstKey extends ExactKeysOfArrayPath<TValue>, ...infer TPathRest extends Path] ? LazyArrayPath<Required<PropertiesOfArrayPath<TValue>[TFirstKey]>, TPathRest, readonly [...TValidPath, TFirstKey]> : IsNever<ExactKeysOfArrayPath<TValue>> extends false ? readonly [...TValidPath, ExactKeysOfArrayPath<TValue>] : never;
|
|
131
|
+
/**
|
|
132
|
+
* Returns the path if valid, otherwise the first possible valid array path
|
|
133
|
+
* based on the given value.
|
|
134
|
+
*/
|
|
135
|
+
type ValidArrayPath<TValue, TPath extends RequiredPath> = TPath extends LazyArrayPath<Required<TValue>, TPath> ? TPath : LazyArrayPath<Required<TValue>, TPath>;
|
|
136
|
+
/**
|
|
137
|
+
* Recursive helper for `DirtyPath` that prepends `TKey` to each deeper path,
|
|
138
|
+
* or falls through to `never` when the child is not an object.
|
|
139
|
+
*/
|
|
140
|
+
type DeepDirtyPath<TChild, TKey$1 extends PathKey, TDepth extends 0[]> = TChild extends Record<PropertyKey, unknown> ? readonly [TKey$1, ...DirtyPath<TChild, [...TDepth, 0]>] : never;
|
|
141
|
+
/**
|
|
142
|
+
* Returns the union of all `RequiredPath`s that `getDirtyPaths` can emit
|
|
143
|
+
* for a given input type. Object fields contribute their own path and the
|
|
144
|
+
* paths of their descendants; arrays and tuples are atomic and contribute
|
|
145
|
+
* only their own path, because dirty arrays are returned as complete units.
|
|
146
|
+
*
|
|
147
|
+
* Narrowing is exact for the first 5 levels of nesting; deeper paths fall
|
|
148
|
+
* back to `RequiredPath` to keep the result a complete superset of any
|
|
149
|
+
* path the runtime can address.
|
|
150
|
+
*
|
|
151
|
+
* Hint: Arrays and tuples are atomic because they don't structurally
|
|
152
|
+
* extend `Record<PropertyKey, unknown>` and so fall through to `never`
|
|
153
|
+
* via `DeepDirtyPath` — no explicit array check is needed. `TDepth` is
|
|
154
|
+
* a tuple-length counter capped at 5 to bound TypeScript instantiation
|
|
155
|
+
* cost.
|
|
156
|
+
*/
|
|
157
|
+
type DirtyPath<TValue, TDepth extends 0[] = []> = TDepth["length"] extends 5 ? RequiredPath : TValue extends Record<PropertyKey, unknown> ? { [TKey in ExactKeysOf<TValue>]: readonly [TKey] | DeepDirtyPath<NonNullable<PropertiesOf<TValue>[TKey]>, TKey, TDepth> }[ExactKeysOf<TValue>] : never;
|
|
158
|
+
/**
|
|
159
|
+
* Recursive helper for `FieldPath` that prepends `TKey` to each deeper field
|
|
160
|
+
* path, or falls through to `never` when the child is a leaf value.
|
|
161
|
+
*/
|
|
162
|
+
type DeepFieldPath<TChild, TKey$1 extends PathKey, TDepth extends 0[]> = TChild extends readonly unknown[] | Record<PropertyKey, unknown> ? readonly [TKey$1, ...FieldPath<TChild, [...TDepth, 0]>] : never;
|
|
163
|
+
/**
|
|
164
|
+
* Returns the union of all `RequiredPath`s that address a field within the
|
|
165
|
+
* given input type. Object and array fields contribute their own path and the
|
|
166
|
+
* paths of their descendants; unlike `DirtyPath`, arrays are recursed into so
|
|
167
|
+
* that fields at any depth, including array items, can be addressed. Leaf
|
|
168
|
+
* values contribute only their own path (emitted by their parent).
|
|
169
|
+
*
|
|
170
|
+
* Narrowing is exact for the first 5 levels of nesting; deeper paths fall
|
|
171
|
+
* back to `RequiredPath` to keep the result a complete superset of any path
|
|
172
|
+
* the runtime can address. `TDepth` is a tuple-length counter capped at 5 to
|
|
173
|
+
* bound TypeScript instantiation cost.
|
|
174
|
+
*/
|
|
175
|
+
type FieldPath<TValue, TDepth extends 0[] = []> = TDepth["length"] extends 5 ? RequiredPath : TValue extends readonly unknown[] | Record<PropertyKey, unknown> ? { [TKey in ExactKeysOf<TValue>]: readonly [TKey] | DeepFieldPath<NonNullable<PropertiesOf<TValue>[TKey]>, TKey, TDepth> }[ExactKeysOf<TValue>] : never;
|
|
176
|
+
//#endregion
|
|
6
177
|
//#region src/types/schema/schema.d.ts
|
|
7
178
|
/**
|
|
8
179
|
* Schema type.
|
|
@@ -67,6 +238,10 @@ interface InternalBaseStore {
|
|
|
67
238
|
*/
|
|
68
239
|
name: string;
|
|
69
240
|
/**
|
|
241
|
+
* The path to the field.
|
|
242
|
+
*/
|
|
243
|
+
path: Path;
|
|
244
|
+
/**
|
|
70
245
|
* The schema of the field.
|
|
71
246
|
*/
|
|
72
247
|
schema: Schema;
|
|
@@ -94,6 +269,15 @@ interface InternalBaseStore {
|
|
|
94
269
|
*/
|
|
95
270
|
isTouched: Signal<boolean>;
|
|
96
271
|
/**
|
|
272
|
+
* The edited state of the field.
|
|
273
|
+
*
|
|
274
|
+
* Hint: Unlike `isTouched`, which is also set when a field is focused, this
|
|
275
|
+
* is only set when the field's value is changed. Unlike `isDirty`, it stays
|
|
276
|
+
* `true` even if the value is changed back to its initial value. It is only
|
|
277
|
+
* reset when the field is reset.
|
|
278
|
+
*/
|
|
279
|
+
isEdited: Signal<boolean>;
|
|
280
|
+
/**
|
|
97
281
|
* The dirty state of the field.
|
|
98
282
|
*/
|
|
99
283
|
isDirty: Signal<boolean>;
|
|
@@ -107,6 +291,14 @@ interface InternalArrayStore extends InternalBaseStore {
|
|
|
107
291
|
*/
|
|
108
292
|
kind: "array";
|
|
109
293
|
/**
|
|
294
|
+
* Whether the array schema is wrapped in a nullish schema.
|
|
295
|
+
*
|
|
296
|
+
* Hint: This indicates whether a missing input should be represented as the
|
|
297
|
+
* nullish value (`null`/`undefined`) or as a present but empty array
|
|
298
|
+
* (`true`). It keeps resetting consistent with the initial state.
|
|
299
|
+
*/
|
|
300
|
+
isNullish: boolean;
|
|
301
|
+
/**
|
|
110
302
|
* The children of the array field.
|
|
111
303
|
*/
|
|
112
304
|
children: InternalFieldStore[];
|
|
@@ -159,6 +351,14 @@ interface InternalObjectStore extends InternalBaseStore {
|
|
|
159
351
|
*/
|
|
160
352
|
kind: "object";
|
|
161
353
|
/**
|
|
354
|
+
* Whether the object schema is wrapped in a nullish schema.
|
|
355
|
+
*
|
|
356
|
+
* Hint: This indicates whether a missing input should be represented as the
|
|
357
|
+
* nullish value (`null`/`undefined`) or as a present but empty object
|
|
358
|
+
* (`true`). It keeps resetting consistent with the initial state.
|
|
359
|
+
*/
|
|
360
|
+
isNullish: boolean;
|
|
361
|
+
/**
|
|
162
362
|
* The children of the object field.
|
|
163
363
|
*/
|
|
164
364
|
children: Record<string, InternalFieldStore>;
|
|
@@ -222,32 +422,6 @@ type InternalFieldStore = InternalArrayStore | InternalObjectStore | InternalVal
|
|
|
222
422
|
*/
|
|
223
423
|
declare const INTERNAL: "~internal";
|
|
224
424
|
//#endregion
|
|
225
|
-
//#region src/types/utils/utils.d.ts
|
|
226
|
-
/**
|
|
227
|
-
* Checks if a type is `any`.
|
|
228
|
-
*/
|
|
229
|
-
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
230
|
-
/**
|
|
231
|
-
* Checks if a type is `never`.
|
|
232
|
-
*/
|
|
233
|
-
type IsNever<T> = [T] extends [never] ? true : false;
|
|
234
|
-
/**
|
|
235
|
-
* Constructs a type that is maybe a promise.
|
|
236
|
-
*/
|
|
237
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
238
|
-
/**
|
|
239
|
-
* Makes all properties deeply optional.
|
|
240
|
-
*/
|
|
241
|
-
type DeepPartial<TValue> = TValue extends Record<PropertyKey, unknown> | readonly unknown[] ? { [TKey in keyof TValue]?: DeepPartial<TValue[TKey]> | undefined } : TValue | undefined;
|
|
242
|
-
/**
|
|
243
|
-
* Makes all value properties optional.
|
|
244
|
-
*
|
|
245
|
-
* Hint: For dynamic arrays, only plain objects and nested arrays have their
|
|
246
|
-
* values made optional. Primitives and class instances are kept as-is to avoid
|
|
247
|
-
* types like `(string | undefined)[]`.
|
|
248
|
-
*/
|
|
249
|
-
type PartialValues<TValue> = TValue extends readonly (infer TItem)[] ? number extends TValue["length"] ? (TItem extends Record<PropertyKey, unknown> | readonly unknown[] ? { [TKey in keyof TItem]: PartialValues<TItem[TKey]> } : TItem)[] : { [TKey in keyof TValue]: PartialValues<TValue[TKey]> } : TValue extends Record<PropertyKey, unknown> ? { [TKey in keyof TValue]: PartialValues<TValue[TKey]> } : TValue | undefined;
|
|
250
|
-
//#endregion
|
|
251
425
|
//#region src/types/form/form.d.ts
|
|
252
426
|
/**
|
|
253
427
|
* Validation mode type.
|
|
@@ -331,177 +505,138 @@ type SubmitHandler<TSchema extends FormSchema> = (output: v.InferOutput<TSchema>
|
|
|
331
505
|
*/
|
|
332
506
|
type SubmitEventHandler<TSchema extends FormSchema> = (output: v.InferOutput<TSchema>, event: SubmitEvent) => MaybePromise<unknown>;
|
|
333
507
|
//#endregion
|
|
334
|
-
//#region src/
|
|
335
|
-
/**
|
|
336
|
-
* Path key type.
|
|
337
|
-
*/
|
|
338
|
-
type PathKey = string | number;
|
|
339
|
-
/**
|
|
340
|
-
* Path type.
|
|
341
|
-
*/
|
|
342
|
-
type Path = readonly PathKey[];
|
|
508
|
+
//#region src/array/copyItemState/copyItemState.d.ts
|
|
343
509
|
/**
|
|
344
|
-
*
|
|
510
|
+
* Copies the deeply nested state (signal values) from one field store to
|
|
511
|
+
* another. This includes the `elements`, `errors`, `startInput`, `input`,
|
|
512
|
+
* `isTouched`, `isEdited`, `isDirty`, and for arrays `startItems` and `items`
|
|
513
|
+
* properties. Recursively walks through the field stores and copies all signal
|
|
514
|
+
* values.
|
|
515
|
+
*
|
|
516
|
+
* @param fromInternalFieldStore The source field store to copy from.
|
|
517
|
+
* @param toInternalFieldStore The destination field store to copy to.
|
|
345
518
|
*/
|
|
346
|
-
|
|
519
|
+
//#endregion
|
|
520
|
+
//#region ../../packages/methods/dist/index.solid.d.ts
|
|
521
|
+
//#region src/focus/focus.d.ts
|
|
522
|
+
|
|
347
523
|
/**
|
|
348
|
-
*
|
|
349
|
-
* literal numeric indices, dynamic arrays return `number`, objects return
|
|
350
|
-
* their `keyof` keys, and any other input returns `never`.
|
|
524
|
+
* Focus field config interface.
|
|
351
525
|
*/
|
|
352
|
-
|
|
526
|
+
interface FocusFieldConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
|
|
527
|
+
/**
|
|
528
|
+
* The path to the field to focus.
|
|
529
|
+
*/
|
|
530
|
+
readonly path: ValidPath<v.InferInput<TSchema>, TFieldPath>;
|
|
531
|
+
}
|
|
353
532
|
/**
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
* `{}`.
|
|
533
|
+
* Focuses the first focusable input element of a field. This is useful for
|
|
534
|
+
* programmatically setting focus to a specific field, such as after
|
|
535
|
+
* validation errors or user interactions.
|
|
358
536
|
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
* accessible and result in "any" when accessed.
|
|
537
|
+
* @param form The form store containing the field.
|
|
538
|
+
* @param config The focus field configuration.
|
|
362
539
|
*/
|
|
363
|
-
|
|
540
|
+
declare function focus<TSchema extends FormSchema, TFieldPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: FocusFieldConfig<TSchema, TFieldPath>): void;
|
|
541
|
+
//#endregion
|
|
542
|
+
//#region src/getDeepErrorEntries/getDeepErrorEntries.d.ts
|
|
364
543
|
/**
|
|
365
|
-
*
|
|
544
|
+
* Deep error entry interface.
|
|
366
545
|
*/
|
|
367
|
-
|
|
546
|
+
interface DeepErrorEntry<TValue = unknown> {
|
|
547
|
+
/**
|
|
548
|
+
* The path to the field with errors, or an empty path for form-level errors.
|
|
549
|
+
*/
|
|
550
|
+
readonly path: unknown extends TValue ? Path : readonly [] | FieldPath<TValue>;
|
|
551
|
+
/**
|
|
552
|
+
* The error messages of the field.
|
|
553
|
+
*/
|
|
554
|
+
readonly errors: [string, ...string[]];
|
|
555
|
+
}
|
|
368
556
|
/**
|
|
369
|
-
*
|
|
370
|
-
* the given value.
|
|
557
|
+
* Get form deep error entries config interface.
|
|
371
558
|
*/
|
|
372
|
-
|
|
559
|
+
interface GetFormDeepErrorEntriesConfig {
|
|
560
|
+
/**
|
|
561
|
+
* The path to a field. Leave undefined to get the entries of the entire form.
|
|
562
|
+
*/
|
|
563
|
+
readonly path?: undefined;
|
|
564
|
+
}
|
|
373
565
|
/**
|
|
374
|
-
*
|
|
375
|
-
* `exactOptionalPropertyTypes: true`.
|
|
376
|
-
*
|
|
377
|
-
* Hint: If `false` the built-in `Required<T>` strips `| undefined` from
|
|
378
|
-
* optional properties, so `Required<{ key?: undefined }>['key']` collapses
|
|
379
|
-
* to `never` — under strict mode the same expression yields `undefined`.
|
|
566
|
+
* Get field deep error entries config interface.
|
|
380
567
|
*/
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
568
|
+
interface GetFieldDeepErrorEntriesConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
|
|
569
|
+
/**
|
|
570
|
+
* The path to the field to retrieve the entries from.
|
|
571
|
+
*/
|
|
572
|
+
readonly path: ValidPath<v.InferInput<TSchema>, TFieldPath>;
|
|
573
|
+
}
|
|
384
574
|
/**
|
|
385
|
-
*
|
|
386
|
-
*
|
|
575
|
+
* Retrieves the errors of a specific field or the entire form as a list of
|
|
576
|
+
* entries, each pairing the path to a field with its error messages. This is
|
|
577
|
+
* useful for building custom error summaries that link each message back to
|
|
578
|
+
* its field. Form-level errors are included with an empty path.
|
|
387
579
|
*
|
|
388
|
-
*
|
|
389
|
-
* — without this, input typings for `v.optional`/`v.nullish` schemas
|
|
390
|
-
* narrow incorrectly (issue #15).
|
|
391
|
-
* 2. Array/tuple element types — e.g. `(string | undefined)[]` stays
|
|
392
|
-
* `(string | undefined)[]` instead of becoming `string[]`. Arrays
|
|
393
|
-
* fall through unchanged because they only have a numeric index
|
|
394
|
-
* signature and don't structurally extend `Record<PropertyKey,
|
|
395
|
-
* unknown>` (which requires string keys).
|
|
396
|
-
*/
|
|
397
|
-
type ExactRequired<TValue> = TValue extends Record<PropertyKey, unknown> ? IsExactOptionalProps extends true ? Required<TValue> : { [TKey in keyof Required<TValue>]: TValue[TKey] } : TValue;
|
|
398
|
-
/**
|
|
399
|
-
* Extracts the value type at the given path.
|
|
400
|
-
*/
|
|
401
|
-
type PathValue<TValue, TPath extends Path> = TPath extends readonly [infer TKey, ...infer TRest extends Path] ? TKey extends ExactKeysOf<ExactRequired<TValue>> ? PathValue<PropertiesOf<ExactRequired<TValue>>[TKey], TRest> : unknown : TValue;
|
|
402
|
-
/**
|
|
403
|
-
* Checks whether a value is a dynamic array or contains one anywhere in its
|
|
404
|
-
* shape. A fixed-length tuple is not itself a dynamic array, but it counts when
|
|
405
|
-
* it contains one, so paths can still navigate through tuples to reach nested
|
|
406
|
-
* arrays.
|
|
580
|
+
* @param form The form store to retrieve error entries from.
|
|
407
581
|
*
|
|
408
|
-
*
|
|
409
|
-
* `TValue extends Record<PropertyKey, unknown>`) distribute over union members,
|
|
410
|
-
* so the inner expression returns the union of each member's result (e.g.
|
|
411
|
-
* `true | false` when some members contain arrays and others don't).
|
|
412
|
-
* Downstream code uses `IsOrHasArray<T> extends true`, but
|
|
413
|
-
* `boolean extends true` is `false` — so we collapse the result via
|
|
414
|
-
* `true extends ...`, which is `true` whenever at least one union member
|
|
415
|
-
* contributed `true`.
|
|
582
|
+
* @returns A list of path and error message entries.
|
|
416
583
|
*/
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Extracts the exact keys of a tuple, array or object that contain arrays.
|
|
420
|
-
*/
|
|
421
|
-
type ExactKeysOfArrayPath<TValue> = IsAny<TValue> extends true ? never : TValue extends readonly (infer TItem)[] ? number extends TValue["length"] ? IsOrHasArray<TItem> extends true ? number : never : { [TKey in keyof TValue]: TKey extends `${infer TIndex extends number}` ? IsOrHasArray<NonNullable<TValue[TKey]>> extends true ? TIndex : never : never }[number] : TValue extends Record<PropertyKey, unknown> ? { [TKey in keyof TValue]: IsOrHasArray<NonNullable<TValue[TKey]>> extends true ? TKey : never }[keyof TValue] & PathKey : never;
|
|
422
|
-
/**
|
|
423
|
-
* Returns the flat object of indexable properties of `TValue` whose values
|
|
424
|
-
* are or contain arrays. Mirrors `PropertiesOf` but keyed by
|
|
425
|
-
* `ExactKeysOfArrayPath` so the lookup is provably valid for array-path
|
|
426
|
-
* navigation in `LazyArrayPath`.
|
|
427
|
-
*/
|
|
428
|
-
type PropertiesOfArrayPath<TValue> = { [TKey in ExactKeysOfArrayPath<TValue>]: TValue extends Record<TKey, infer TItem> ? TItem : never };
|
|
429
|
-
/**
|
|
430
|
-
* Lazily evaluates only the first valid array path segment based on the given value.
|
|
431
|
-
*/
|
|
432
|
-
type LazyArrayPath<TValue, TPathToCheck extends Path, TValidPath extends Path = readonly []> = TPathToCheck extends readonly [] ? TValue extends readonly unknown[] ? number extends TValue["length"] ? TValidPath : IsNever<ExactKeysOfArrayPath<TValue>> extends false ? readonly [...TValidPath, ExactKeysOfArrayPath<TValue>] : never : readonly [...TValidPath, ExactKeysOfArrayPath<TValue>] : TPathToCheck extends readonly [infer TFirstKey extends ExactKeysOfArrayPath<TValue>, ...infer TPathRest extends Path] ? LazyArrayPath<Required<PropertiesOfArrayPath<TValue>[TFirstKey]>, TPathRest, readonly [...TValidPath, TFirstKey]> : IsNever<ExactKeysOfArrayPath<TValue>> extends false ? readonly [...TValidPath, ExactKeysOfArrayPath<TValue>] : never;
|
|
584
|
+
declare function getDeepErrorEntries<TSchema extends FormSchema>(form: BaseFormStore<TSchema>): DeepErrorEntry<v.InferInput<TSchema>>[];
|
|
433
585
|
/**
|
|
434
|
-
*
|
|
435
|
-
*
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
/**
|
|
439
|
-
* Recursive helper for `DirtyPath` that prepends `TKey` to each deeper path,
|
|
440
|
-
* or falls through to `never` when the child is not an object.
|
|
441
|
-
*/
|
|
442
|
-
type DeepDirtyPath<TChild, TKey$1 extends PathKey, TDepth extends 0[]> = TChild extends Record<PropertyKey, unknown> ? readonly [TKey$1, ...DirtyPath<TChild, [...TDepth, 0]>] : never;
|
|
443
|
-
/**
|
|
444
|
-
* Returns the union of all `RequiredPath`s that `getDirtyPaths` can emit
|
|
445
|
-
* for a given input type. Object fields contribute their own path and the
|
|
446
|
-
* paths of their descendants; arrays and tuples are atomic and contribute
|
|
447
|
-
* only their own path, because dirty arrays are returned as complete units.
|
|
586
|
+
* Retrieves the errors of a specific field or the entire form as a list of
|
|
587
|
+
* entries, each pairing the path to a field with its error messages. This is
|
|
588
|
+
* useful for building custom error summaries that link each message back to
|
|
589
|
+
* its field. Form-level errors are included with an empty path.
|
|
448
590
|
*
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
* path the runtime can address.
|
|
591
|
+
* @param form The form store to retrieve error entries from.
|
|
592
|
+
* @param config The get deep error entries configuration.
|
|
452
593
|
*
|
|
453
|
-
*
|
|
454
|
-
* extend `Record<PropertyKey, unknown>` and so fall through to `never`
|
|
455
|
-
* via `DeepDirtyPath` — no explicit array check is needed. `TDepth` is
|
|
456
|
-
* a tuple-length counter capped at 5 to bound TypeScript instantiation
|
|
457
|
-
* cost.
|
|
594
|
+
* @returns A list of path and error message entries.
|
|
458
595
|
*/
|
|
459
|
-
|
|
596
|
+
declare function getDeepErrorEntries<TSchema extends FormSchema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? GetFieldDeepErrorEntriesConfig<TSchema, TFieldPath> : GetFormDeepErrorEntriesConfig): DeepErrorEntry<v.InferInput<TSchema>>[];
|
|
460
597
|
//#endregion
|
|
461
|
-
//#region src/
|
|
598
|
+
//#region src/getDeepErrors/getDeepErrors.d.ts
|
|
462
599
|
/**
|
|
463
|
-
*
|
|
464
|
-
* another. This includes the `elements`, `errors`, `startInput`, `input`,
|
|
465
|
-
* `isTouched`, `isDirty`, and for arrays `startItems` and `items` properties.
|
|
466
|
-
* Recursively walks through the field stores and copies all signal values.
|
|
467
|
-
*
|
|
468
|
-
* @param fromInternalFieldStore The source field store to copy from.
|
|
469
|
-
* @param toInternalFieldStore The destination field store to copy to.
|
|
600
|
+
* Get form deep errors config interface.
|
|
470
601
|
*/
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
602
|
+
interface GetFormDeepErrorsConfig {
|
|
603
|
+
/**
|
|
604
|
+
* The path to a field. Leave undefined to get the errors of the entire form.
|
|
605
|
+
*/
|
|
606
|
+
readonly path?: undefined;
|
|
607
|
+
}
|
|
475
608
|
/**
|
|
476
|
-
*
|
|
609
|
+
* Get field deep errors config interface.
|
|
477
610
|
*/
|
|
478
|
-
interface
|
|
611
|
+
interface GetFieldDeepErrorsConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
|
|
479
612
|
/**
|
|
480
|
-
* The path to the field to
|
|
613
|
+
* The path to the field to retrieve the errors from.
|
|
481
614
|
*/
|
|
482
615
|
readonly path: ValidPath<v.InferInput<TSchema>, TFieldPath>;
|
|
483
616
|
}
|
|
484
617
|
/**
|
|
485
|
-
*
|
|
486
|
-
*
|
|
487
|
-
* validation errors or
|
|
618
|
+
* Retrieves all error messages of a specific field or the entire form by
|
|
619
|
+
* walking through the field store and all its descendants. This is useful for
|
|
620
|
+
* displaying a summary of all validation errors within a section or the whole
|
|
621
|
+
* form. Form-level errors are included.
|
|
488
622
|
*
|
|
489
|
-
* @param form The form store
|
|
490
|
-
*
|
|
623
|
+
* @param form The form store to retrieve errors from.
|
|
624
|
+
*
|
|
625
|
+
* @returns A non-empty array of error messages, or null if no errors exist.
|
|
491
626
|
*/
|
|
492
|
-
declare function
|
|
493
|
-
//#endregion
|
|
494
|
-
//#region src/getAllErrors/getAllErrors.d.ts
|
|
627
|
+
declare function getDeepErrors<TSchema extends FormSchema>(form: BaseFormStore<TSchema>): [string, ...string[]] | null;
|
|
495
628
|
/**
|
|
496
|
-
* Retrieves all error messages
|
|
497
|
-
* the
|
|
498
|
-
* validation errors
|
|
629
|
+
* Retrieves all error messages of a specific field or the entire form by
|
|
630
|
+
* walking through the field store and all its descendants. This is useful for
|
|
631
|
+
* displaying a summary of all validation errors within a section or the whole
|
|
632
|
+
* form. Form-level errors are included.
|
|
499
633
|
*
|
|
500
634
|
* @param form The form store to retrieve errors from.
|
|
635
|
+
* @param config The get deep errors configuration.
|
|
501
636
|
*
|
|
502
637
|
* @returns A non-empty array of error messages, or null if no errors exist.
|
|
503
638
|
*/
|
|
504
|
-
declare function
|
|
639
|
+
declare function getDeepErrors<TSchema extends FormSchema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? GetFieldDeepErrorsConfig<TSchema, TFieldPath> : GetFormDeepErrorsConfig): [string, ...string[]] | null;
|
|
505
640
|
//#endregion
|
|
506
641
|
//#region src/getDirtyInput/getDirtyInput.d.ts
|
|
507
642
|
/**
|
|
@@ -721,6 +856,172 @@ interface InsertConfig<TSchema extends FormSchema, TFieldArrayPath extends Requi
|
|
|
721
856
|
*/
|
|
722
857
|
declare function insert<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(form: BaseFormStore<TSchema>, config: InsertConfig<TSchema, TFieldArrayPath>): void;
|
|
723
858
|
//#endregion
|
|
859
|
+
//#region src/isDirty/isDirty.d.ts
|
|
860
|
+
/**
|
|
861
|
+
* Is form dirty config interface.
|
|
862
|
+
*/
|
|
863
|
+
interface IsFormDirtyConfig {
|
|
864
|
+
/**
|
|
865
|
+
* The path to a field. Leave undefined to check the entire form.
|
|
866
|
+
*/
|
|
867
|
+
readonly path?: undefined;
|
|
868
|
+
}
|
|
869
|
+
/**
|
|
870
|
+
* Is field dirty config interface.
|
|
871
|
+
*/
|
|
872
|
+
interface IsFieldDirtyConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
|
|
873
|
+
/**
|
|
874
|
+
* The path to the field to check for dirtiness.
|
|
875
|
+
*/
|
|
876
|
+
readonly path: ValidPath<v.InferInput<TSchema>, TFieldPath>;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Checks whether a specific field or the entire form is dirty by walking
|
|
880
|
+
* through the field store and all its descendants. A field is dirty when its
|
|
881
|
+
* input differs from its initial value.
|
|
882
|
+
*
|
|
883
|
+
* @param form The form store to check for dirtiness.
|
|
884
|
+
*
|
|
885
|
+
* @returns Whether the field or form is dirty.
|
|
886
|
+
*/
|
|
887
|
+
declare function isDirty<TSchema extends FormSchema>(form: BaseFormStore<TSchema>): boolean;
|
|
888
|
+
/**
|
|
889
|
+
* Checks whether a specific field or the entire form is dirty by walking
|
|
890
|
+
* through the field store and all its descendants. A field is dirty when its
|
|
891
|
+
* input differs from its initial value.
|
|
892
|
+
*
|
|
893
|
+
* @param form The form store to check for dirtiness.
|
|
894
|
+
* @param config The is dirty configuration.
|
|
895
|
+
*
|
|
896
|
+
* @returns Whether the field or form is dirty.
|
|
897
|
+
*/
|
|
898
|
+
declare function isDirty<TSchema extends FormSchema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? IsFieldDirtyConfig<TSchema, TFieldPath> : IsFormDirtyConfig): boolean;
|
|
899
|
+
//#endregion
|
|
900
|
+
//#region src/isEdited/isEdited.d.ts
|
|
901
|
+
/**
|
|
902
|
+
* Is form edited config interface.
|
|
903
|
+
*/
|
|
904
|
+
interface IsFormEditedConfig {
|
|
905
|
+
/**
|
|
906
|
+
* The path to a field. Leave undefined to check the entire form.
|
|
907
|
+
*/
|
|
908
|
+
readonly path?: undefined;
|
|
909
|
+
}
|
|
910
|
+
/**
|
|
911
|
+
* Is field edited config interface.
|
|
912
|
+
*/
|
|
913
|
+
interface IsFieldEditedConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
|
|
914
|
+
/**
|
|
915
|
+
* The path to the field to check for being edited.
|
|
916
|
+
*/
|
|
917
|
+
readonly path: ValidPath<v.InferInput<TSchema>, TFieldPath>;
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* Checks whether a specific field or the entire form is edited by walking
|
|
921
|
+
* through the field store and all its descendants. A field is edited once its
|
|
922
|
+
* value has been changed by the user.
|
|
923
|
+
*
|
|
924
|
+
* @param form The form store to check for being edited.
|
|
925
|
+
*
|
|
926
|
+
* @returns Whether the field or form is edited.
|
|
927
|
+
*/
|
|
928
|
+
declare function isEdited<TSchema extends FormSchema>(form: BaseFormStore<TSchema>): boolean;
|
|
929
|
+
/**
|
|
930
|
+
* Checks whether a specific field or the entire form is edited by walking
|
|
931
|
+
* through the field store and all its descendants. A field is edited once its
|
|
932
|
+
* value has been changed by the user.
|
|
933
|
+
*
|
|
934
|
+
* @param form The form store to check for being edited.
|
|
935
|
+
* @param config The is edited configuration.
|
|
936
|
+
*
|
|
937
|
+
* @returns Whether the field or form is edited.
|
|
938
|
+
*/
|
|
939
|
+
declare function isEdited<TSchema extends FormSchema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? IsFieldEditedConfig<TSchema, TFieldPath> : IsFormEditedConfig): boolean;
|
|
940
|
+
//#endregion
|
|
941
|
+
//#region src/isTouched/isTouched.d.ts
|
|
942
|
+
/**
|
|
943
|
+
* Is form touched config interface.
|
|
944
|
+
*/
|
|
945
|
+
interface IsFormTouchedConfig {
|
|
946
|
+
/**
|
|
947
|
+
* The path to a field. Leave undefined to check the entire form.
|
|
948
|
+
*/
|
|
949
|
+
readonly path?: undefined;
|
|
950
|
+
}
|
|
951
|
+
/**
|
|
952
|
+
* Is field touched config interface.
|
|
953
|
+
*/
|
|
954
|
+
interface IsFieldTouchedConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
|
|
955
|
+
/**
|
|
956
|
+
* The path to the field to check for being touched.
|
|
957
|
+
*/
|
|
958
|
+
readonly path: ValidPath<v.InferInput<TSchema>, TFieldPath>;
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Checks whether a specific field or the entire form is touched by walking
|
|
962
|
+
* through the field store and all its descendants. A field is touched once it
|
|
963
|
+
* has received and lost focus.
|
|
964
|
+
*
|
|
965
|
+
* @param form The form store to check for being touched.
|
|
966
|
+
*
|
|
967
|
+
* @returns Whether the field or form is touched.
|
|
968
|
+
*/
|
|
969
|
+
declare function isTouched<TSchema extends FormSchema>(form: BaseFormStore<TSchema>): boolean;
|
|
970
|
+
/**
|
|
971
|
+
* Checks whether a specific field or the entire form is touched by walking
|
|
972
|
+
* through the field store and all its descendants. A field is touched once it
|
|
973
|
+
* has received and lost focus.
|
|
974
|
+
*
|
|
975
|
+
* @param form The form store to check for being touched.
|
|
976
|
+
* @param config The is touched configuration.
|
|
977
|
+
*
|
|
978
|
+
* @returns Whether the field or form is touched.
|
|
979
|
+
*/
|
|
980
|
+
declare function isTouched<TSchema extends FormSchema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? IsFieldTouchedConfig<TSchema, TFieldPath> : IsFormTouchedConfig): boolean;
|
|
981
|
+
//#endregion
|
|
982
|
+
//#region src/isValid/isValid.d.ts
|
|
983
|
+
/**
|
|
984
|
+
* Is form valid config interface.
|
|
985
|
+
*/
|
|
986
|
+
interface IsFormValidConfig {
|
|
987
|
+
/**
|
|
988
|
+
* The path to a field. Leave undefined to check the entire form.
|
|
989
|
+
*/
|
|
990
|
+
readonly path?: undefined;
|
|
991
|
+
}
|
|
992
|
+
/**
|
|
993
|
+
* Is field valid config interface.
|
|
994
|
+
*/
|
|
995
|
+
interface IsFieldValidConfig<TSchema extends FormSchema, TFieldPath extends RequiredPath> {
|
|
996
|
+
/**
|
|
997
|
+
* The path to the field to check for validity.
|
|
998
|
+
*/
|
|
999
|
+
readonly path: ValidPath<v.InferInput<TSchema>, TFieldPath>;
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Checks whether a specific field or the entire form is valid by walking
|
|
1003
|
+
* through the field store and all its descendants. A field is valid when
|
|
1004
|
+
* neither it nor any of its descendants contains an error. Form-level errors
|
|
1005
|
+
* are included.
|
|
1006
|
+
*
|
|
1007
|
+
* @param form The form store to check for validity.
|
|
1008
|
+
*
|
|
1009
|
+
* @returns Whether the field or form is valid.
|
|
1010
|
+
*/
|
|
1011
|
+
declare function isValid<TSchema extends FormSchema>(form: BaseFormStore<TSchema>): boolean;
|
|
1012
|
+
/**
|
|
1013
|
+
* Checks whether a specific field or the entire form is valid by walking
|
|
1014
|
+
* through the field store and all its descendants. A field is valid when
|
|
1015
|
+
* neither it nor any of its descendants contains an error. Form-level errors
|
|
1016
|
+
* are included.
|
|
1017
|
+
*
|
|
1018
|
+
* @param form The form store to check for validity.
|
|
1019
|
+
* @param config The is valid configuration.
|
|
1020
|
+
*
|
|
1021
|
+
* @returns Whether the field or form is valid.
|
|
1022
|
+
*/
|
|
1023
|
+
declare function isValid<TSchema extends FormSchema, TFieldPath extends RequiredPath | undefined = undefined>(form: BaseFormStore<TSchema>, config: TFieldPath extends RequiredPath ? IsFieldValidConfig<TSchema, TFieldPath> : IsFormValidConfig): boolean;
|
|
1024
|
+
//#endregion
|
|
724
1025
|
//#region src/move/move.d.ts
|
|
725
1026
|
/**
|
|
726
1027
|
* Move array field config interface.
|
|
@@ -836,6 +1137,10 @@ interface ResetBaseConfig {
|
|
|
836
1137
|
*/
|
|
837
1138
|
readonly keepTouched?: boolean | undefined;
|
|
838
1139
|
/**
|
|
1140
|
+
* Whether to keep the edited state during reset. Defaults to false.
|
|
1141
|
+
*/
|
|
1142
|
+
readonly keepEdited?: boolean | undefined;
|
|
1143
|
+
/**
|
|
839
1144
|
* Whether to keep the error messages during reset. Defaults to false.
|
|
840
1145
|
*/
|
|
841
1146
|
readonly keepErrors?: boolean | undefined;
|
|
@@ -1086,6 +1391,10 @@ interface FieldStore<TSchema extends FormSchema = FormSchema, TFieldPath extends
|
|
|
1086
1391
|
*/
|
|
1087
1392
|
readonly isTouched: boolean;
|
|
1088
1393
|
/**
|
|
1394
|
+
* Whether the field value has been edited.
|
|
1395
|
+
*/
|
|
1396
|
+
readonly isEdited: boolean;
|
|
1397
|
+
/**
|
|
1089
1398
|
* Whether the field input differs from its initial value.
|
|
1090
1399
|
*/
|
|
1091
1400
|
readonly isDirty: boolean;
|
|
@@ -1123,6 +1432,10 @@ interface FieldArrayStore<TSchema extends FormSchema = FormSchema, TFieldArrayPa
|
|
|
1123
1432
|
*/
|
|
1124
1433
|
readonly isTouched: boolean;
|
|
1125
1434
|
/**
|
|
1435
|
+
* Whether the field array value has been edited.
|
|
1436
|
+
*/
|
|
1437
|
+
readonly isEdited: boolean;
|
|
1438
|
+
/**
|
|
1126
1439
|
* Whether the field array input differs from its initial value.
|
|
1127
1440
|
*/
|
|
1128
1441
|
readonly isDirty: boolean;
|
|
@@ -1154,6 +1467,10 @@ interface FormStore<TSchema extends FormSchema = FormSchema> extends BaseFormSto
|
|
|
1154
1467
|
*/
|
|
1155
1468
|
readonly isTouched: boolean;
|
|
1156
1469
|
/**
|
|
1470
|
+
* Whether any field in the form has been edited.
|
|
1471
|
+
*/
|
|
1472
|
+
readonly isEdited: boolean;
|
|
1473
|
+
/**
|
|
1157
1474
|
* Whether any field in the form differs from its initial value.
|
|
1158
1475
|
*/
|
|
1159
1476
|
readonly isDirty: boolean;
|
|
@@ -1165,7 +1482,7 @@ interface FormStore<TSchema extends FormSchema = FormSchema> extends BaseFormSto
|
|
|
1165
1482
|
* The current error messages of the form.
|
|
1166
1483
|
*
|
|
1167
1484
|
* Hint: This property only contains validation errors at the root level
|
|
1168
|
-
* of the form. To get all errors from all fields, use `
|
|
1485
|
+
* of the form. To get all errors from all fields, use `getDeepErrors`.
|
|
1169
1486
|
*/
|
|
1170
1487
|
readonly errors: [string, ...string[]] | null;
|
|
1171
1488
|
}
|
|
@@ -1313,4 +1630,4 @@ interface UseFieldArrayConfig<TSchema extends FormSchema = FormSchema, TFieldArr
|
|
|
1313
1630
|
*/
|
|
1314
1631
|
declare function useFieldArray<TSchema extends FormSchema, TFieldArrayPath extends RequiredPath>(form: MaybeGetter<FormStore<TSchema>>, config: MaybeGetter<UseFieldArrayConfig<TSchema, TFieldArrayPath>>): FieldArrayStore<TSchema, TFieldArrayPath>;
|
|
1315
1632
|
//#endregion
|
|
1316
|
-
export { type DeepPartial, Field, FieldArray, FieldArrayProps, FieldArrayStore, type FieldElement, FieldElementProps, FieldProps, FieldStore, FocusFieldConfig, Form, type FormConfig, FormProps, type FormSchema, FormStore, GetFieldDirtyInputConfig, GetFieldDirtyPathsConfig, GetFieldErrorsConfig, GetFieldInputConfig, GetFormDirtyInputConfig, GetFormDirtyPathsConfig, GetFormErrorsConfig, GetFormInputConfig, InsertConfig, MaybeGetter, MoveConfig, type PartialValues, type PathValue, PickDirtyConfig, RemoveConfig, ReplaceConfig, type RequiredPath, ResetFieldConfig, ResetFormConfig, type Schema, SetFieldErrorsConfig, SetFieldInputConfig, SetFormErrorsConfig, SetFormInputConfig, type SubmitEventHandler, type SubmitHandler, SwapConfig, UseFieldArrayConfig, UseFieldConfig, type ValidArrayPath, type ValidPath, ValidateFormConfig, type ValidationMode, createForm, focus,
|
|
1633
|
+
export { DeepErrorEntry, type DeepPartial, Field, FieldArray, FieldArrayProps, FieldArrayStore, type FieldElement, FieldElementProps, FieldProps, FieldStore, FocusFieldConfig, Form, type FormConfig, FormProps, type FormSchema, FormStore, GetFieldDeepErrorEntriesConfig, GetFieldDeepErrorsConfig, GetFieldDirtyInputConfig, GetFieldDirtyPathsConfig, GetFieldErrorsConfig, GetFieldInputConfig, GetFormDeepErrorEntriesConfig, GetFormDeepErrorsConfig, GetFormDirtyInputConfig, GetFormDirtyPathsConfig, GetFormErrorsConfig, GetFormInputConfig, InsertConfig, IsFieldDirtyConfig, IsFieldEditedConfig, IsFieldTouchedConfig, IsFieldValidConfig, IsFormDirtyConfig, IsFormEditedConfig, IsFormTouchedConfig, IsFormValidConfig, MaybeGetter, MoveConfig, type PartialValues, type PathValue, PickDirtyConfig, RemoveConfig, ReplaceConfig, type RequiredPath, ResetFieldConfig, ResetFormConfig, type Schema, SetFieldErrorsConfig, SetFieldInputConfig, SetFormErrorsConfig, SetFormInputConfig, type SubmitEventHandler, type SubmitHandler, SwapConfig, UseFieldArrayConfig, UseFieldConfig, type ValidArrayPath, type ValidPath, ValidateFormConfig, type ValidationMode, createForm, focus, getDeepErrorEntries, getDeepErrors, getDirtyInput, getDirtyPaths, getErrors, getInput, handleSubmit, insert, isDirty, isEdited, isTouched, isValid, move, pickDirty, remove, replace, reset, setErrors, setInput, submit, swap, useField, useFieldArray, validate };
|