@angular/forms 21.1.0-next.4 → 21.1.0-rc.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 +15 -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 +148 -67
- 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 +70 -59
- package/types/forms.d.ts +26 -9
- package/types/signals-compat.d.ts +2 -2
- package/types/signals.d.ts +155 -145
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2010-
|
|
3
|
+
Copyright (c) 2010-2026 Google LLC. https://angular.dev/license
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v21.1.0-
|
|
3
|
-
* (c) 2010-
|
|
2
|
+
* @license Angular v21.1.0-rc.0
|
|
3
|
+
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -616,7 +616,7 @@ class FieldValidationState {
|
|
|
616
616
|
if (this.shouldSkipValidation()) {
|
|
617
617
|
return [];
|
|
618
618
|
}
|
|
619
|
-
return [...this.node.logicNode.logic.syncErrors.compute(this.node.context), ...this.syncTreeErrors(), ...normalizeErrors(this.node.submitState.
|
|
619
|
+
return [...this.node.logicNode.logic.syncErrors.compute(this.node.context), ...this.syncTreeErrors(), ...normalizeErrors(this.node.submitState.submissionErrors())];
|
|
620
620
|
}, ...(ngDevMode ? [{
|
|
621
621
|
debugName: "syncErrors"
|
|
622
622
|
}] : []));
|
|
@@ -789,7 +789,7 @@ class FieldMetadataState {
|
|
|
789
789
|
if (this.has(key)) {
|
|
790
790
|
if (!this.metadata.has(key)) {
|
|
791
791
|
if (key.create) {
|
|
792
|
-
throw
|
|
792
|
+
throw new _RuntimeError(1912, ngDevMode && 'Managed metadata cannot be created lazily');
|
|
793
793
|
}
|
|
794
794
|
const logic = this.node.logicNode.logic.getMetadata(key);
|
|
795
795
|
this.metadata.set(key, computed(() => logic.compute(this.node.context)));
|
|
@@ -1138,12 +1138,12 @@ class FieldSubmitState {
|
|
|
1138
1138
|
selfSubmitting = signal(false, ...(ngDevMode ? [{
|
|
1139
1139
|
debugName: "selfSubmitting"
|
|
1140
1140
|
}] : []));
|
|
1141
|
-
|
|
1141
|
+
submissionErrors;
|
|
1142
1142
|
constructor(node) {
|
|
1143
1143
|
this.node = node;
|
|
1144
|
-
this.
|
|
1144
|
+
this.submissionErrors = linkedSignal({
|
|
1145
1145
|
...(ngDevMode ? {
|
|
1146
|
-
debugName: "
|
|
1146
|
+
debugName: "submissionErrors"
|
|
1147
1147
|
} : {}),
|
|
1148
1148
|
source: this.node.structure.value,
|
|
1149
1149
|
computation: () => []
|
|
@@ -1236,8 +1236,8 @@ class FieldNode {
|
|
|
1236
1236
|
get readonly() {
|
|
1237
1237
|
return this.nodeState.readonly;
|
|
1238
1238
|
}
|
|
1239
|
-
get
|
|
1240
|
-
return this.nodeState.
|
|
1239
|
+
get formFieldBindings() {
|
|
1240
|
+
return this.nodeState.formFieldBindings;
|
|
1241
1241
|
}
|
|
1242
1242
|
get submitting() {
|
|
1243
1243
|
return this.submitState.submitting;
|
|
@@ -1368,8 +1368,8 @@ class FieldNodeState {
|
|
|
1368
1368
|
markAsUntouched() {
|
|
1369
1369
|
this.selfTouched.set(false);
|
|
1370
1370
|
}
|
|
1371
|
-
|
|
1372
|
-
debugName: "
|
|
1371
|
+
formFieldBindings = signal([], ...(ngDevMode ? [{
|
|
1372
|
+
debugName: "formFieldBindings"
|
|
1373
1373
|
}] : []));
|
|
1374
1374
|
constructor(node) {
|
|
1375
1375
|
this.node = node;
|
|
@@ -1540,12 +1540,12 @@ async function submit(form, action) {
|
|
|
1540
1540
|
node.submitState.selfSubmitting.set(true);
|
|
1541
1541
|
try {
|
|
1542
1542
|
const errors = await action(form);
|
|
1543
|
-
errors &&
|
|
1543
|
+
errors && setSubmissionErrors(node, errors);
|
|
1544
1544
|
} finally {
|
|
1545
1545
|
node.submitState.selfSubmitting.set(false);
|
|
1546
1546
|
}
|
|
1547
1547
|
}
|
|
1548
|
-
function
|
|
1548
|
+
function setSubmissionErrors(submittedField, errors) {
|
|
1549
1549
|
if (!isArray(errors)) {
|
|
1550
1550
|
errors = [errors];
|
|
1551
1551
|
}
|
|
@@ -1561,7 +1561,7 @@ function setServerErrors(submittedField, errors) {
|
|
|
1561
1561
|
fieldErrors.push(errorWithField);
|
|
1562
1562
|
}
|
|
1563
1563
|
for (const [field, fieldErrors] of errorsByField) {
|
|
1564
|
-
field.submitState.
|
|
1564
|
+
field.submitState.submissionErrors.set(fieldErrors);
|
|
1565
1565
|
}
|
|
1566
1566
|
}
|
|
1567
1567
|
function schema(fn) {
|
|
@@ -1574,5 +1574,5 @@ function markAllAsTouched(node) {
|
|
|
1574
1574
|
}
|
|
1575
1575
|
}
|
|
1576
1576
|
|
|
1577
|
-
export { BasicFieldAdapter, DEBOUNCER, FieldNode, FieldNodeState, FieldNodeStructure, FieldPathNode, MAX, MAX_LENGTH, MIN, MIN_LENGTH, MetadataKey, MetadataReducer, PATTERN, REQUIRED, addDefaultField, apply, applyEach, applyWhen, applyWhenValue, assertPathIsCurrent, calculateValidationSelfStatus, createManagedMetadataKey, createMetadataKey, form, getInjectorFromOptions,
|
|
1577
|
+
export { BasicFieldAdapter, DEBOUNCER, FieldNode, FieldNodeState, FieldNodeStructure, FieldPathNode, MAX, MAX_LENGTH, MIN, MIN_LENGTH, MetadataKey, MetadataReducer, PATTERN, REQUIRED, addDefaultField, apply, applyEach, applyWhen, applyWhenValue, assertPathIsCurrent, calculateValidationSelfStatus, createManagedMetadataKey, createMetadataKey, form, getInjectorFromOptions, metadata, normalizeFormArgs, schema, submit };
|
|
1578
1578
|
//# sourceMappingURL=_structure-chunk.mjs.map
|