@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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v21.0.0-next.7
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 Control} directive.
1428
+ * Lightweight DI token provided by the {@link Field} directive.
1429
1429
  */
1430
- const CONTROL = new InjectionToken(typeof ngDevMode !== undefined && ngDevMode ? 'CONTROL' : '');
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 Control {
1452
+ class Field {
1453
1453
  injector = inject(Injector);
1454
- field = input.required(...(ngDevMode ? [{ debugName: "field", alias: 'control' }] : [{ alias: 'control' }]));
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 `control` input).
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.controls.update((controls) => [...controls, this]);
1464
+ fieldNode.nodeState.fieldBindings.update((controls) => [
1465
+ ...controls,
1466
+ this,
1467
+ ]);
1465
1468
  onCleanup(() => {
1466
- fieldNode.nodeState.controls.update((controls) => controls.filter((c) => c !== this));
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.7", ngImport: i0, type: Control, deps: [], target: i0.ɵɵFactoryTarget.Directive });
1471
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.0.0-next.7", type: Control, isStandalone: true, selector: "[control]", inputs: { field: { classPropertyName: "field", publicName: "control", isSignal: true, isRequired: true, transformFunction: null } }, providers: [{ provide: CONTROL, useExisting: Control }], ngImport: i0 });
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.7", ngImport: i0, type: Control, decorators: [{
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: '[control]', providers: [{ provide: CONTROL, useExisting: Control }] }]
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 controls() {
2087
- return this.nodeState.controls;
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 UI controls the field is currently bound to. */
2207
- controls = signal([], ...(ngDevMode ? [{ debugName: "controls" }] : []));
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, CONTROL, Control, CustomValidationError, EmailValidationError, 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 };
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