@angular/forms 21.0.0-next.4 → 21.0.0-next.5
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/fesm2022/forms.mjs +142 -137
- package/fesm2022/forms.mjs.map +1 -1
- package/fesm2022/signals.mjs +43 -4
- package/fesm2022/signals.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +4 -4
- package/signals/index.d.ts +90 -1
package/fesm2022/signals.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v21.0.0-next.
|
|
2
|
+
* @license Angular v21.0.0-next.5
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -1072,6 +1072,7 @@ function assertPathIsCurrent(path) {
|
|
|
1072
1072
|
* Represents a property that may be defined on a field when it is created using a `property` rule
|
|
1073
1073
|
* in the schema. A particular `Property` can only be defined on a particular field **once**.
|
|
1074
1074
|
*
|
|
1075
|
+
* @category logic
|
|
1075
1076
|
* @experimental 21.0.0
|
|
1076
1077
|
*/
|
|
1077
1078
|
class Property {
|
|
@@ -1175,36 +1176,42 @@ function andProperty() {
|
|
|
1175
1176
|
/**
|
|
1176
1177
|
* An aggregate property representing whether the field is required.
|
|
1177
1178
|
*
|
|
1179
|
+
* @category validation
|
|
1178
1180
|
* @experimental 21.0.0
|
|
1179
1181
|
*/
|
|
1180
1182
|
const REQUIRED = orProperty();
|
|
1181
1183
|
/**
|
|
1182
1184
|
* An aggregate property representing the min value of the field.
|
|
1183
1185
|
*
|
|
1186
|
+
* @category validation
|
|
1184
1187
|
* @experimental 21.0.0
|
|
1185
1188
|
*/
|
|
1186
1189
|
const MIN = maxProperty();
|
|
1187
1190
|
/**
|
|
1188
1191
|
* An aggregate property representing the max value of the field.
|
|
1189
1192
|
*
|
|
1193
|
+
* @category validation
|
|
1190
1194
|
* @experimental 21.0.0
|
|
1191
1195
|
*/
|
|
1192
1196
|
const MAX = minProperty();
|
|
1193
1197
|
/**
|
|
1194
1198
|
* An aggregate property representing the min length of the field.
|
|
1195
1199
|
*
|
|
1200
|
+
* @category validation
|
|
1196
1201
|
* @experimental 21.0.0
|
|
1197
1202
|
*/
|
|
1198
1203
|
const MIN_LENGTH = maxProperty();
|
|
1199
1204
|
/**
|
|
1200
1205
|
* An aggregate property representing the max length of the field.
|
|
1201
1206
|
*
|
|
1207
|
+
* @category validation
|
|
1202
1208
|
* @experimental 21.0.0
|
|
1203
1209
|
*/
|
|
1204
1210
|
const MAX_LENGTH = minProperty();
|
|
1205
1211
|
/**
|
|
1206
1212
|
* An aggregate property representing the patterns the field must match.
|
|
1207
1213
|
*
|
|
1214
|
+
* @category validation
|
|
1208
1215
|
* @experimental 21.0.0
|
|
1209
1216
|
*/
|
|
1210
1217
|
const PATTERN = listProperty();
|
|
@@ -1219,6 +1226,7 @@ const PATTERN = listProperty();
|
|
|
1219
1226
|
* @template TValue The type of value stored in the field the logic is bound to.
|
|
1220
1227
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
1221
1228
|
*
|
|
1229
|
+
* @category logic
|
|
1222
1230
|
* @experimental 21.0.0
|
|
1223
1231
|
*/
|
|
1224
1232
|
function disabled(path, logic) {
|
|
@@ -1247,6 +1255,7 @@ function disabled(path, logic) {
|
|
|
1247
1255
|
* @template TValue The type of value stored in the field the logic is bound to.
|
|
1248
1256
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
1249
1257
|
*
|
|
1258
|
+
* @category logic
|
|
1250
1259
|
* @experimental 21.0.0
|
|
1251
1260
|
*/
|
|
1252
1261
|
function readonly(path, logic = () => true) {
|
|
@@ -1271,6 +1280,7 @@ function readonly(path, logic = () => true) {
|
|
|
1271
1280
|
* @template TValue The type of value stored in the field the logic is bound to.
|
|
1272
1281
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
1273
1282
|
*
|
|
1283
|
+
* @category logic
|
|
1274
1284
|
* @experimental 21.0.0
|
|
1275
1285
|
*/
|
|
1276
1286
|
function hidden(path, logic) {
|
|
@@ -1286,6 +1296,7 @@ function hidden(path, logic) {
|
|
|
1286
1296
|
* @template TValue The type of value stored in the field the logic is bound to.
|
|
1287
1297
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
1288
1298
|
*
|
|
1299
|
+
* @category logic
|
|
1289
1300
|
* @experimental 21.0.0
|
|
1290
1301
|
*/
|
|
1291
1302
|
function validate(path, logic) {
|
|
@@ -1302,6 +1313,7 @@ function validate(path, logic) {
|
|
|
1302
1313
|
* @template TValue The type of value stored in the field the logic is bound to.
|
|
1303
1314
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
1304
1315
|
*
|
|
1316
|
+
* @category logic
|
|
1305
1317
|
* @experimental 21.0.0
|
|
1306
1318
|
*/
|
|
1307
1319
|
function validateTree(path, logic) {
|
|
@@ -1319,6 +1331,7 @@ function validateTree(path, logic) {
|
|
|
1319
1331
|
* @template TPropItem The type of value the property aggregates over.
|
|
1320
1332
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
1321
1333
|
*
|
|
1334
|
+
* @category logic
|
|
1322
1335
|
* @experimental 21.0.0
|
|
1323
1336
|
*/
|
|
1324
1337
|
function aggregateProperty(path, prop, logic) {
|
|
@@ -1353,6 +1366,7 @@ function property(path, ...rest) {
|
|
|
1353
1366
|
* @template TResult The type of result returned by the resource
|
|
1354
1367
|
* @template TPathKind The kind of path being validated (a root path, child path, or item of an array)
|
|
1355
1368
|
*
|
|
1369
|
+
* @category validation
|
|
1356
1370
|
* @experimental 21.0.0
|
|
1357
1371
|
*/
|
|
1358
1372
|
function validateAsync(path, opts) {
|
|
@@ -1400,6 +1414,7 @@ function validateAsync(path, opts) {
|
|
|
1400
1414
|
* @template TResult The type of result returned by the httpResource
|
|
1401
1415
|
* @template TPathKind The kind of path being validated (a root path, child path, or item of an array)
|
|
1402
1416
|
*
|
|
1417
|
+
* @category validation
|
|
1403
1418
|
* @experimental 21.0.0
|
|
1404
1419
|
*/
|
|
1405
1420
|
function validateHttp(path, opts) {
|
|
@@ -1542,6 +1557,7 @@ function isInputSignal(value) {
|
|
|
1542
1557
|
* forms `NgControl`. This is provided to improve interoperability with controls designed to work
|
|
1543
1558
|
* with reactive forms. It should not be used by controls written for signal forms.
|
|
1544
1559
|
*
|
|
1560
|
+
* @category control
|
|
1545
1561
|
* @experimental 21.0.0
|
|
1546
1562
|
*/
|
|
1547
1563
|
class Control {
|
|
@@ -1857,15 +1873,15 @@ class Control {
|
|
|
1857
1873
|
}
|
|
1858
1874
|
};
|
|
1859
1875
|
}
|
|
1860
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.
|
|
1861
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.0-next.
|
|
1876
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.5", ngImport: i0, type: Control, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1877
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.0.0-next.5", type: Control, isStandalone: true, selector: "[control]", inputs: { _field: ["control", "_field"] }, providers: [
|
|
1862
1878
|
{
|
|
1863
1879
|
provide: NgControl,
|
|
1864
1880
|
useFactory: () => inject(Control).ngControl,
|
|
1865
1881
|
},
|
|
1866
1882
|
], ngImport: i0 });
|
|
1867
1883
|
}
|
|
1868
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.
|
|
1884
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.5", ngImport: i0, type: Control, decorators: [{
|
|
1869
1885
|
type: Directive,
|
|
1870
1886
|
args: [{
|
|
1871
1887
|
selector: '[control]',
|
|
@@ -2900,6 +2916,7 @@ function form(...args) {
|
|
|
2900
2916
|
* element of the array.
|
|
2901
2917
|
* @template TValue The data type of the item field to apply the schema to.
|
|
2902
2918
|
*
|
|
2919
|
+
* @category structure
|
|
2903
2920
|
* @experimental 21.0.0
|
|
2904
2921
|
*/
|
|
2905
2922
|
function applyEach(path, schema) {
|
|
@@ -2925,6 +2942,7 @@ function applyEach(path, schema) {
|
|
|
2925
2942
|
* @param schema The schema to apply to the property
|
|
2926
2943
|
* @template TValue The data type of the field to apply the schema to.
|
|
2927
2944
|
*
|
|
2945
|
+
* @category structure
|
|
2928
2946
|
* @experimental 21.0.0
|
|
2929
2947
|
*/
|
|
2930
2948
|
function apply(path, schema) {
|
|
@@ -2940,6 +2958,7 @@ function apply(path, schema) {
|
|
|
2940
2958
|
* @param schema The schema to apply to the field when the `logic` function returns `true`.
|
|
2941
2959
|
* @template TValue The data type of the field to apply the schema to.
|
|
2942
2960
|
*
|
|
2961
|
+
* @category structure
|
|
2943
2962
|
* @experimental 21.0.0
|
|
2944
2963
|
*/
|
|
2945
2964
|
function applyWhen(path, logic, schema) {
|
|
@@ -2981,6 +3000,7 @@ function applyWhenValue(path, predicate, schema) {
|
|
|
2981
3000
|
* errors.
|
|
2982
3001
|
* @template TValue The data type of the field being submitted.
|
|
2983
3002
|
*
|
|
3003
|
+
* @category submission
|
|
2984
3004
|
* @experimental 21.0.0
|
|
2985
3005
|
*/
|
|
2986
3006
|
async function submit(form, action) {
|
|
@@ -3030,6 +3050,7 @@ function setServerErrors(submittedField, errors) {
|
|
|
3030
3050
|
* @returns A schema object that implements the given logic.
|
|
3031
3051
|
* @template TValue The value type of a `Field` that this schema binds to.
|
|
3032
3052
|
*
|
|
3053
|
+
* @category structure
|
|
3033
3054
|
* @experimental 21.0.0
|
|
3034
3055
|
*/
|
|
3035
3056
|
function schema(fn) {
|
|
@@ -3073,6 +3094,7 @@ function customError(obj) {
|
|
|
3073
3094
|
/**
|
|
3074
3095
|
* A custom error that may contain additional properties
|
|
3075
3096
|
*
|
|
3097
|
+
* @category validation
|
|
3076
3098
|
* @experimental 21.0.0
|
|
3077
3099
|
*/
|
|
3078
3100
|
class CustomValidationError {
|
|
@@ -3114,6 +3136,7 @@ class _NgValidationError {
|
|
|
3114
3136
|
/**
|
|
3115
3137
|
* An error used to indicate that a required field is empty.
|
|
3116
3138
|
*
|
|
3139
|
+
* @category validation
|
|
3117
3140
|
* @experimental 21.0.0
|
|
3118
3141
|
*/
|
|
3119
3142
|
class RequiredValidationError extends _NgValidationError {
|
|
@@ -3122,6 +3145,7 @@ class RequiredValidationError extends _NgValidationError {
|
|
|
3122
3145
|
/**
|
|
3123
3146
|
* An error used to indicate that a value is lower than the minimum allowed.
|
|
3124
3147
|
*
|
|
3148
|
+
* @category validation
|
|
3125
3149
|
* @experimental 21.0.0
|
|
3126
3150
|
*/
|
|
3127
3151
|
class MinValidationError extends _NgValidationError {
|
|
@@ -3135,6 +3159,7 @@ class MinValidationError extends _NgValidationError {
|
|
|
3135
3159
|
/**
|
|
3136
3160
|
* An error used to indicate that a value is higher than the maximum allowed.
|
|
3137
3161
|
*
|
|
3162
|
+
* @category validation
|
|
3138
3163
|
* @experimental 21.0.0
|
|
3139
3164
|
*/
|
|
3140
3165
|
class MaxValidationError extends _NgValidationError {
|
|
@@ -3148,6 +3173,7 @@ class MaxValidationError extends _NgValidationError {
|
|
|
3148
3173
|
/**
|
|
3149
3174
|
* An error used to indicate that a value is shorter than the minimum allowed length.
|
|
3150
3175
|
*
|
|
3176
|
+
* @category validation
|
|
3151
3177
|
* @experimental 21.0.0
|
|
3152
3178
|
*/
|
|
3153
3179
|
class MinLengthValidationError extends _NgValidationError {
|
|
@@ -3161,6 +3187,7 @@ class MinLengthValidationError extends _NgValidationError {
|
|
|
3161
3187
|
/**
|
|
3162
3188
|
* An error used to indicate that a value is longer than the maximum allowed length.
|
|
3163
3189
|
*
|
|
3190
|
+
* @category validation
|
|
3164
3191
|
* @experimental 21.0.0
|
|
3165
3192
|
*/
|
|
3166
3193
|
class MaxLengthValidationError extends _NgValidationError {
|
|
@@ -3174,6 +3201,7 @@ class MaxLengthValidationError extends _NgValidationError {
|
|
|
3174
3201
|
/**
|
|
3175
3202
|
* An error used to indicate that a value does not match the required pattern.
|
|
3176
3203
|
*
|
|
3204
|
+
* @category validation
|
|
3177
3205
|
* @experimental 21.0.0
|
|
3178
3206
|
*/
|
|
3179
3207
|
class PatternValidationError extends _NgValidationError {
|
|
@@ -3187,6 +3215,7 @@ class PatternValidationError extends _NgValidationError {
|
|
|
3187
3215
|
/**
|
|
3188
3216
|
* An error used to indicate that a value is not a valid email.
|
|
3189
3217
|
*
|
|
3218
|
+
* @category validation
|
|
3190
3219
|
* @experimental 21.0.0
|
|
3191
3220
|
*/
|
|
3192
3221
|
class EmailValidationError extends _NgValidationError {
|
|
@@ -3195,6 +3224,7 @@ class EmailValidationError extends _NgValidationError {
|
|
|
3195
3224
|
/**
|
|
3196
3225
|
* An error used to indicate an issue validating against a standard schema.
|
|
3197
3226
|
*
|
|
3227
|
+
* @category validation
|
|
3198
3228
|
* @experimental 21.0.0
|
|
3199
3229
|
*/
|
|
3200
3230
|
class StandardSchemaValidationError extends _NgValidationError {
|
|
@@ -3227,6 +3257,7 @@ class StandardSchemaValidationError extends _NgValidationError {
|
|
|
3227
3257
|
* }
|
|
3228
3258
|
* ```
|
|
3229
3259
|
*
|
|
3260
|
+
* @category validation
|
|
3230
3261
|
* @experimental 21.0.0
|
|
3231
3262
|
*/
|
|
3232
3263
|
const NgValidationError = _NgValidationError;
|
|
@@ -3298,6 +3329,7 @@ const EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(
|
|
|
3298
3329
|
* or a function that receives the `FieldContext` and returns custom validation error(s).
|
|
3299
3330
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
3300
3331
|
*
|
|
3332
|
+
* @category validation
|
|
3301
3333
|
* @experimental 21.0.0
|
|
3302
3334
|
*/
|
|
3303
3335
|
function email(path, config) {
|
|
@@ -3330,6 +3362,7 @@ function email(path, config) {
|
|
|
3330
3362
|
* or a function that receives the `FieldContext` and returns custom validation error(s).
|
|
3331
3363
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
3332
3364
|
*
|
|
3365
|
+
* @category validation
|
|
3333
3366
|
* @experimental 21.0.0
|
|
3334
3367
|
*/
|
|
3335
3368
|
function max(path, maxValue, config) {
|
|
@@ -3369,6 +3402,7 @@ function max(path, maxValue, config) {
|
|
|
3369
3402
|
* @template TValue The type of value stored in the field the logic is bound to.
|
|
3370
3403
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
3371
3404
|
*
|
|
3405
|
+
* @category validation
|
|
3372
3406
|
* @experimental 21.0.0
|
|
3373
3407
|
*/
|
|
3374
3408
|
function maxLength(path, maxLength, config) {
|
|
@@ -3407,6 +3441,7 @@ function maxLength(path, maxLength, config) {
|
|
|
3407
3441
|
* or a function that receives the `FieldContext` and returns custom validation error(s).
|
|
3408
3442
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
3409
3443
|
*
|
|
3444
|
+
* @category validation
|
|
3410
3445
|
* @experimental 21.0.0
|
|
3411
3446
|
*/
|
|
3412
3447
|
function min(path, minValue, config) {
|
|
@@ -3446,6 +3481,7 @@ function min(path, minValue, config) {
|
|
|
3446
3481
|
* @template TValue The type of value stored in the field the logic is bound to.
|
|
3447
3482
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
3448
3483
|
*
|
|
3484
|
+
* @category validation
|
|
3449
3485
|
* @experimental 21.0.0
|
|
3450
3486
|
*/
|
|
3451
3487
|
function minLength(path, minLength, config) {
|
|
@@ -3483,6 +3519,7 @@ function minLength(path, minLength, config) {
|
|
|
3483
3519
|
* or a function that receives the `FieldContext` and returns custom validation error(s).
|
|
3484
3520
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
3485
3521
|
*
|
|
3522
|
+
* @category validation
|
|
3486
3523
|
* @experimental 21.0.0
|
|
3487
3524
|
*/
|
|
3488
3525
|
function pattern(path, pattern, config) {
|
|
@@ -3522,6 +3559,7 @@ function pattern(path, pattern, config) {
|
|
|
3522
3559
|
* @template TValue The type of value stored in the field the logic is bound to.
|
|
3523
3560
|
* @template TPathKind The kind of path the logic is bound to (a root path, child path, or item of an array)
|
|
3524
3561
|
*
|
|
3562
|
+
* @category validation
|
|
3525
3563
|
* @experimental 21.0.0
|
|
3526
3564
|
*/
|
|
3527
3565
|
function required(path, config) {
|
|
@@ -3551,6 +3589,7 @@ function required(path, config) {
|
|
|
3551
3589
|
* or a partial of it.
|
|
3552
3590
|
* @template TValue The type of value stored in the field being validated.
|
|
3553
3591
|
*
|
|
3592
|
+
* @category validation
|
|
3554
3593
|
* @experimental 21.0.0
|
|
3555
3594
|
*/
|
|
3556
3595
|
function validateStandardSchema(path, schema) {
|