From d527ddf0e03be5ebaa955dbe91c10b81876fb5ae Mon Sep 17 00:00:00 2001 From: Miles Malerba Date: Tue, 6 Sep 2022 16:47:33 +0000 Subject: [PATCH] fix(material/legacy-form-field): deprecate all ts symbols --- src/material/legacy-form-field/error.ts | 6 ++- .../legacy-form-field/form-field-module.ts | 4 ++ src/material/legacy-form-field/form-field.ts | 22 ++++++++-- src/material/legacy-form-field/hint.ts | 9 +++- src/material/legacy-form-field/label.ts | 6 ++- src/material/legacy-form-field/prefix.ts | 6 ++- src/material/legacy-form-field/public-api.ts | 44 +++++++++++++++++++ src/material/legacy-form-field/suffix.ts | 6 ++- .../testing/form-field-harness.ts | 12 ++++- .../legacy-form-field/testing/public-api.ts | 19 ++++++-- .../material/legacy-form-field-testing.md | 4 +- .../material/legacy-form-field.md | 24 +++++----- 12 files changed, 135 insertions(+), 27 deletions(-) diff --git a/src/material/legacy-form-field/error.ts b/src/material/legacy-form-field/error.ts index dfccaf672dd8..0d87a66e8cfe 100644 --- a/src/material/legacy-form-field/error.ts +++ b/src/material/legacy-form-field/error.ts @@ -11,7 +11,11 @@ import {MAT_ERROR} from '@angular/material/form-field'; let nextUniqueId = 0; -/** Single error message to be shown underneath the form field. */ +/** + * Single error message to be shown underneath the form field. + * @deprecated Use `MatError` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ @Directive({ selector: 'mat-error', host: { diff --git a/src/material/legacy-form-field/form-field-module.ts b/src/material/legacy-form-field/form-field-module.ts index 2d8a8ae1a96f..b682d3661b21 100644 --- a/src/material/legacy-form-field/form-field-module.ts +++ b/src/material/legacy-form-field/form-field-module.ts @@ -18,6 +18,10 @@ import {MatLegacyPlaceholder} from './placeholder'; import {MatLegacyPrefix} from './prefix'; import {MatLegacySuffix} from './suffix'; +/** + * @deprecated Use `MatFormFieldModule` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ @NgModule({ declarations: [ MatLegacyError, diff --git a/src/material/legacy-form-field/form-field.ts b/src/material/legacy-form-field/form-field.ts index 774c867dc378..6e4c2130e457 100644 --- a/src/material/legacy-form-field/form-field.ts +++ b/src/material/legacy-form-field/form-field.ts @@ -67,15 +67,25 @@ const _MatFormFieldBase = mixinColor( 'primary', ); -/** Possible appearance styles for the form field. */ +/** + * Possible appearance styles for the form field. + * @deprecated Use `MatFormFieldAppearance` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ export type MatLegacyFormFieldAppearance = 'legacy' | 'standard' | 'fill' | 'outline'; -/** Possible values for the "floatLabel" form field input. */ +/** + * Possible values for the "floatLabel" form field input. + * @deprecated Use `FloatLabelType` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ export type LegacyFloatLabelType = 'always' | 'never' | 'auto'; /** * Represents the default options for the form field that can be configured * using the `MAT_FORM_FIELD_DEFAULT_OPTIONS` injection token. + * @deprecated Use `MatFormFieldDefaultOptions` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 */ export interface MatLegacyFormFieldDefaultOptions { /** Default form field appearance style. */ @@ -94,11 +104,17 @@ export interface MatLegacyFormFieldDefaultOptions { /** * Injection token that can be used to configure the * default options for all form field within an app. + * @deprecated Use `MAT_FORM_FIELD_DEFAULT_OPTIONS` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 */ export const MAT_LEGACY_FORM_FIELD_DEFAULT_OPTIONS = new InjectionToken('MAT_FORM_FIELD_DEFAULT_OPTIONS'); -/** Container for form controls that applies Material Design styling and behavior. */ +/** + * Container for form controls that applies Material Design styling and behavior. + * @deprecated Use `MatFormField` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ @Component({ selector: 'mat-form-field', exportAs: 'matFormField', diff --git a/src/material/legacy-form-field/hint.ts b/src/material/legacy-form-field/hint.ts index 57bde9ab3bae..4c065a3ea9f3 100644 --- a/src/material/legacy-form-field/hint.ts +++ b/src/material/legacy-form-field/hint.ts @@ -17,10 +17,17 @@ let nextUniqueId = 0; * * *Note*: This is not part of the public API as the MDC-based form-field will not * need a lightweight token for `MatHint` and we want to reduce breaking changes. + * + * @deprecated Use `_MAT_HINT` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 */ export const _MAT_LEGACY_HINT = new InjectionToken('MatHint'); -/** Hint text to be shown underneath the form field control. */ +/** + * Hint text to be shown underneath the form field control. + * @deprecated Use `MatHint` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ @Directive({ selector: 'mat-hint', host: { diff --git a/src/material/legacy-form-field/label.ts b/src/material/legacy-form-field/label.ts index 1b4ebf0b6eb4..bbb6ebc3fcad 100644 --- a/src/material/legacy-form-field/label.ts +++ b/src/material/legacy-form-field/label.ts @@ -8,7 +8,11 @@ import {Directive} from '@angular/core'; -/** The floating label for a `mat-form-field`. */ +/** + * The floating label for a `mat-form-field`. + * @deprecated Use `MatLabel` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ @Directive({ selector: 'mat-label', }) diff --git a/src/material/legacy-form-field/prefix.ts b/src/material/legacy-form-field/prefix.ts index b4c09630dda8..f80e90b1f6e9 100644 --- a/src/material/legacy-form-field/prefix.ts +++ b/src/material/legacy-form-field/prefix.ts @@ -9,7 +9,11 @@ import {Directive} from '@angular/core'; import {MAT_PREFIX} from '@angular/material/form-field'; -/** Prefix to be placed in front of the form field. */ +/** + * Prefix to be placed in front of the form field. + * @deprecated Use `MatPrefix` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ @Directive({ selector: '[matPrefix]', providers: [{provide: MAT_PREFIX, useExisting: MatLegacyPrefix}], diff --git a/src/material/legacy-form-field/public-api.ts b/src/material/legacy-form-field/public-api.ts index dca7c709701f..e6b5b203049a 100644 --- a/src/material/legacy-form-field/public-api.ts +++ b/src/material/legacy-form-field/public-api.ts @@ -22,13 +22,57 @@ export {MatLegacySuffix} from './suffix'; export {MatLegacyLabel} from './label'; export { + /** + * @deprecated Use `MAT_FORM_FIELD` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ MAT_FORM_FIELD as MAT_LEGACY_FORM_FIELD, + + /** + * @deprecated Use `MatFormFieldControl` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ MatFormFieldControl as MatLegacyFormFieldControl, + + /** + * @deprecated Use `getMatFormFieldDuplicatedHintError` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ getMatFormFieldDuplicatedHintError as getMatLegacyFormFieldDuplicatedHintError, + + /** + * @deprecated Use `getMatFormFieldMissingControlError` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ getMatFormFieldMissingControlError as getMatLegacyFormFieldMissingControlError, + + /** + * @deprecated Use `getMatFormFieldPlaceholderConflictError` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ getMatFormFieldPlaceholderConflictError as getMatLegacyFormFieldPlaceholderConflictError, + + /** + * @deprecated Use `matFormFieldAnimations` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ matFormFieldAnimations as matLegacyFormFieldAnimations, + + /** + * @deprecated Use `MAT_SUFFIX` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ MAT_SUFFIX as MAT_LEGACY_SUFFIX, + + /** + * @deprecated Use `MAT_ERROR` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ MAT_ERROR as MAT_LEGACY_ERROR, + + /** + * @deprecated Use `MAT_PREFIX` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ MAT_PREFIX as MAT_LEGACY_PREFIX, } from '@angular/material/form-field'; diff --git a/src/material/legacy-form-field/suffix.ts b/src/material/legacy-form-field/suffix.ts index a45ce3cc2710..b2bbf474d3df 100644 --- a/src/material/legacy-form-field/suffix.ts +++ b/src/material/legacy-form-field/suffix.ts @@ -9,7 +9,11 @@ import {Directive} from '@angular/core'; import {MAT_SUFFIX} from '@angular/material/form-field'; -/** Suffix to be placed at the end of the form field. */ +/** + * Suffix to be placed at the end of the form field. + * @deprecated Use `MatSuffix` from `@angular/material/form-field` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ @Directive({ selector: '[matSuffix]', providers: [{provide: MAT_SUFFIX, useExisting: MatLegacySuffix}], diff --git a/src/material/legacy-form-field/testing/form-field-harness.ts b/src/material/legacy-form-field/testing/form-field-harness.ts index ea005f1b81b2..244ade46a127 100644 --- a/src/material/legacy-form-field/testing/form-field-harness.ts +++ b/src/material/legacy-form-field/testing/form-field-harness.ts @@ -19,14 +19,22 @@ import {MatLegacyInputHarness} from '@angular/material/legacy-input/testing'; import {MatLegacySelectHarness} from '@angular/material/legacy-select/testing'; // TODO(devversion): support support chip list harness -/** Possible harnesses of controls which can be bound to a form-field. */ +/** + * Possible harnesses of controls which can be bound to a form-field. + * @deprecated Use `FormFieldControlHarness` from `@angular/material/form-field/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ export type LegacyFormFieldControlHarness = | MatLegacyInputHarness | MatLegacySelectHarness | MatDatepickerInputHarness | MatDateRangeInputHarness; -/** Harness for interacting with a standard Material form-field's in tests. */ +/** + * Harness for interacting with a standard Material form-field's in tests. + * @deprecated Use `MatFormFieldHarness` from `@angular/material/form-field/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ export class MatLegacyFormFieldHarness extends _MatFormFieldHarnessBase { static hostSelector = '.mat-form-field'; diff --git a/src/material/legacy-form-field/testing/public-api.ts b/src/material/legacy-form-field/testing/public-api.ts index a540d6cfc82b..0ce9ae9a5b3d 100644 --- a/src/material/legacy-form-field/testing/public-api.ts +++ b/src/material/legacy-form-field/testing/public-api.ts @@ -6,10 +6,23 @@ * found in the LICENSE file at https://angular.io/license */ +export {LegacyFormFieldControlHarness, MatLegacyFormFieldHarness} from './form-field-harness'; + // Re-export the base control harness from the "form-field/testing/control" entry-point. To // avoid circular dependencies, harnesses for form-field controls (i.e. input, select) // need to import the base form-field control harness through a separate entry-point. -export {MatFormFieldControlHarness as MatLegacyFormFieldControlHarness} from '@angular/material/form-field/testing/control'; +export { + /** + * @deprecated Use `MatFormFieldControlHarness` from `@angular/material/form-field/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ + MatFormFieldControlHarness as MatLegacyFormFieldControlHarness, +} from '@angular/material/form-field/testing/control'; -export {LegacyFormFieldControlHarness, MatLegacyFormFieldHarness} from './form-field-harness'; -export {FormFieldHarnessFilters as LegacyFormFieldHarnessFilters} from '@angular/material/form-field/testing'; +export { + /** + * @deprecated Use `FormFieldHarnessFilters` from `@angular/material/form-field/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating. + * @breaking-change 17.0.0 + */ + FormFieldHarnessFilters as LegacyFormFieldHarnessFilters, +} from '@angular/material/form-field/testing'; diff --git a/tools/public_api_guard/material/legacy-form-field-testing.md b/tools/public_api_guard/material/legacy-form-field-testing.md index 1f702d467fdb..7d46ae8edfc4 100644 --- a/tools/public_api_guard/material/legacy-form-field-testing.md +++ b/tools/public_api_guard/material/legacy-form-field-testing.md @@ -15,14 +15,14 @@ import { MatLegacyInputHarness } from '@angular/material/legacy-input/testing'; import { MatLegacySelectHarness } from '@angular/material/legacy-select/testing'; import { TestElement } from '@angular/cdk/testing'; -// @public +// @public @deprecated export type LegacyFormFieldControlHarness = MatLegacyInputHarness | MatLegacySelectHarness | MatDatepickerInputHarness | MatDateRangeInputHarness; export { LegacyFormFieldHarnessFilters } export { MatLegacyFormFieldControlHarness } -// @public +// @public @deprecated export class MatLegacyFormFieldHarness extends _MatFormFieldHarnessBase { // (undocumented) protected _datepickerInputControl: AsyncFactoryFn; diff --git a/tools/public_api_guard/material/legacy-form-field.md b/tools/public_api_guard/material/legacy-form-field.md index 069baaf5ed67..440ed22d3e36 100644 --- a/tools/public_api_guard/material/legacy-form-field.md +++ b/tools/public_api_guard/material/legacy-form-field.md @@ -41,24 +41,24 @@ export { getMatLegacyFormFieldMissingControlError } export { getMatLegacyFormFieldPlaceholderConflictError } -// @public +// @public @deprecated export type LegacyFloatLabelType = 'always' | 'never' | 'auto'; export { MAT_LEGACY_ERROR } export { MAT_LEGACY_FORM_FIELD } -// @public +// @public @deprecated export const MAT_LEGACY_FORM_FIELD_DEFAULT_OPTIONS: InjectionToken; -// @public +// @public @deprecated export const _MAT_LEGACY_HINT: InjectionToken; export { MAT_LEGACY_PREFIX } export { MAT_LEGACY_SUFFIX } -// @public +// @public @deprecated export class MatLegacyError { constructor(ariaLive: string, elementRef: ElementRef); // (undocumented) @@ -69,7 +69,7 @@ export class MatLegacyError { static ɵfac: i0.ɵɵFactoryDeclaration; } -// @public +// @public @deprecated export class MatLegacyFormField extends _MatFormFieldBase implements AfterContentInit, AfterContentChecked, AfterViewInit, OnDestroy, CanColor { constructor(elementRef: ElementRef, _changeDetectorRef: ChangeDetectorRef, _dir: Directionality, _defaults: MatLegacyFormFieldDefaultOptions, _platform: Platform, _ngZone: NgZone, _animationMode: string); _animateAndLockLabel(): void; @@ -148,12 +148,12 @@ export class MatLegacyFormField extends _MatFormFieldBase implements AfterConten export { matLegacyFormFieldAnimations } -// @public +// @public @deprecated export type MatLegacyFormFieldAppearance = 'legacy' | 'standard' | 'fill' | 'outline'; export { MatLegacyFormFieldControl } -// @public +// @public @deprecated export interface MatLegacyFormFieldDefaultOptions { appearance?: MatLegacyFormFieldAppearance; color?: ThemePalette; @@ -161,7 +161,7 @@ export interface MatLegacyFormFieldDefaultOptions { hideRequiredMarker?: boolean; } -// @public (undocumented) +// @public @deprecated (undocumented) export class MatLegacyFormFieldModule { // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration; @@ -171,7 +171,7 @@ export class MatLegacyFormFieldModule { static ɵmod: i0.ɵɵNgModuleDeclaration; } -// @public +// @public @deprecated export class MatLegacyHint { align: 'start' | 'end'; id: string; @@ -181,7 +181,7 @@ export class MatLegacyHint { static ɵfac: i0.ɵɵFactoryDeclaration; } -// @public +// @public @deprecated export class MatLegacyLabel { // (undocumented) static ɵdir: i0.ɵɵDirectiveDeclaration; @@ -197,7 +197,7 @@ export class MatLegacyPlaceholder { static ɵfac: i0.ɵɵFactoryDeclaration; } -// @public +// @public @deprecated export class MatLegacyPrefix { // (undocumented) static ɵdir: i0.ɵɵDirectiveDeclaration; @@ -205,7 +205,7 @@ export class MatLegacyPrefix { static ɵfac: i0.ɵɵFactoryDeclaration; } -// @public +// @public @deprecated export class MatLegacySuffix { // (undocumented) static ɵdir: i0.ɵɵDirectiveDeclaration;