Skip to content

Commit

Permalink
fix(material/legacy-dialog): 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 ecdabb8 commit 5afe24d
Show file tree
Hide file tree
Showing 13 changed files with 137 additions and 27 deletions.
2 changes: 2 additions & 0 deletions src/material/legacy-dialog/dialog-animations.ts
Expand Up @@ -9,6 +9,8 @@
/**
* Default parameters for the animation for backwards compatibility.
* @docs-private
* @deprecated Use `defaultParams` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export const defaultParams = {
params: {enterAnimationDuration: '150ms', exitAnimationDuration: '75ms'},
Expand Down
4 changes: 4 additions & 0 deletions src/material/legacy-dialog/dialog-config.ts
Expand Up @@ -8,6 +8,10 @@

import {MatDialogConfig as DialogConfigBase, _defaultParams} from '@angular/material/dialog';

/**
* @deprecated Use `MatDialogConfig` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyDialogConfig<D = any> extends DialogConfigBase<D> {
/** Duration of the enter animation. Has to be a valid CSS value (e.g. 100ms). */
override enterAnimationDuration?: string = _defaultParams.params.enterAnimationDuration;
Expand Down
2 changes: 2 additions & 0 deletions src/material/legacy-dialog/dialog-container.ts
Expand Up @@ -28,6 +28,8 @@ import {_MatDialogContainerBase, matDialogAnimations} from '@angular/material/di
* Internal component that wraps user-provided dialog content.
* Animation is based on https://material.io/guidelines/motion/choreography.html.
* @docs-private
* @deprecated Use `MatDialogContainer` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Component({
selector: 'mat-dialog-container',
Expand Down
8 changes: 8 additions & 0 deletions src/material/legacy-dialog/dialog-content-directives.ts
Expand Up @@ -24,6 +24,8 @@ let dialogElementUid = 0;

/**
* Button that will close the current dialog.
* @deprecated Use `MatDialogClose` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Directive({
selector: '[mat-dialog-close], [matDialogClose]',
Expand Down Expand Up @@ -93,6 +95,8 @@ export class MatLegacyDialogClose implements OnInit, OnChanges {

/**
* Title of a dialog element. Stays fixed to the top of the dialog when scrolling.
* @deprecated Use `MatDialogTitle` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Directive({
selector: '[mat-dialog-title], [matDialogTitle]',
Expand Down Expand Up @@ -133,6 +137,8 @@ export class MatLegacyDialogTitle implements OnInit {

/**
* Scrollable content container of a dialog.
* @deprecated Use `MatDialogContent` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Directive({
selector: `[mat-dialog-content], mat-dialog-content, [matDialogContent]`,
Expand All @@ -143,6 +149,8 @@ export class MatLegacyDialogContent {}
/**
* Container for the bottom action buttons in a dialog.
* Stays fixed to the bottom when scrolling.
* @deprecated Use `MatDialogActions` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Directive({
selector: `[mat-dialog-actions], mat-dialog-actions, [matDialogActions]`,
Expand Down
4 changes: 4 additions & 0 deletions src/material/legacy-dialog/dialog-module.ts
Expand Up @@ -20,6 +20,10 @@ import {
MatLegacyDialogTitle,
} from './dialog-content-directives';

/**
* @deprecated Use `MatDialogModule` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@NgModule({
imports: [DialogModule, OverlayModule, PortalModule, MatCommonModule],
exports: [
Expand Down
2 changes: 2 additions & 0 deletions src/material/legacy-dialog/dialog-ref.ts
Expand Up @@ -10,5 +10,7 @@ import {MatDialogRef as NewDialogRef} from '@angular/material/dialog';

/**
* Reference to a dialog opened via the MatDialog service.
* @deprecated Use `MatDialogRef` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyDialogRef<T, R = any> extends NewDialogRef<T, R> {}
32 changes: 27 additions & 5 deletions src/material/legacy-dialog/dialog.ts
Expand Up @@ -15,27 +15,47 @@ import {_MatDialogBase} from '@angular/material/dialog';
import {MatLegacyDialogRef} from './dialog-ref';
import {MatLegacyDialogConfig} from './dialog-config';

/** Injection token that can be used to access the data that was passed in to a dialog. */
/**
* Injection token that can be used to access the data that was passed in to a dialog.
* @deprecated Use `MAT_DIALOG_DATA` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export const MAT_LEGACY_DIALOG_DATA = new InjectionToken<any>('MatDialogData');

/** Injection token that can be used to specify default dialog options. */
/**
* Injection token that can be used to specify default dialog options.
* @deprecated Use `MAT_DIALOG_DEFAULT_OPTIONS` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export const MAT_LEGACY_DIALOG_DEFAULT_OPTIONS = new InjectionToken<MatLegacyDialogConfig>(
'mat-dialog-default-options',
);

/** Injection token that determines the scroll handling while the dialog is open. */
/**
* Injection token that determines the scroll handling while the dialog is open.
* @deprecated Use `MAT_DIALOG_SCROLL_STRATEGY` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export const MAT_LEGACY_DIALOG_SCROLL_STRATEGY = new InjectionToken<() => ScrollStrategy>(
'mat-dialog-scroll-strategy',
);

/** @docs-private */
/**
* @docs-private
* @deprecated Use `MAT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export function MAT_LEGACY_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY(
overlay: Overlay,
): () => ScrollStrategy {
return () => overlay.scrollStrategies.block();
}

/** @docs-private */
/**
* @docs-private
* @deprecated Use `MAT_DIALOG_SCROLL_STRATEGY_PROVIDER` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export const MAT_LEGACY_DIALOG_SCROLL_STRATEGY_PROVIDER = {
provide: MAT_LEGACY_DIALOG_SCROLL_STRATEGY,
deps: [Overlay],
Expand All @@ -44,6 +64,8 @@ export const MAT_LEGACY_DIALOG_SCROLL_STRATEGY_PROVIDER = {

/**
* Service to open Material Design modal dialogs.
* @deprecated Use `MatDialog` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Injectable()
export class MatLegacyDialog extends _MatDialogBase<MatLegacyDialogContainer> {
Expand Down
44 changes: 44 additions & 0 deletions src/material/legacy-dialog/public-api.ts
Expand Up @@ -25,13 +25,57 @@ export {
export {MatLegacyDialogRef} from './dialog-ref';
export {MatLegacyDialogConfig} from './dialog-config';
export {
/**
* @deprecated Use `_MatDialogBase` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
_MatDialogBase as _MatLegacyDialogBase,

/**
* @deprecated Use `_MatDialogContainerBase` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
_MatDialogContainerBase as _MatLegacyDialogContainerBase,

/**
* @deprecated Use `AutoFocusTarget` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
AutoFocusTarget as LegacyAutoFocusTarget,

/**
* @deprecated Use `DialogRole` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
DialogRole as LegacyDialogRole,

/**
* @deprecated Use `DialogPosition` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
DialogPosition as LegacyDialogPosition,

/**
* @deprecated Use `_closeDialogVia` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
_closeDialogVia as _closeLegacyDialogVia,

/**
* @deprecated Use `MatDialogState` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
MatDialogState as MatLegacyDialogState,

/**
* @deprecated Use `matDialogAnimations` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
matDialogAnimations as matLegacyDialogAnimations,

/**
* @deprecated Use `MAT_DIALOG_SCROLL_STRATEGY_FACTORY` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
MAT_DIALOG_SCROLL_STRATEGY_FACTORY as MAT_LEGACY_DIALOG_SCROLL_STRATEGY_FACTORY,
} from '@angular/material/dialog';
12 changes: 10 additions & 2 deletions src/material/legacy-dialog/testing/dialog-harness.ts
Expand Up @@ -9,14 +9,22 @@
import {HarnessPredicate} from '@angular/cdk/testing';
import {_MatDialogHarnessBase, DialogHarnessFilters} from '@angular/material/dialog/testing';

/** Selectors for different sections of the mat-dialog that can contain user content. */
/**
* Selectors for different sections of the mat-dialog that can contain user content.
* @deprecated Use `enum` from `@angular/material/dialog/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export const enum MatLegacyDialogSection {
TITLE = '.mat-dialog-title',
CONTENT = '.mat-dialog-content',
ACTIONS = '.mat-dialog-actions',
}

/** Harness for interacting with a standard `MatDialog` in tests. */
/**
* Harness for interacting with a standard `MatDialog` in tests.
* @deprecated Use `MatDialogHarness` from `@angular/material/dialog/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
export class MatLegacyDialogHarness extends _MatDialogHarnessBase {
// Developers can provide a custom component or template for the
// dialog. The canonical dialog parent is the "MatDialogContainer".
Expand Down
10 changes: 9 additions & 1 deletion src/material/legacy-dialog/testing/dialog-opener.ts
Expand Up @@ -17,7 +17,11 @@ import {
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
import {_MatTestDialogOpenerBase} from '@angular/material/dialog/testing';

/** Test component that immediately opens a dialog when created. */
/**
* Test component that immediately opens a dialog when created.
* @deprecated Use `MatTestDialogOpener` from `@angular/material/dialog/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@Component({
selector: 'mat-test-dialog-opener',
template: '',
Expand All @@ -44,6 +48,10 @@ export class MatTestLegacyDialogOpener<T = unknown, R = unknown> extends _MatTes
}
}

/**
* @deprecated Use `MatTestDialogOpenerModule` from `@angular/material/dialog/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
@NgModule({
declarations: [MatTestLegacyDialogOpener],
imports: [MatLegacyDialogModule, NoopAnimationsModule],
Expand Down
8 changes: 7 additions & 1 deletion src/material/legacy-dialog/testing/public-api.ts
Expand Up @@ -8,4 +8,10 @@

export {MatLegacyDialogSection, MatLegacyDialogHarness} from './dialog-harness';
export {MatTestLegacyDialogOpener, MatTestLegacyDialogOpenerModule} from './dialog-opener';
export {DialogHarnessFilters as LegacyDialogHarnessFilters} from '@angular/material/dialog/testing';
export {
/**
* @deprecated Use `DialogHarnessFilters` from `@angular/material/dialog/testing` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
* @breaking-change 17.0.0
*/
DialogHarnessFilters as LegacyDialogHarnessFilters,
} from '@angular/material/dialog/testing';
8 changes: 4 additions & 4 deletions tools/public_api_guard/material/legacy-dialog-testing.md
Expand Up @@ -17,7 +17,7 @@ import { TestElement } from '@angular/cdk/testing';

export { LegacyDialogHarnessFilters }

// @public
// @public @deprecated
export class MatLegacyDialogHarness extends _MatDialogHarnessBase {
// (undocumented)
protected _actions: AsyncFactoryFn<TestElement | null>;
Expand All @@ -29,7 +29,7 @@ export class MatLegacyDialogHarness extends _MatDialogHarnessBase {
static with(options?: LegacyDialogHarnessFilters): HarnessPredicate<MatLegacyDialogHarness>;
}

// @public
// @public @deprecated
export const enum MatLegacyDialogSection {
// (undocumented)
ACTIONS = ".mat-dialog-actions",
Expand All @@ -39,13 +39,13 @@ export const enum MatLegacyDialogSection {
TITLE = ".mat-dialog-title"
}

// @public
// @public @deprecated
export class MatTestLegacyDialogOpener<T = unknown, R = unknown> extends _MatTestDialogOpenerBase<MatLegacyDialogContainer, T, R> {
constructor(dialog: MatLegacyDialog);
static withComponent<T = unknown, R = unknown>(component: ComponentType<T>, config?: MatLegacyDialogConfig): ComponentType<MatTestLegacyDialogOpener<T, R>>;
}

// @public (undocumented)
// @public @deprecated (undocumented)
export class MatTestLegacyDialogOpenerModule {
}

Expand Down

0 comments on commit 5afe24d

Please sign in to comment.