Skip to content

Commit

Permalink
fix(material/legacy-form-field): deprecate all ts symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalerba committed Sep 7, 2022
1 parent 5afe24d commit d527ddf
Show file tree
Hide file tree
Showing 12 changed files with 135 additions and 27 deletions.
6 changes: 5 additions & 1 deletion src/material/legacy-form-field/error.ts
Expand Up @@ -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: {
Expand Down
4 changes: 4 additions & 0 deletions src/material/legacy-form-field/form-field-module.ts
Expand Up @@ -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,
Expand Down
22 changes: 19 additions & 3 deletions src/material/legacy-form-field/form-field.ts
Expand Up @@ -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. */
Expand All @@ -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<MatLegacyFormFieldDefaultOptions>('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',
Expand Down
9 changes: 8 additions & 1 deletion src/material/legacy-form-field/hint.ts
Expand Up @@ -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<MatLegacyHint>('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: {
Expand Down
6 changes: 5 additions & 1 deletion src/material/legacy-form-field/label.ts
Expand Up @@ -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',
})
Expand Down
6 changes: 5 additions & 1 deletion src/material/legacy-form-field/prefix.ts
Expand Up @@ -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}],
Expand Down
44 changes: 44 additions & 0 deletions src/material/legacy-form-field/public-api.ts
Expand Up @@ -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';
6 changes: 5 additions & 1 deletion src/material/legacy-form-field/suffix.ts
Expand Up @@ -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}],
Expand Down
12 changes: 10 additions & 2 deletions src/material/legacy-form-field/testing/form-field-harness.ts
Expand Up @@ -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<LegacyFormFieldControlHarness> {
static hostSelector = '.mat-form-field';

Expand Down
19 changes: 16 additions & 3 deletions src/material/legacy-form-field/testing/public-api.ts
Expand Up @@ -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';
4 changes: 2 additions & 2 deletions tools/public_api_guard/material/legacy-form-field-testing.md
Expand Up @@ -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<LegacyFormFieldControlHarness> {
// (undocumented)
protected _datepickerInputControl: AsyncFactoryFn<MatDatepickerInputHarness | null>;
Expand Down
24 changes: 12 additions & 12 deletions tools/public_api_guard/material/legacy-form-field.md
Expand Up @@ -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<MatLegacyFormFieldDefaultOptions>;

// @public
// @public @deprecated
export const _MAT_LEGACY_HINT: InjectionToken<MatLegacyHint>;

export { MAT_LEGACY_PREFIX }

export { MAT_LEGACY_SUFFIX }

// @public
// @public @deprecated
export class MatLegacyError {
constructor(ariaLive: string, elementRef: ElementRef);
// (undocumented)
Expand All @@ -69,7 +69,7 @@ export class MatLegacyError {
static ɵfac: i0.ɵɵFactoryDeclaration<MatLegacyError, [{ attribute: "aria-live"; }, null]>;
}

// @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;
Expand Down Expand Up @@ -148,20 +148,20 @@ 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;
floatLabel?: LegacyFloatLabelType;
hideRequiredMarker?: boolean;
}

// @public (undocumented)
// @public @deprecated (undocumented)
export class MatLegacyFormFieldModule {
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<MatLegacyFormFieldModule, never>;
Expand All @@ -171,7 +171,7 @@ export class MatLegacyFormFieldModule {
static ɵmod: i0.ɵɵNgModuleDeclaration<MatLegacyFormFieldModule, [typeof i1.MatLegacyError, typeof i2.MatLegacyFormField, typeof i3.MatLegacyHint, typeof i4.MatLegacyLabel, typeof i5.MatLegacyPlaceholder, typeof i6.MatLegacyPrefix, typeof i7.MatLegacySuffix], [typeof i8.CommonModule, typeof i9.MatCommonModule, typeof i10.ObserversModule], [typeof i9.MatCommonModule, typeof i1.MatLegacyError, typeof i2.MatLegacyFormField, typeof i3.MatLegacyHint, typeof i4.MatLegacyLabel, typeof i5.MatLegacyPlaceholder, typeof i6.MatLegacyPrefix, typeof i7.MatLegacySuffix]>;
}

// @public
// @public @deprecated
export class MatLegacyHint {
align: 'start' | 'end';
id: string;
Expand All @@ -181,7 +181,7 @@ export class MatLegacyHint {
static ɵfac: i0.ɵɵFactoryDeclaration<MatLegacyHint, never>;
}

// @public
// @public @deprecated
export class MatLegacyLabel {
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<MatLegacyLabel, "mat-label", never, {}, {}, never, never, false>;
Expand All @@ -197,15 +197,15 @@ export class MatLegacyPlaceholder {
static ɵfac: i0.ɵɵFactoryDeclaration<MatLegacyPlaceholder, never>;
}

// @public
// @public @deprecated
export class MatLegacyPrefix {
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<MatLegacyPrefix, "[matPrefix]", never, {}, {}, never, never, false>;
// (undocumented)
static ɵfac: i0.ɵɵFactoryDeclaration<MatLegacyPrefix, never>;
}

// @public
// @public @deprecated
export class MatLegacySuffix {
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<MatLegacySuffix, "[matSuffix]", never, {}, {}, never, never, false>;
Expand Down

0 comments on commit d527ddf

Please sign in to comment.