@angular/forms 21.0.0-next.7 → 21.0.0-next.8
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 +156 -129
- package/fesm2022/forms.mjs.map +1 -1
- package/fesm2022/signals.mjs +21 -18
- package/fesm2022/signals.mjs.map +1 -1
- package/package.json +4 -4
- package/types/forms.d.ts +29 -2
- package/types/signals.d.ts +36 -36
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.8
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.dev/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -1425,9 +1425,9 @@ function validateHttp(path, opts) {
|
|
|
1425
1425
|
}
|
|
1426
1426
|
|
|
1427
1427
|
/**
|
|
1428
|
-
* Lightweight DI token provided by the {@link
|
|
1428
|
+
* Lightweight DI token provided by the {@link Field} directive.
|
|
1429
1429
|
*/
|
|
1430
|
-
const
|
|
1430
|
+
const FIELD = new InjectionToken(typeof ngDevMode !== undefined && ngDevMode ? 'FIELD' : '');
|
|
1431
1431
|
/**
|
|
1432
1432
|
* Binds a form `FieldTree` to a UI control that edits it. A UI control can be one of several things:
|
|
1433
1433
|
* 1. A native HTML input or textarea
|
|
@@ -1449,31 +1449,34 @@ const CONTROL = new InjectionToken(typeof ngDevMode !== undefined && ngDevMode ?
|
|
|
1449
1449
|
* @category control
|
|
1450
1450
|
* @experimental 21.0.0
|
|
1451
1451
|
*/
|
|
1452
|
-
class
|
|
1452
|
+
class Field {
|
|
1453
1453
|
injector = inject(Injector);
|
|
1454
|
-
field = input.required(...(ngDevMode ? [{ debugName: "field"
|
|
1454
|
+
field = input.required(...(ngDevMode ? [{ debugName: "field" }] : []));
|
|
1455
1455
|
state = computed(() => this.field()(), ...(ngDevMode ? [{ debugName: "state" }] : []));
|
|
1456
1456
|
[_CONTROL] = undefined;
|
|
1457
1457
|
// TODO: https://github.com/orgs/angular/projects/60/views/1?pane=issue&itemId=131861631
|
|
1458
1458
|
register() {
|
|
1459
1459
|
// Register this control on the field it is currently bound to. We do this at the end of
|
|
1460
1460
|
// initialization so that it only runs if we are actually syncing with this control
|
|
1461
|
-
// (as opposed to just passing the field through to its `
|
|
1461
|
+
// (as opposed to just passing the field through to its `field` input).
|
|
1462
1462
|
effect((onCleanup) => {
|
|
1463
1463
|
const fieldNode = this.state();
|
|
1464
|
-
fieldNode.nodeState.
|
|
1464
|
+
fieldNode.nodeState.fieldBindings.update((controls) => [
|
|
1465
|
+
...controls,
|
|
1466
|
+
this,
|
|
1467
|
+
]);
|
|
1465
1468
|
onCleanup(() => {
|
|
1466
|
-
fieldNode.nodeState.
|
|
1469
|
+
fieldNode.nodeState.fieldBindings.update((controls) => controls.filter((c) => c !== this));
|
|
1467
1470
|
});
|
|
1468
1471
|
}, { injector: this.injector });
|
|
1469
1472
|
}
|
|
1470
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.
|
|
1471
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0-next.
|
|
1473
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: Field, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1474
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0-next.8", type: Field, isStandalone: true, selector: "[field]", inputs: { field: { classPropertyName: "field", publicName: "field", isSignal: true, isRequired: true, transformFunction: null } }, providers: [{ provide: FIELD, useExisting: Field }], ngImport: i0 });
|
|
1472
1475
|
}
|
|
1473
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.
|
|
1476
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.0-next.8", ngImport: i0, type: Field, decorators: [{
|
|
1474
1477
|
type: Directive,
|
|
1475
|
-
args: [{ selector: '[
|
|
1476
|
-
}] });
|
|
1478
|
+
args: [{ selector: '[field]', providers: [{ provide: FIELD, useExisting: Field }] }]
|
|
1479
|
+
}], propDecorators: { field: [{ type: i0.Input, args: [{ isSignal: true, alias: "field", required: true }] }] } });
|
|
1477
1480
|
|
|
1478
1481
|
/**
|
|
1479
1482
|
* `FieldContext` implementation, backed by a `FieldNode`.
|
|
@@ -2083,8 +2086,8 @@ class FieldNode {
|
|
|
2083
2086
|
get readonly() {
|
|
2084
2087
|
return this.nodeState.readonly;
|
|
2085
2088
|
}
|
|
2086
|
-
get
|
|
2087
|
-
return this.nodeState.
|
|
2089
|
+
get fieldBindings() {
|
|
2090
|
+
return this.nodeState.fieldBindings;
|
|
2088
2091
|
}
|
|
2089
2092
|
get submitting() {
|
|
2090
2093
|
return this.submitState.submitting;
|
|
@@ -2203,8 +2206,8 @@ class FieldNodeState {
|
|
|
2203
2206
|
markAsUntouched() {
|
|
2204
2207
|
this.selfTouched.set(false);
|
|
2205
2208
|
}
|
|
2206
|
-
/** The
|
|
2207
|
-
|
|
2209
|
+
/** The {@link Field} directives that bind this field to a UI control. */
|
|
2210
|
+
fieldBindings = signal([], ...(ngDevMode ? [{ debugName: "fieldBindings" }] : []));
|
|
2208
2211
|
constructor(node) {
|
|
2209
2212
|
this.node = node;
|
|
2210
2213
|
}
|
|
@@ -3190,5 +3193,5 @@ function standardIssueToFormTreeError(field, issue) {
|
|
|
3190
3193
|
return addDefaultField(standardSchemaError(issue), target);
|
|
3191
3194
|
}
|
|
3192
3195
|
|
|
3193
|
-
export { AggregateProperty,
|
|
3196
|
+
export { AggregateProperty, CustomValidationError, EmailValidationError, FIELD, Field, MAX, MAX_LENGTH, MIN, MIN_LENGTH, MaxLengthValidationError, MaxValidationError, MinLengthValidationError, MinValidationError, NgValidationError, PATTERN, PatternValidationError, Property, REQUIRED, RequiredValidationError, StandardSchemaValidationError, aggregateProperty, andProperty, apply, applyEach, applyWhen, applyWhenValue, createProperty, customError, disabled, email, emailError, form, hidden, listProperty, max, maxError, maxLength, maxLengthError, maxProperty, min, minError, minLength, minLengthError, minProperty, orProperty, pattern, patternError, property, readonly, reducedProperty, required, requiredError, schema, standardSchemaError, submit, validate, validateAsync, validateHttp, validateStandardSchema, validateTree };
|
|
3194
3197
|
//# sourceMappingURL=signals.mjs.map
|