@angular/forms 21.1.0-rc.0 → 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.1.0-rc.0
2
+ * @license Angular v21.1.0
3
3
  * (c) 2010-2026 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -1178,6 +1178,14 @@ class FieldNode {
1178
1178
  this.metadataState = new FieldMetadataState(this);
1179
1179
  this.submitState = new FieldSubmitState(this);
1180
1180
  }
1181
+ focusBoundControl() {
1182
+ this.getBindingForFocus()?.focus();
1183
+ }
1184
+ getBindingForFocus() {
1185
+ const own = this.formFieldBindings().filter(b => b.focus !== undefined).reduce(firstInDom, undefined);
1186
+ if (own) return own;
1187
+ return this.structure.children().map(child => child.getBindingForFocus()).reduce(firstInDom, undefined);
1188
+ }
1181
1189
  pendingSync = linkedSignal({
1182
1190
  ...(ngDevMode ? {
1183
1191
  debugName: "pendingSync"
@@ -1347,6 +1355,12 @@ const EMPTY = computed(() => [], ...(ngDevMode ? [{
1347
1355
  const FALSE = computed(() => false, ...(ngDevMode ? [{
1348
1356
  debugName: "FALSE"
1349
1357
  }] : []));
1358
+ function firstInDom(a, b) {
1359
+ if (!a) return b;
1360
+ if (!b) return a;
1361
+ const position = a.element.compareDocumentPosition(b.element);
1362
+ return position & Node.DOCUMENT_POSITION_PRECEDING ? b : a;
1363
+ }
1350
1364
 
1351
1365
  class FieldNodeState {
1352
1366
  node;