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