@angular/forms 21.1.0-next.4 → 21.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/fesm2022/_structure-chunk.mjs +29 -15
- package/fesm2022/_structure-chunk.mjs.map +1 -1
- package/fesm2022/forms.mjs +133 -132
- package/fesm2022/forms.mjs.map +1 -1
- package/fesm2022/signals-compat.mjs +2 -2
- package/fesm2022/signals.mjs +63 -86
- package/fesm2022/signals.mjs.map +1 -1
- package/package.json +10 -4
- package/resources/code-examples.db +0 -0
- package/types/_structure-chunk.d.ts +57 -74
- package/types/forms.d.ts +26 -9
- package/types/signals-compat.d.ts +2 -2
- package/types/signals.d.ts +155 -145
package/types/signals.d.ts
CHANGED
|
@@ -1,155 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v21.1.0
|
|
3
|
-
* (c) 2010-
|
|
2
|
+
* @license Angular v21.1.0
|
|
3
|
+
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { InputSignal, InputSignalWithTransform, ModelSignal, OutputRef
|
|
8
|
-
import {
|
|
9
|
-
export { AsyncValidationResult, ChildFieldContext, CompatFieldState, CompatSchemaPath,
|
|
7
|
+
import { Signal, ResourceRef, InputSignal, InputSignalWithTransform, ModelSignal, OutputRef } from '@angular/core';
|
|
8
|
+
import { PathKind, SchemaPath, SchemaPathRules, LogicFn, OneOrMany, ValidationError, SchemaPathTree, FieldValidator, FieldContext, TreeValidationResult, TreeValidator, WithOptionalField, DisabledReason, Debouncer } from './_structure-chunk.js';
|
|
9
|
+
export { AsyncValidationResult, ChildFieldContext, CompatFieldState, CompatSchemaPath, EmailValidationError, FORM_FIELD, FieldState, FieldTree, FormField, FormOptions, ItemFieldContext, ItemType, MAX, MAX_LENGTH, MIN, MIN_LENGTH, MaxLengthValidationError, MaxValidationError, MaybeFieldTree, MaybeSchemaPathTree, MetadataKey, MetadataReducer, MetadataSetterType, MinLengthValidationError, MinValidationError, NgValidationError, PATTERN, PatternValidationError, REQUIRED, ReadonlyArrayLike, RequiredValidationError, RootFieldContext, Schema, SchemaFn, SchemaOrSchemaFn, SignalFormsConfig, StandardSchemaValidationError, Subfields, SubmittedStatus, ValidationResult, ValidationSuccess, Validator, WithField, WithoutField, apply, applyEach, applyWhen, applyWhenValue, createManagedMetadataKey, createMetadataKey, emailError, form, maxError, maxLengthError, metadata, minError, minLengthError, patternError, provideSignalFormsConfig, requiredError, schema, standardSchemaError, submit } from './_structure-chunk.js';
|
|
10
10
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
11
11
|
import { HttpResourceRequest, HttpResourceOptions } from '@angular/common/http';
|
|
12
12
|
import '@angular/forms';
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* The base set of properties shared by all form control contracts.
|
|
16
|
-
*
|
|
17
|
-
* @category control
|
|
18
|
-
* @experimental 21.0.0
|
|
19
|
-
*/
|
|
20
|
-
interface FormUiControl {
|
|
21
|
-
/**
|
|
22
|
-
* An input to receive the errors for the field. If implemented, the `Field` directive will
|
|
23
|
-
* automatically bind errors from the bound field to this input.
|
|
24
|
-
*/
|
|
25
|
-
readonly errors?: InputSignal<readonly WithOptionalField<ValidationError>[]> | InputSignalWithTransform<readonly WithOptionalField<ValidationError>[], unknown>;
|
|
26
|
-
/**
|
|
27
|
-
* An input to receive the disabled status for the field. If implemented, the `Field` directive
|
|
28
|
-
* will automatically bind the disabled status from the bound field to this input.
|
|
29
|
-
*/
|
|
30
|
-
readonly disabled?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
|
|
31
|
-
/**
|
|
32
|
-
* An input to receive the reasons for the disablement of the field. If implemented, the `Field`
|
|
33
|
-
* directive will automatically bind the disabled reason from the bound field to this input.
|
|
34
|
-
*/
|
|
35
|
-
readonly disabledReasons?: InputSignal<readonly WithOptionalField<DisabledReason>[]> | InputSignalWithTransform<readonly WithOptionalField<DisabledReason>[], unknown>;
|
|
36
|
-
/**
|
|
37
|
-
* An input to receive the readonly status for the field. If implemented, the `Field` directive
|
|
38
|
-
* will automatically bind the readonly status from the bound field to this input.
|
|
39
|
-
*/
|
|
40
|
-
readonly readonly?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
|
|
41
|
-
/**
|
|
42
|
-
* An input to receive the hidden status for the field. If implemented, the `Field` directive
|
|
43
|
-
* will automatically bind the hidden status from the bound field to this input.
|
|
44
|
-
*/
|
|
45
|
-
readonly hidden?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
|
|
46
|
-
/**
|
|
47
|
-
* An input to receive the invalid status for the field. If implemented, the `Field` directive
|
|
48
|
-
* will automatically bind the invalid status from the bound field to this input.
|
|
49
|
-
*/
|
|
50
|
-
readonly invalid?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
|
|
51
|
-
/**
|
|
52
|
-
* An input to receive the pending status for the field. If implemented, the `Field` directive
|
|
53
|
-
* will automatically bind the pending status from the bound field to this input.
|
|
54
|
-
*/
|
|
55
|
-
readonly pending?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
|
|
56
|
-
/**
|
|
57
|
-
* An input to receive the touched status for the field. If implemented, the `Field` directive
|
|
58
|
-
* will automatically bind the touched status from the bound field to this input.
|
|
59
|
-
*/
|
|
60
|
-
readonly touched?: ModelSignal<boolean> | InputSignal<boolean> | InputSignalWithTransform<boolean, unknown> | OutputRef<boolean>;
|
|
61
|
-
/**
|
|
62
|
-
* An input to receive the dirty status for the field. If implemented, the `Field` directive
|
|
63
|
-
* will automatically bind the dirty status from the bound field to this input.
|
|
64
|
-
*/
|
|
65
|
-
readonly dirty?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
|
|
66
|
-
/**
|
|
67
|
-
* An input to receive the name for the field. If implemented, the `Field` directive will
|
|
68
|
-
* automatically bind the name from the bound field to this input.
|
|
69
|
-
*/
|
|
70
|
-
readonly name?: InputSignal<string> | InputSignalWithTransform<string, unknown>;
|
|
71
|
-
/**
|
|
72
|
-
* An input to receive the required status for the field. If implemented, the `Field` directive
|
|
73
|
-
* will automatically bind the required status from the bound field to this input.
|
|
74
|
-
*/
|
|
75
|
-
readonly required?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
|
|
76
|
-
/**
|
|
77
|
-
* An input to receive the min value for the field. If implemented, the `Field` directive will
|
|
78
|
-
* automatically bind the min value from the bound field to this input.
|
|
79
|
-
*/
|
|
80
|
-
readonly min?: InputSignal<number | undefined> | InputSignalWithTransform<number | undefined, unknown>;
|
|
81
|
-
/**
|
|
82
|
-
* An input to receive the min length for the field. If implemented, the `Field` directive will
|
|
83
|
-
* automatically bind the min length from the bound field to this input.
|
|
84
|
-
*/
|
|
85
|
-
readonly minLength?: InputSignal<number | undefined> | InputSignalWithTransform<number | undefined, unknown>;
|
|
86
|
-
/**
|
|
87
|
-
* An input to receive the max value for the field. If implemented, the `Field` directive will
|
|
88
|
-
* automatically bind the max value from the bound field to this input.
|
|
89
|
-
*/
|
|
90
|
-
readonly max?: InputSignal<number | undefined> | InputSignalWithTransform<number | undefined, unknown>;
|
|
91
|
-
/**
|
|
92
|
-
* An input to receive the max length for the field. If implemented, the `Field` directive will
|
|
93
|
-
* automatically bind the max length from the bound field to this input.
|
|
94
|
-
*/
|
|
95
|
-
readonly maxLength?: InputSignal<number | undefined> | InputSignalWithTransform<number | undefined, unknown>;
|
|
96
|
-
/**
|
|
97
|
-
* An input to receive the value patterns for the field. If implemented, the `Field` directive
|
|
98
|
-
* will automatically bind the value patterns from the bound field to this input.
|
|
99
|
-
*/
|
|
100
|
-
readonly pattern?: InputSignal<readonly RegExp[]> | InputSignalWithTransform<readonly RegExp[], unknown>;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* A contract for a form control that edits a `FieldTree` of type `TValue`. Any component that
|
|
104
|
-
* implements this contract can be used with the `Field` directive.
|
|
105
|
-
*
|
|
106
|
-
* Many of the properties declared on this contract are optional. They do not need to be
|
|
107
|
-
* implemented, but if they are will be kept in sync with the field state of the field bound to the
|
|
108
|
-
* `Field` directive.
|
|
109
|
-
*
|
|
110
|
-
* @template TValue The type of `FieldTree` that the implementing component can edit.
|
|
111
|
-
*
|
|
112
|
-
* @category control
|
|
113
|
-
* @experimental 21.0.0
|
|
114
|
-
*/
|
|
115
|
-
interface FormValueControl<TValue> extends FormUiControl {
|
|
116
|
-
/**
|
|
117
|
-
* The value is the only required property in this contract. A component that wants to integrate
|
|
118
|
-
* with the `Field` directive via this contract, *must* provide a `model()` that will be kept in
|
|
119
|
-
* sync with the value of the bound `FieldTree`.
|
|
120
|
-
*/
|
|
121
|
-
readonly value: ModelSignal<TValue>;
|
|
122
|
-
/**
|
|
123
|
-
* The implementing component *must not* define a `checked` property. This is reserved for
|
|
124
|
-
* components that want to integrate with the `Field` directive as a checkbox.
|
|
125
|
-
*/
|
|
126
|
-
readonly checked?: undefined;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* A contract for a form control that edits a boolean checkbox `FieldTree`. Any component that
|
|
130
|
-
* implements this contract can be used with the `Field` directive.
|
|
131
|
-
*
|
|
132
|
-
* Many of the properties declared on this contract are optional. They do not need to be
|
|
133
|
-
* implemented, but if they are will be kept in sync with the field state of the field bound to the
|
|
134
|
-
* `Field` directive.
|
|
135
|
-
*
|
|
136
|
-
* @category control
|
|
137
|
-
* @experimental 21.0.0
|
|
138
|
-
*/
|
|
139
|
-
interface FormCheckboxControl extends FormUiControl {
|
|
140
|
-
/**
|
|
141
|
-
* The checked is the only required property in this contract. A component that wants to integrate
|
|
142
|
-
* with the `Field` directive, *must* provide a `model()` that will be kept in sync with the
|
|
143
|
-
* value of the bound `FieldTree`.
|
|
144
|
-
*/
|
|
145
|
-
readonly checked: ModelSignal<boolean>;
|
|
146
|
-
/**
|
|
147
|
-
* The implementing component *must not* define a `value` property. This is reserved for
|
|
148
|
-
* components that want to integrate with the `Field` directive as a standard input.
|
|
149
|
-
*/
|
|
150
|
-
readonly value?: undefined;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
14
|
/**
|
|
154
15
|
* Adds logic to a field to conditionally disable it. A disabled field does not contribute to the
|
|
155
16
|
* validation, touched/dirty, or other state of its parent field.
|
|
@@ -231,6 +92,7 @@ type BaseValidatorConfig<TValue, TPathKind extends PathKind = PathKind.Root> = {
|
|
|
231
92
|
* or a function that receives the `FieldContext` and returns custom validation error(s).
|
|
232
93
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
233
94
|
*
|
|
95
|
+
* @see [Signal Form Email Validation](guide/forms/signals/validation#email)
|
|
234
96
|
* @category validation
|
|
235
97
|
* @experimental 21.0.0
|
|
236
98
|
*/
|
|
@@ -249,6 +111,7 @@ declare function email<TPathKind extends PathKind = PathKind.Root>(path: SchemaP
|
|
|
249
111
|
* or a function that receives the `FieldContext` and returns custom validation error(s).
|
|
250
112
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
251
113
|
*
|
|
114
|
+
* @see [Signal Form Max Validation](guide/forms/signals/validation#min-and-max)
|
|
252
115
|
* @category validation
|
|
253
116
|
* @experimental 21.0.0
|
|
254
117
|
*/
|
|
@@ -268,6 +131,7 @@ declare function max<TPathKind extends PathKind = PathKind.Root>(path: SchemaPat
|
|
|
268
131
|
* @template TValue The type of value stored in the field the logic is bound to.
|
|
269
132
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
270
133
|
*
|
|
134
|
+
* @see [Signal Form Max Length Validation](guide/forms/signals/validation#minlength-and-maxlength)
|
|
271
135
|
* @category validation
|
|
272
136
|
* @experimental 21.0.0
|
|
273
137
|
*/
|
|
@@ -286,6 +150,7 @@ declare function maxLength<TValue extends ValueWithLengthOrSize, TPathKind exten
|
|
|
286
150
|
* or a function that receives the `FieldContext` and returns custom validation error(s).
|
|
287
151
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
288
152
|
*
|
|
153
|
+
* @see [Signal Form Min Validation](guide/forms/signals/validation#min-and-max)
|
|
289
154
|
* @category validation
|
|
290
155
|
* @experimental 21.0.0
|
|
291
156
|
*/
|
|
@@ -305,6 +170,7 @@ declare function min<TValue extends number | string | null, TPathKind extends Pa
|
|
|
305
170
|
* @template TValue The type of value stored in the field the logic is bound to.
|
|
306
171
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
307
172
|
*
|
|
173
|
+
* @see [Signal Form Min Length Validation](guide/forms/signals/validation#minlength-and-maxlength)
|
|
308
174
|
* @category validation
|
|
309
175
|
* @experimental 21.0.0
|
|
310
176
|
*/
|
|
@@ -322,6 +188,7 @@ declare function minLength<TValue extends ValueWithLengthOrSize, TPathKind exten
|
|
|
322
188
|
* or a function that receives the `FieldContext` and returns custom validation error(s).
|
|
323
189
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
324
190
|
*
|
|
191
|
+
* @see [Signal Form Pattern Validation](guide/forms/signals/validation#pattern)
|
|
325
192
|
* @category validation
|
|
326
193
|
* @experimental 21.0.0
|
|
327
194
|
*/
|
|
@@ -341,6 +208,7 @@ declare function pattern<TPathKind extends PathKind = PathKind.Root>(path: Schem
|
|
|
341
208
|
* @template TValue The type of value stored in the field the logic is bound to.
|
|
342
209
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
343
210
|
*
|
|
211
|
+
* @see [Signal Form Required Validation](guide/forms/signals/validation#required)
|
|
344
212
|
* @category validation
|
|
345
213
|
* @experimental 21.0.0
|
|
346
214
|
*/
|
|
@@ -377,6 +245,7 @@ type IgnoreUnknownProperties<T> = T extends Record<PropertyKey, unknown> ? {
|
|
|
377
245
|
* or a partial of it.
|
|
378
246
|
* @template TValue The type of value stored in the field being validated.
|
|
379
247
|
*
|
|
248
|
+
* @see [Signal Form Schema Validation](guide/forms/signals/validation#integration-with-schema-validation-libraries)
|
|
380
249
|
* @category validation
|
|
381
250
|
* @experimental 21.0.0
|
|
382
251
|
*/
|
|
@@ -420,7 +289,7 @@ type MapToErrorsFn<TValue, TResult, TPathKind extends PathKind = PathKind.Root>
|
|
|
420
289
|
* @template TParams The type of parameters to the resource.
|
|
421
290
|
* @template TResult The type of result returned by the resource
|
|
422
291
|
* @template TPathKind The kind of path being validated (a root path, child path, or item of an array)
|
|
423
|
-
*
|
|
292
|
+
* @see [Signal Form Async Validation](guide/forms/signals/validation#async-validation)
|
|
424
293
|
* @category validation
|
|
425
294
|
* @experimental 21.0.0
|
|
426
295
|
*/
|
|
@@ -470,6 +339,7 @@ interface AsyncValidatorOptions<TValue, TParams, TResult, TPathKind extends Path
|
|
|
470
339
|
* @template TResult The type of result returned by the resource
|
|
471
340
|
* @template TPathKind The kind of path being validated (a root path, child path, or item of an array)
|
|
472
341
|
*
|
|
342
|
+
* @see [Signal Form Async Validation](guide/forms/signals/validation#async-validation)
|
|
473
343
|
* @category validation
|
|
474
344
|
* @experimental 21.0.0
|
|
475
345
|
*/
|
|
@@ -527,6 +397,7 @@ interface HttpValidatorOptions<TValue, TResult, TPathKind extends PathKind = Pat
|
|
|
527
397
|
* @template TResult The type of result returned by the httpResource
|
|
528
398
|
* @template TPathKind The kind of path being validated (a root path, child path, or item of an array)
|
|
529
399
|
*
|
|
400
|
+
* @see [Signal Form Async Validation](guide/forms/signals/validation#async-validation)
|
|
530
401
|
* @category validation
|
|
531
402
|
* @experimental 21.0.0
|
|
532
403
|
*/
|
|
@@ -546,6 +417,145 @@ declare function validateHttp<TValue, TResult = unknown, TPathKind extends PathK
|
|
|
546
417
|
*/
|
|
547
418
|
declare function validateTree<TValue, TPathKind extends PathKind = PathKind.Root>(path: SchemaPath<TValue, SchemaPathRules.Supported, TPathKind>, logic: NoInfer<TreeValidator<TValue, TPathKind>>): void;
|
|
548
419
|
|
|
420
|
+
/**
|
|
421
|
+
* The base set of properties shared by all form control contracts.
|
|
422
|
+
*
|
|
423
|
+
* @category control
|
|
424
|
+
* @experimental 21.0.0
|
|
425
|
+
*/
|
|
426
|
+
interface FormUiControl {
|
|
427
|
+
/**
|
|
428
|
+
* An input to receive the errors for the field. If implemented, the `Field` directive will
|
|
429
|
+
* automatically bind errors from the bound field to this input.
|
|
430
|
+
*/
|
|
431
|
+
readonly errors?: InputSignal<readonly WithOptionalField<ValidationError>[]> | InputSignalWithTransform<readonly WithOptionalField<ValidationError>[], unknown>;
|
|
432
|
+
/**
|
|
433
|
+
* An input to receive the disabled status for the field. If implemented, the `Field` directive
|
|
434
|
+
* will automatically bind the disabled status from the bound field to this input.
|
|
435
|
+
*/
|
|
436
|
+
readonly disabled?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
|
|
437
|
+
/**
|
|
438
|
+
* An input to receive the reasons for the disablement of the field. If implemented, the `Field`
|
|
439
|
+
* directive will automatically bind the disabled reason from the bound field to this input.
|
|
440
|
+
*/
|
|
441
|
+
readonly disabledReasons?: InputSignal<readonly WithOptionalField<DisabledReason>[]> | InputSignalWithTransform<readonly WithOptionalField<DisabledReason>[], unknown>;
|
|
442
|
+
/**
|
|
443
|
+
* An input to receive the readonly status for the field. If implemented, the `Field` directive
|
|
444
|
+
* will automatically bind the readonly status from the bound field to this input.
|
|
445
|
+
*/
|
|
446
|
+
readonly readonly?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
|
|
447
|
+
/**
|
|
448
|
+
* An input to receive the hidden status for the field. If implemented, the `Field` directive
|
|
449
|
+
* will automatically bind the hidden status from the bound field to this input.
|
|
450
|
+
*/
|
|
451
|
+
readonly hidden?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
|
|
452
|
+
/**
|
|
453
|
+
* An input to receive the invalid status for the field. If implemented, the `Field` directive
|
|
454
|
+
* will automatically bind the invalid status from the bound field to this input.
|
|
455
|
+
*/
|
|
456
|
+
readonly invalid?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
|
|
457
|
+
/**
|
|
458
|
+
* An input to receive the pending status for the field. If implemented, the `Field` directive
|
|
459
|
+
* will automatically bind the pending status from the bound field to this input.
|
|
460
|
+
*/
|
|
461
|
+
readonly pending?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
|
|
462
|
+
/**
|
|
463
|
+
* An input to receive the touched status for the field. If implemented, the `Field` directive
|
|
464
|
+
* will automatically bind the touched status from the bound field to this input.
|
|
465
|
+
*/
|
|
466
|
+
readonly touched?: ModelSignal<boolean> | InputSignal<boolean> | InputSignalWithTransform<boolean, unknown> | OutputRef<boolean>;
|
|
467
|
+
/**
|
|
468
|
+
* An input to receive the dirty status for the field. If implemented, the `Field` directive
|
|
469
|
+
* will automatically bind the dirty status from the bound field to this input.
|
|
470
|
+
*/
|
|
471
|
+
readonly dirty?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
|
|
472
|
+
/**
|
|
473
|
+
* An input to receive the name for the field. If implemented, the `Field` directive will
|
|
474
|
+
* automatically bind the name from the bound field to this input.
|
|
475
|
+
*/
|
|
476
|
+
readonly name?: InputSignal<string> | InputSignalWithTransform<string, unknown>;
|
|
477
|
+
/**
|
|
478
|
+
* An input to receive the required status for the field. If implemented, the `Field` directive
|
|
479
|
+
* will automatically bind the required status from the bound field to this input.
|
|
480
|
+
*/
|
|
481
|
+
readonly required?: InputSignal<boolean> | InputSignalWithTransform<boolean, unknown>;
|
|
482
|
+
/**
|
|
483
|
+
* An input to receive the min value for the field. If implemented, the `Field` directive will
|
|
484
|
+
* automatically bind the min value from the bound field to this input.
|
|
485
|
+
*/
|
|
486
|
+
readonly min?: InputSignal<number | undefined> | InputSignalWithTransform<number | undefined, unknown>;
|
|
487
|
+
/**
|
|
488
|
+
* An input to receive the min length for the field. If implemented, the `Field` directive will
|
|
489
|
+
* automatically bind the min length from the bound field to this input.
|
|
490
|
+
*/
|
|
491
|
+
readonly minLength?: InputSignal<number | undefined> | InputSignalWithTransform<number | undefined, unknown>;
|
|
492
|
+
/**
|
|
493
|
+
* An input to receive the max value for the field. If implemented, the `Field` directive will
|
|
494
|
+
* automatically bind the max value from the bound field to this input.
|
|
495
|
+
*/
|
|
496
|
+
readonly max?: InputSignal<number | undefined> | InputSignalWithTransform<number | undefined, unknown>;
|
|
497
|
+
/**
|
|
498
|
+
* An input to receive the max length for the field. If implemented, the `Field` directive will
|
|
499
|
+
* automatically bind the max length from the bound field to this input.
|
|
500
|
+
*/
|
|
501
|
+
readonly maxLength?: InputSignal<number | undefined> | InputSignalWithTransform<number | undefined, unknown>;
|
|
502
|
+
/**
|
|
503
|
+
* An input to receive the value patterns for the field. If implemented, the `Field` directive
|
|
504
|
+
* will automatically bind the value patterns from the bound field to this input.
|
|
505
|
+
*/
|
|
506
|
+
readonly pattern?: InputSignal<readonly RegExp[]> | InputSignalWithTransform<readonly RegExp[], unknown>;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* A contract for a form control that edits a `FieldTree` of type `TValue`. Any component that
|
|
510
|
+
* implements this contract can be used with the `Field` directive.
|
|
511
|
+
*
|
|
512
|
+
* Many of the properties declared on this contract are optional. They do not need to be
|
|
513
|
+
* implemented, but if they are will be kept in sync with the field state of the field bound to the
|
|
514
|
+
* `Field` directive.
|
|
515
|
+
*
|
|
516
|
+
* @template TValue The type of `FieldTree` that the implementing component can edit.
|
|
517
|
+
*
|
|
518
|
+
* @category control
|
|
519
|
+
* @experimental 21.0.0
|
|
520
|
+
*/
|
|
521
|
+
interface FormValueControl<TValue> extends FormUiControl {
|
|
522
|
+
/**
|
|
523
|
+
* The value is the only required property in this contract. A component that wants to integrate
|
|
524
|
+
* with the `Field` directive via this contract, *must* provide a `model()` that will be kept in
|
|
525
|
+
* sync with the value of the bound `FieldTree`.
|
|
526
|
+
*/
|
|
527
|
+
readonly value: ModelSignal<TValue>;
|
|
528
|
+
/**
|
|
529
|
+
* The implementing component *must not* define a `checked` property. This is reserved for
|
|
530
|
+
* components that want to integrate with the `Field` directive as a checkbox.
|
|
531
|
+
*/
|
|
532
|
+
readonly checked?: undefined;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* A contract for a form control that edits a boolean checkbox `FieldTree`. Any component that
|
|
536
|
+
* implements this contract can be used with the `Field` directive.
|
|
537
|
+
*
|
|
538
|
+
* Many of the properties declared on this contract are optional. They do not need to be
|
|
539
|
+
* implemented, but if they are will be kept in sync with the field state of the field bound to the
|
|
540
|
+
* `Field` directive.
|
|
541
|
+
*
|
|
542
|
+
* @category control
|
|
543
|
+
* @experimental 21.0.0
|
|
544
|
+
*/
|
|
545
|
+
interface FormCheckboxControl extends FormUiControl {
|
|
546
|
+
/**
|
|
547
|
+
* The checked is the only required property in this contract. A component that wants to integrate
|
|
548
|
+
* with the `Field` directive, *must* provide a `model()` that will be kept in sync with the
|
|
549
|
+
* value of the bound `FieldTree`.
|
|
550
|
+
*/
|
|
551
|
+
readonly checked: ModelSignal<boolean>;
|
|
552
|
+
/**
|
|
553
|
+
* The implementing component *must not* define a `value` property. This is reserved for
|
|
554
|
+
* components that want to integrate with the `Field` directive as a standard input.
|
|
555
|
+
*/
|
|
556
|
+
readonly value?: undefined;
|
|
557
|
+
}
|
|
558
|
+
|
|
549
559
|
/**
|
|
550
560
|
* Configures the frequency at which a form field is updated by UI events.
|
|
551
561
|
*
|