@angular/forms 21.1.0-next.0 → 21.1.0-next.1

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.1.0-next.0
2
+ * @license Angular v21.1.0-next.1
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -61,71 +61,53 @@ class FieldValidationState {
61
61
  return [];
62
62
  }
63
63
  return [...this.node.logicNode.logic.syncTreeErrors.compute(this.node.context), ...(this.node.structure.parent?.validationState.rawSyncTreeErrors() ?? [])];
64
- }, {
65
- ...(ngDevMode ? {
66
- debugName: "rawSyncTreeErrors"
67
- } : {})
68
- });
64
+ }, ...(ngDevMode ? [{
65
+ debugName: "rawSyncTreeErrors"
66
+ }] : []));
69
67
  syncErrors = computed(() => {
70
68
  if (this.shouldSkipValidation()) {
71
69
  return [];
72
70
  }
73
71
  return [...this.node.logicNode.logic.syncErrors.compute(this.node.context), ...this.syncTreeErrors(), ...normalizeErrors(this.node.submitState.serverErrors())];
74
- }, {
75
- ...(ngDevMode ? {
76
- debugName: "syncErrors"
77
- } : {})
78
- });
72
+ }, ...(ngDevMode ? [{
73
+ debugName: "syncErrors"
74
+ }] : []));
79
75
  syncValid = computed(() => {
80
76
  if (this.shouldSkipValidation()) {
81
77
  return true;
82
78
  }
83
79
  return reduceChildren(this.node, this.syncErrors().length === 0, (child, value) => value && child.validationState.syncValid(), shortCircuitFalse);
84
- }, {
85
- ...(ngDevMode ? {
86
- debugName: "syncValid"
87
- } : {})
88
- });
89
- syncTreeErrors = computed(() => this.rawSyncTreeErrors().filter(err => err.field === this.node.fieldProxy), {
90
- ...(ngDevMode ? {
91
- debugName: "syncTreeErrors"
92
- } : {})
93
- });
80
+ }, ...(ngDevMode ? [{
81
+ debugName: "syncValid"
82
+ }] : []));
83
+ syncTreeErrors = computed(() => this.rawSyncTreeErrors().filter(err => err.field === this.node.fieldProxy), ...(ngDevMode ? [{
84
+ debugName: "syncTreeErrors"
85
+ }] : []));
94
86
  rawAsyncErrors = computed(() => {
95
87
  if (this.shouldSkipValidation()) {
96
88
  return [];
97
89
  }
98
90
  return [...this.node.logicNode.logic.asyncErrors.compute(this.node.context), ...(this.node.structure.parent?.validationState.rawAsyncErrors() ?? [])];
99
- }, {
100
- ...(ngDevMode ? {
101
- debugName: "rawAsyncErrors"
102
- } : {})
103
- });
91
+ }, ...(ngDevMode ? [{
92
+ debugName: "rawAsyncErrors"
93
+ }] : []));
104
94
  asyncErrors = computed(() => {
105
95
  if (this.shouldSkipValidation()) {
106
96
  return [];
107
97
  }
108
98
  return this.rawAsyncErrors().filter(err => err === 'pending' || err.field === this.node.fieldProxy);
109
- }, {
110
- ...(ngDevMode ? {
111
- debugName: "asyncErrors"
112
- } : {})
113
- });
114
- errors = computed(() => [...this.syncErrors(), ...this.asyncErrors().filter(err => err !== 'pending')], {
115
- ...(ngDevMode ? {
116
- debugName: "errors"
117
- } : {})
118
- });
119
- errorSummary = computed(() => reduceChildren(this.node, this.errors(), (child, result) => [...result, ...child.errorSummary()]), {
120
- ...(ngDevMode ? {
121
- debugName: "errorSummary"
122
- } : {})
123
- });
124
- pending = computed(() => reduceChildren(this.node, this.asyncErrors().includes('pending'), (child, value) => value || child.validationState.asyncErrors().includes('pending')), {
125
- ...(ngDevMode ? {
126
- debugName: "pending"
127
- } : {})
128
- });
99
+ }, ...(ngDevMode ? [{
100
+ debugName: "asyncErrors"
101
+ }] : []));
102
+ errors = computed(() => [...this.syncErrors(), ...this.asyncErrors().filter(err => err !== 'pending')], ...(ngDevMode ? [{
103
+ debugName: "errors"
104
+ }] : []));
105
+ errorSummary = computed(() => reduceChildren(this.node, this.errors(), (child, result) => [...result, ...child.errorSummary()]), ...(ngDevMode ? [{
106
+ debugName: "errorSummary"
107
+ }] : []));
108
+ pending = computed(() => reduceChildren(this.node, this.asyncErrors().includes('pending'), (child, value) => value || child.validationState.asyncErrors().includes('pending')), ...(ngDevMode ? [{
109
+ debugName: "pending"
110
+ }] : []));
129
111
  status = computed(() => {
130
112
  if (this.shouldSkipValidation()) {
131
113
  return 'valid';
@@ -139,26 +121,18 @@ class FieldValidationState {
139
121
  }
140
122
  return 'valid';
141
123
  }, v => v === 'invalid');
142
- }, {
143
- ...(ngDevMode ? {
144
- debugName: "status"
145
- } : {})
146
- });
147
- valid = computed(() => this.status() === 'valid', {
148
- ...(ngDevMode ? {
149
- debugName: "valid"
150
- } : {})
151
- });
152
- invalid = computed(() => this.status() === 'invalid', {
153
- ...(ngDevMode ? {
154
- debugName: "invalid"
155
- } : {})
156
- });
157
- shouldSkipValidation = computed(() => this.node.hidden() || this.node.disabled() || this.node.readonly(), {
158
- ...(ngDevMode ? {
159
- debugName: "shouldSkipValidation"
160
- } : {})
161
- });
124
+ }, ...(ngDevMode ? [{
125
+ debugName: "status"
126
+ }] : []));
127
+ valid = computed(() => this.status() === 'valid', ...(ngDevMode ? [{
128
+ debugName: "valid"
129
+ }] : []));
130
+ invalid = computed(() => this.status() === 'invalid', ...(ngDevMode ? [{
131
+ debugName: "invalid"
132
+ }] : []));
133
+ shouldSkipValidation = computed(() => this.node.hidden() || this.node.disabled() || this.node.readonly(), ...(ngDevMode ? [{
134
+ debugName: "shouldSkipValidation"
135
+ }] : []));
162
136
  }
163
137
  function normalizeErrors(error) {
164
138
  if (error === undefined) {
@@ -768,11 +742,9 @@ class FieldNodeContext {
768
742
  }
769
743
  }
770
744
  return field.fieldProxy;
771
- }, {
772
- ...(ngDevMode ? {
773
- debugName: "resolver"
774
- } : {})
775
- });
745
+ }, ...(ngDevMode ? [{
746
+ debugName: "resolver"
747
+ }] : []));
776
748
  this.cache.set(target, resolver);
777
749
  }
778
750
  return this.cache.get(target)();
@@ -798,11 +770,9 @@ class FieldNodeContext {
798
770
  throw new Error(`RuntimeError: cannot access index, parent field is not an array`);
799
771
  }
800
772
  return Number(key);
801
- }, {
802
- ...(ngDevMode ? {
803
- debugName: "index"
804
- } : {})
805
- });
773
+ }, ...(ngDevMode ? [{
774
+ debugName: "index"
775
+ }] : []));
806
776
  fieldTreeOf = p => this.resolve(p);
807
777
  stateOf = p => this.resolve(p)();
808
778
  valueOf = p => {
@@ -831,11 +801,9 @@ class FieldMetadataState {
831
801
  }
832
802
  if (!this.metadata.has(key)) {
833
803
  const logic = this.node.logicNode.logic.getAggregateMetadata(key);
834
- const result = computed(() => logic.compute(this.node.context), {
835
- ...(ngDevMode ? {
836
- debugName: "result"
837
- } : {})
838
- });
804
+ const result = computed(() => logic.compute(this.node.context), ...(ngDevMode ? [{
805
+ debugName: "result"
806
+ }] : []));
839
807
  this.metadata.set(key, result);
840
808
  }
841
809
  return this.metadata.get(key);
@@ -989,11 +957,9 @@ class ChildFieldNodeStructure extends FieldNodeStructure {
989
957
  super(logic);
990
958
  this.parent = parent;
991
959
  this.root = this.parent.structure.root;
992
- this.pathKeys = computed(() => [...parent.structure.pathKeys(), this.keyInParent()], {
993
- ...(ngDevMode ? {
994
- debugName: "pathKeys"
995
- } : {})
996
- });
960
+ this.pathKeys = computed(() => [...parent.structure.pathKeys(), this.keyInParent()], ...(ngDevMode ? [{
961
+ debugName: "pathKeys"
962
+ }] : []));
997
963
  if (identityInParent === undefined) {
998
964
  const key = initialKeyInParent;
999
965
  this.keyInParent = computed(() => {
@@ -1001,11 +967,9 @@ class ChildFieldNodeStructure extends FieldNodeStructure {
1001
967
  throw new Error(`RuntimeError: orphan field, looking for property '${key}' of ${getDebugName(parent)}`);
1002
968
  }
1003
969
  return key;
1004
- }, {
1005
- ...(ngDevMode ? {
1006
- debugName: "keyInParent"
1007
- } : {})
1008
- });
970
+ }, ...(ngDevMode ? [{
971
+ debugName: "keyInParent"
972
+ }] : []));
1009
973
  } else {
1010
974
  let lastKnownKey = initialKeyInParent;
1011
975
  this.keyInParent = computed(() => {
@@ -1024,11 +988,9 @@ class ChildFieldNodeStructure extends FieldNodeStructure {
1024
988
  }
1025
989
  }
1026
990
  throw new Error(`RuntimeError: orphan field, can't find element in array ${getDebugName(parent)}`);
1027
- }, {
1028
- ...(ngDevMode ? {
1029
- debugName: "keyInParent"
1030
- } : {})
1031
- });
991
+ }, ...(ngDevMode ? [{
992
+ debugName: "keyInParent"
993
+ }] : []));
1032
994
  }
1033
995
  this.value = deepSignal(this.parent.structure.value, this.keyInParent);
1034
996
  this.childrenMap = makeChildrenMapSignal(node, this.value, this.identitySymbol, pathNode, logic, adapter, createChildNode);
@@ -1036,18 +998,14 @@ class ChildFieldNodeStructure extends FieldNodeStructure {
1036
998
  }
1037
999
  }
1038
1000
  let globalId = 0;
1039
- const ROOT_PATH_KEYS = computed(() => [], {
1040
- ...(ngDevMode ? {
1041
- debugName: "ROOT_PATH_KEYS"
1042
- } : {})
1043
- });
1001
+ const ROOT_PATH_KEYS = computed(() => [], ...(ngDevMode ? [{
1002
+ debugName: "ROOT_PATH_KEYS"
1003
+ }] : []));
1044
1004
  const ROOT_KEY_IN_PARENT = computed(() => {
1045
1005
  throw new Error(`RuntimeError: the top-level field in the form has no parent`);
1046
- }, {
1047
- ...(ngDevMode ? {
1048
- debugName: "ROOT_KEY_IN_PARENT"
1049
- } : {})
1050
- });
1006
+ }, ...(ngDevMode ? [{
1007
+ debugName: "ROOT_KEY_IN_PARENT"
1008
+ }] : []));
1051
1009
  function makeChildrenMapSignal(node, valueSignal, identitySymbol, pathNode, logic, adapter, createChildNode) {
1052
1010
  return linkedSignal({
1053
1011
  source: valueSignal,
@@ -1125,11 +1083,9 @@ function getDebugName(node) {
1125
1083
 
1126
1084
  class FieldSubmitState {
1127
1085
  node;
1128
- selfSubmitting = signal(false, {
1129
- ...(ngDevMode ? {
1130
- debugName: "selfSubmitting"
1131
- } : {})
1132
- });
1086
+ selfSubmitting = signal(false, ...(ngDevMode ? [{
1087
+ debugName: "selfSubmitting"
1088
+ }] : []));
1133
1089
  serverErrors;
1134
1090
  constructor(node) {
1135
1091
  this.node = node;
@@ -1143,11 +1099,9 @@ class FieldSubmitState {
1143
1099
  }
1144
1100
  submitting = computed(() => {
1145
1101
  return this.selfSubmitting() || (this.node.structure.parent?.submitting() ?? false);
1146
- }, {
1147
- ...(ngDevMode ? {
1148
- debugName: "submitting"
1149
- } : {})
1150
- });
1102
+ }, ...(ngDevMode ? [{
1103
+ debugName: "submitting"
1104
+ }] : []));
1151
1105
  }
1152
1106
 
1153
1107
  class FieldNode {
@@ -1186,11 +1140,9 @@ class FieldNode {
1186
1140
  get value() {
1187
1141
  return this.structure.value;
1188
1142
  }
1189
- _controlValue = linkedSignal(() => this.value(), {
1190
- ...(ngDevMode ? {
1191
- debugName: "_controlValue"
1192
- } : {})
1193
- });
1143
+ _controlValue = linkedSignal(() => this.value(), ...(ngDevMode ? [{
1144
+ debugName: "_controlValue"
1145
+ }] : []));
1194
1146
  get controlValue() {
1195
1147
  return this._controlValue.asReadonly();
1196
1148
  }
@@ -1321,29 +1273,21 @@ class FieldNode {
1321
1273
  return options.kind === 'root' ? new RootFieldNodeStructure(this, options.pathNode, options.logic, options.fieldManager, options.value, options.fieldAdapter, FieldNode.newChild) : new ChildFieldNodeStructure(this, options.pathNode, options.logic, options.parent, options.identityInParent, options.initialKeyInParent, options.fieldAdapter, FieldNode.newChild);
1322
1274
  }
1323
1275
  }
1324
- const EMPTY = computed(() => [], {
1325
- ...(ngDevMode ? {
1326
- debugName: "EMPTY"
1327
- } : {})
1328
- });
1329
- const FALSE = computed(() => false, {
1330
- ...(ngDevMode ? {
1331
- debugName: "FALSE"
1332
- } : {})
1333
- });
1276
+ const EMPTY = computed(() => [], ...(ngDevMode ? [{
1277
+ debugName: "EMPTY"
1278
+ }] : []));
1279
+ const FALSE = computed(() => false, ...(ngDevMode ? [{
1280
+ debugName: "FALSE"
1281
+ }] : []));
1334
1282
 
1335
1283
  class FieldNodeState {
1336
1284
  node;
1337
- selfTouched = signal(false, {
1338
- ...(ngDevMode ? {
1339
- debugName: "selfTouched"
1340
- } : {})
1341
- });
1342
- selfDirty = signal(false, {
1343
- ...(ngDevMode ? {
1344
- debugName: "selfDirty"
1345
- } : {})
1346
- });
1285
+ selfTouched = signal(false, ...(ngDevMode ? [{
1286
+ debugName: "selfTouched"
1287
+ }] : []));
1288
+ selfDirty = signal(false, ...(ngDevMode ? [{
1289
+ debugName: "selfDirty"
1290
+ }] : []));
1347
1291
  markAsTouched() {
1348
1292
  this.selfTouched.set(true);
1349
1293
  }
@@ -1356,61 +1300,45 @@ class FieldNodeState {
1356
1300
  markAsUntouched() {
1357
1301
  this.selfTouched.set(false);
1358
1302
  }
1359
- fieldBindings = signal([], {
1360
- ...(ngDevMode ? {
1361
- debugName: "fieldBindings"
1362
- } : {})
1363
- });
1303
+ fieldBindings = signal([], ...(ngDevMode ? [{
1304
+ debugName: "fieldBindings"
1305
+ }] : []));
1364
1306
  constructor(node) {
1365
1307
  this.node = node;
1366
1308
  }
1367
1309
  dirty = computed(() => {
1368
1310
  const selfDirtyValue = this.selfDirty() && !this.isNonInteractive();
1369
1311
  return reduceChildren(this.node, selfDirtyValue, (child, value) => value || child.nodeState.dirty(), shortCircuitTrue);
1370
- }, {
1371
- ...(ngDevMode ? {
1372
- debugName: "dirty"
1373
- } : {})
1374
- });
1312
+ }, ...(ngDevMode ? [{
1313
+ debugName: "dirty"
1314
+ }] : []));
1375
1315
  touched = computed(() => {
1376
1316
  const selfTouchedValue = this.selfTouched() && !this.isNonInteractive();
1377
1317
  return reduceChildren(this.node, selfTouchedValue, (child, value) => value || child.nodeState.touched(), shortCircuitTrue);
1378
- }, {
1379
- ...(ngDevMode ? {
1380
- debugName: "touched"
1381
- } : {})
1382
- });
1383
- disabledReasons = computed(() => [...(this.node.structure.parent?.nodeState.disabledReasons() ?? []), ...this.node.logicNode.logic.disabledReasons.compute(this.node.context)], {
1384
- ...(ngDevMode ? {
1385
- debugName: "disabledReasons"
1386
- } : {})
1387
- });
1388
- disabled = computed(() => !!this.disabledReasons().length, {
1389
- ...(ngDevMode ? {
1390
- debugName: "disabled"
1391
- } : {})
1392
- });
1393
- readonly = computed(() => (this.node.structure.parent?.nodeState.readonly() || this.node.logicNode.logic.readonly.compute(this.node.context)) ?? false, {
1394
- ...(ngDevMode ? {
1395
- debugName: "readonly"
1396
- } : {})
1397
- });
1398
- hidden = computed(() => (this.node.structure.parent?.nodeState.hidden() || this.node.logicNode.logic.hidden.compute(this.node.context)) ?? false, {
1399
- ...(ngDevMode ? {
1400
- debugName: "hidden"
1401
- } : {})
1402
- });
1318
+ }, ...(ngDevMode ? [{
1319
+ debugName: "touched"
1320
+ }] : []));
1321
+ disabledReasons = computed(() => [...(this.node.structure.parent?.nodeState.disabledReasons() ?? []), ...this.node.logicNode.logic.disabledReasons.compute(this.node.context)], ...(ngDevMode ? [{
1322
+ debugName: "disabledReasons"
1323
+ }] : []));
1324
+ disabled = computed(() => !!this.disabledReasons().length, ...(ngDevMode ? [{
1325
+ debugName: "disabled"
1326
+ }] : []));
1327
+ readonly = computed(() => (this.node.structure.parent?.nodeState.readonly() || this.node.logicNode.logic.readonly.compute(this.node.context)) ?? false, ...(ngDevMode ? [{
1328
+ debugName: "readonly"
1329
+ }] : []));
1330
+ hidden = computed(() => (this.node.structure.parent?.nodeState.hidden() || this.node.logicNode.logic.hidden.compute(this.node.context)) ?? false, ...(ngDevMode ? [{
1331
+ debugName: "hidden"
1332
+ }] : []));
1403
1333
  name = computed(() => {
1404
1334
  const parent = this.node.structure.parent;
1405
1335
  if (!parent) {
1406
1336
  return this.node.structure.fieldManager.rootName;
1407
1337
  }
1408
1338
  return `${parent.name()}.${this.node.structure.keyInParent()}`;
1409
- }, {
1410
- ...(ngDevMode ? {
1411
- debugName: "name"
1412
- } : {})
1413
- });
1339
+ }, ...(ngDevMode ? [{
1340
+ debugName: "name"
1341
+ }] : []));
1414
1342
  debouncer = computed(() => {
1415
1343
  if (this.node.logicNode.logic.hasAggregateMetadata(DEBOUNCER)) {
1416
1344
  const debouncerLogic = this.node.logicNode.logic.getAggregateMetadata(DEBOUNCER);
@@ -1420,16 +1348,12 @@ class FieldNodeState {
1420
1348
  }
1421
1349
  }
1422
1350
  return this.node.structure.parent?.nodeState.debouncer?.();
1423
- }, {
1424
- ...(ngDevMode ? {
1425
- debugName: "debouncer"
1426
- } : {})
1427
- });
1428
- isNonInteractive = computed(() => this.hidden() || this.disabled() || this.readonly(), {
1429
- ...(ngDevMode ? {
1430
- debugName: "isNonInteractive"
1431
- } : {})
1432
- });
1351
+ }, ...(ngDevMode ? [{
1352
+ debugName: "debouncer"
1353
+ }] : []));
1354
+ isNonInteractive = computed(() => this.hidden() || this.disabled() || this.readonly(), ...(ngDevMode ? [{
1355
+ debugName: "isNonInteractive"
1356
+ }] : []));
1433
1357
  }
1434
1358
 
1435
1359
  class BasicFieldAdapter {