@angular/forms 21.1.0-rc.0 → 21.1.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.
- package/fesm2022/_structure-chunk.mjs +31 -7
- package/fesm2022/_structure-chunk.mjs.map +1 -1
- package/fesm2022/forms.mjs +128 -128
- package/fesm2022/forms.mjs.map +1 -1
- package/fesm2022/signals-compat.mjs +1 -1
- package/fesm2022/signals.mjs +22 -111
- package/fesm2022/signals.mjs.map +1 -1
- package/package.json +4 -4
- package/resources/code-examples.db +0 -0
- package/types/_structure-chunk.d.ts +51 -65
- package/types/forms.d.ts +2 -2
- package/types/signals-compat.d.ts +1 -1
- package/types/signals.d.ts +9 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v21.1.
|
|
2
|
+
* @license Angular v21.1.1
|
|
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"
|
|
@@ -1270,9 +1278,10 @@ class FieldNode {
|
|
|
1270
1278
|
return this.metadataState.has(key);
|
|
1271
1279
|
}
|
|
1272
1280
|
markAsTouched() {
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1281
|
+
untracked(() => {
|
|
1282
|
+
this.nodeState.markAsTouched();
|
|
1283
|
+
this.flushSync();
|
|
1284
|
+
});
|
|
1276
1285
|
}
|
|
1277
1286
|
markAsDirty() {
|
|
1278
1287
|
this.nodeState.markAsDirty();
|
|
@@ -1291,13 +1300,22 @@ class FieldNode {
|
|
|
1291
1300
|
}
|
|
1292
1301
|
}
|
|
1293
1302
|
setControlValue(newValue) {
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1303
|
+
untracked(() => {
|
|
1304
|
+
this._controlValue.set(newValue);
|
|
1305
|
+
this.markAsDirty();
|
|
1306
|
+
this.debounceSync();
|
|
1307
|
+
});
|
|
1297
1308
|
}
|
|
1298
1309
|
sync() {
|
|
1299
1310
|
this.value.set(this.controlValue());
|
|
1300
1311
|
}
|
|
1312
|
+
flushSync() {
|
|
1313
|
+
const pending = this.pendingSync();
|
|
1314
|
+
if (pending && !pending.signal.aborted) {
|
|
1315
|
+
pending.abort();
|
|
1316
|
+
this.sync();
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1301
1319
|
async debounceSync() {
|
|
1302
1320
|
this.pendingSync()?.abort();
|
|
1303
1321
|
const debouncer = this.nodeState.debouncer();
|
|
@@ -1347,6 +1365,12 @@ const EMPTY = computed(() => [], ...(ngDevMode ? [{
|
|
|
1347
1365
|
const FALSE = computed(() => false, ...(ngDevMode ? [{
|
|
1348
1366
|
debugName: "FALSE"
|
|
1349
1367
|
}] : []));
|
|
1368
|
+
function firstInDom(a, b) {
|
|
1369
|
+
if (!a) return b;
|
|
1370
|
+
if (!b) return a;
|
|
1371
|
+
const position = a.element.compareDocumentPosition(b.element);
|
|
1372
|
+
return position & Node.DOCUMENT_POSITION_PRECEDING ? b : a;
|
|
1373
|
+
}
|
|
1350
1374
|
|
|
1351
1375
|
class FieldNodeState {
|
|
1352
1376
|
node;
|