Skip to content

Commit d744446

Browse files
committed
2. Rename TypeScript symbols in src/material/legacy-dialog
Perform the following steps to complete the rename and fix all references: 1. Refactor all public symbols in `src/material/legacy-dialog` that start with `Matdialog` to `MatLegacydialog`. Recommend using Webstorm's refactoring tools for this, since it automatically updates TS references 2. Run `yarn approve-api legacy-dialog; yarn approve-api legacy-dialog/testing` 3. Find any remaining instances of `matdialog` in the public API: `grep -iF matdialog tools/public_api_guard/material/legacy-dialog.md tools/public_api_guard/material/legacy-dialog-testing.md`. All instances should be directive or component selectors (i.e. line should start with `static ɵcmp` or `static ɵdir`). If you missed any symbols, repeat steps 1-3 4. Manually inspect `tools/public_api_guard/material/legacy-dialog.md` and `tools/public_api_guard/material/legacy-dialog-testing.md` for any other symbols that need renaming and rename them (e.g. `CardHarnessFilters` should become `LegacyCardHarnessFilters`). 5. Run `yarn format`
1 parent 479f864 commit d744446

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+445
-401
lines changed

src/components-examples/material/dialog/dialog-animations/dialog-animations-example.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Component} from '@angular/core';
2-
import {MatDialog, MatDialogRef} from '@angular/material/legacy-dialog';
2+
import {MatLegacyDialog, MatLegacyDialogRef} from '@angular/material/legacy-dialog';
33

44
/**
55
* @title Dialog Animations
@@ -10,7 +10,7 @@ import {MatDialog, MatDialogRef} from '@angular/material/legacy-dialog';
1010
templateUrl: 'dialog-animations-example.html',
1111
})
1212
export class DialogAnimationsExample {
13-
constructor(public dialog: MatDialog) {}
13+
constructor(public dialog: MatLegacyDialog) {}
1414

1515
openDialog(enterAnimationDuration: string, exitAnimationDuration: string): void {
1616
this.dialog.open(DialogAnimationsExampleDialog, {
@@ -26,5 +26,5 @@ export class DialogAnimationsExample {
2626
templateUrl: 'dialog-animations-example-dialog.html',
2727
})
2828
export class DialogAnimationsExampleDialog {
29-
constructor(public dialogRef: MatDialogRef<DialogAnimationsExampleDialog>) {}
29+
constructor(public dialogRef: MatLegacyDialogRef<DialogAnimationsExampleDialog>) {}
3030
}

src/components-examples/material/dialog/dialog-content/dialog-content-example.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Component} from '@angular/core';
2-
import {MatDialog} from '@angular/material/legacy-dialog';
2+
import {MatLegacyDialog} from '@angular/material/legacy-dialog';
33

44
/**
55
* @title Dialog with header, scrollable content and actions
@@ -9,7 +9,7 @@ import {MatDialog} from '@angular/material/legacy-dialog';
99
templateUrl: 'dialog-content-example.html',
1010
})
1111
export class DialogContentExample {
12-
constructor(public dialog: MatDialog) {}
12+
constructor(public dialog: MatLegacyDialog) {}
1313

1414
openDialog() {
1515
const dialogRef = this.dialog.open(DialogContentExampleDialog);

src/components-examples/material/dialog/dialog-data/dialog-data-example.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Component, Inject} from '@angular/core';
2-
import {MatDialog, MAT_DIALOG_DATA} from '@angular/material/legacy-dialog';
2+
import {MatLegacyDialog, MAT_LEGACY_DIALOG_DATA} from '@angular/material/legacy-dialog';
33

44
export interface DialogData {
55
animal: 'panda' | 'unicorn' | 'lion';
@@ -13,7 +13,7 @@ export interface DialogData {
1313
templateUrl: 'dialog-data-example.html',
1414
})
1515
export class DialogDataExample {
16-
constructor(public dialog: MatDialog) {}
16+
constructor(public dialog: MatLegacyDialog) {}
1717

1818
openDialog() {
1919
this.dialog.open(DialogDataExampleDialog, {
@@ -29,5 +29,5 @@ export class DialogDataExample {
2929
templateUrl: 'dialog-data-example-dialog.html',
3030
})
3131
export class DialogDataExampleDialog {
32-
constructor(@Inject(MAT_DIALOG_DATA) public data: DialogData) {}
32+
constructor(@Inject(MAT_LEGACY_DIALOG_DATA) public data: DialogData) {}
3333
}

src/components-examples/material/dialog/dialog-elements/dialog-elements-example.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Component} from '@angular/core';
2-
import {MatDialog} from '@angular/material/legacy-dialog';
2+
import {MatLegacyDialog} from '@angular/material/legacy-dialog';
33

44
/**
55
* @title Dialog elements
@@ -9,7 +9,7 @@ import {MatDialog} from '@angular/material/legacy-dialog';
99
templateUrl: 'dialog-elements-example.html',
1010
})
1111
export class DialogElementsExample {
12-
constructor(public dialog: MatDialog) {}
12+
constructor(public dialog: MatLegacyDialog) {}
1313

1414
openDialog() {
1515
this.dialog.open(DialogElementsExampleDialog);

src/components-examples/material/dialog/dialog-from-menu/dialog-from-menu-example.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Component, ViewChild} from '@angular/core';
2-
import {MatDialog} from '@angular/material/legacy-dialog';
2+
import {MatLegacyDialog} from '@angular/material/legacy-dialog';
33
import {MatMenuTrigger} from '@angular/material/menu';
44
/**
55
* @title Dialog launched from a menu
@@ -11,7 +11,7 @@ import {MatMenuTrigger} from '@angular/material/menu';
1111
export class DialogFromMenuExample {
1212
@ViewChild('menuTrigger') menuTrigger: MatMenuTrigger;
1313

14-
constructor(public dialog: MatDialog) {}
14+
constructor(public dialog: MatLegacyDialog) {}
1515

1616
openDialog() {
1717
// #docregion focus-restoration
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
22
import {TestbedHarnessEnvironment} from '@angular/cdk/testing/testbed';
3-
import {MatDialogHarness} from '@angular/material/legacy-dialog/testing';
3+
import {MatLegacyDialogHarness} from '@angular/material/legacy-dialog/testing';
44
import {HarnessLoader} from '@angular/cdk/testing';
5-
import {MatDialogModule} from '@angular/material/legacy-dialog';
5+
import {MatLegacyDialogModule} from '@angular/material/legacy-dialog';
66
import {DialogHarnessExample} from './dialog-harness-example';
77
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
88

@@ -12,7 +12,7 @@ describe('DialogHarnessExample', () => {
1212

1313
beforeEach(waitForAsync(async () => {
1414
await TestBed.configureTestingModule({
15-
imports: [MatDialogModule, NoopAnimationsModule],
15+
imports: [MatLegacyDialogModule, NoopAnimationsModule],
1616
declarations: [DialogHarnessExample],
1717
}).compileComponents();
1818
fixture = TestBed.createComponent(DialogHarnessExample);
@@ -22,42 +22,42 @@ describe('DialogHarnessExample', () => {
2222

2323
it('should load harness for dialog', async () => {
2424
fixture.componentInstance.open();
25-
const dialogs = await loader.getAllHarnesses(MatDialogHarness);
25+
const dialogs = await loader.getAllHarnesses(MatLegacyDialogHarness);
2626
expect(dialogs.length).toBe(1);
2727
});
2828

2929
it('should load harness for dialog with specific id', async () => {
3030
fixture.componentInstance.open({id: 'my-dialog'});
3131
fixture.componentInstance.open({id: 'other'});
32-
let dialogs = await loader.getAllHarnesses(MatDialogHarness);
32+
let dialogs = await loader.getAllHarnesses(MatLegacyDialogHarness);
3333
expect(dialogs.length).toBe(2);
3434

35-
dialogs = await loader.getAllHarnesses(MatDialogHarness.with({selector: '#my-dialog'}));
35+
dialogs = await loader.getAllHarnesses(MatLegacyDialogHarness.with({selector: '#my-dialog'}));
3636
expect(dialogs.length).toBe(1);
3737
});
3838

3939
it('should be able to get role of dialog', async () => {
4040
fixture.componentInstance.open({role: 'alertdialog'});
4141
fixture.componentInstance.open({role: 'dialog'});
42-
const dialogs = await loader.getAllHarnesses(MatDialogHarness);
42+
const dialogs = await loader.getAllHarnesses(MatLegacyDialogHarness);
4343
expect(await dialogs[0].getRole()).toBe('alertdialog');
4444
expect(await dialogs[1].getRole()).toBe('dialog');
4545
});
4646

4747
it('should be able to close dialog', async () => {
4848
fixture.componentInstance.open({disableClose: true});
4949
fixture.componentInstance.open();
50-
let dialogs = await loader.getAllHarnesses(MatDialogHarness);
50+
let dialogs = await loader.getAllHarnesses(MatLegacyDialogHarness);
5151

5252
expect(dialogs.length).toBe(2);
5353
await dialogs[0].close();
5454

55-
dialogs = await loader.getAllHarnesses(MatDialogHarness);
55+
dialogs = await loader.getAllHarnesses(MatLegacyDialogHarness);
5656
expect(dialogs.length).toBe(1);
5757

5858
// should be a noop since "disableClose" is set to "true".
5959
await dialogs[0].close();
60-
dialogs = await loader.getAllHarnesses(MatDialogHarness);
60+
dialogs = await loader.getAllHarnesses(MatLegacyDialogHarness);
6161
expect(dialogs.length).toBe(1);
6262
});
6363
});

src/components-examples/material/dialog/dialog-harness/dialog-harness-example.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {Component, TemplateRef, ViewChild} from '@angular/core';
2-
import {MatDialog, MatDialogConfig} from '@angular/material/legacy-dialog';
2+
import {MatLegacyDialog, MatLegacyDialogConfig} from '@angular/material/legacy-dialog';
33

44
/**
55
* @title Testing with MatDialogHarness
@@ -11,9 +11,9 @@ import {MatDialog, MatDialogConfig} from '@angular/material/legacy-dialog';
1111
export class DialogHarnessExample {
1212
@ViewChild(TemplateRef) dialogTemplate: TemplateRef<any>;
1313

14-
constructor(readonly dialog: MatDialog) {}
14+
constructor(readonly dialog: MatLegacyDialog) {}
1515

16-
open(config?: MatDialogConfig) {
16+
open(config?: MatLegacyDialogConfig) {
1717
return this.dialog.open(this.dialogTemplate, config);
1818
}
1919
}

src/components-examples/material/dialog/dialog-overview/dialog-overview-example.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import {Component, Inject} from '@angular/core';
2-
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/legacy-dialog';
2+
import {
3+
MatLegacyDialog,
4+
MatLegacyDialogRef,
5+
MAT_LEGACY_DIALOG_DATA,
6+
} from '@angular/material/legacy-dialog';
37

48
export interface DialogData {
59
animal: string;
@@ -17,7 +21,7 @@ export class DialogOverviewExample {
1721
animal: string;
1822
name: string;
1923

20-
constructor(public dialog: MatDialog) {}
24+
constructor(public dialog: MatLegacyDialog) {}
2125

2226
openDialog(): void {
2327
const dialogRef = this.dialog.open(DialogOverviewExampleDialog, {
@@ -38,8 +42,8 @@ export class DialogOverviewExample {
3842
})
3943
export class DialogOverviewExampleDialog {
4044
constructor(
41-
public dialogRef: MatDialogRef<DialogOverviewExampleDialog>,
42-
@Inject(MAT_DIALOG_DATA) public data: DialogData,
45+
public dialogRef: MatLegacyDialogRef<DialogOverviewExampleDialog>,
46+
@Inject(MAT_LEGACY_DIALOG_DATA) public data: DialogData,
4347
) {}
4448

4549
onNoClick(): void {

src/components-examples/material/dialog/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {CommonModule} from '@angular/common';
22
import {NgModule} from '@angular/core';
33
import {FormsModule} from '@angular/forms';
44
import {MatButtonModule} from '@angular/material/button';
5-
import {MatDialogModule} from '@angular/material/legacy-dialog';
5+
import {MatLegacyDialogModule} from '@angular/material/legacy-dialog';
66
import {MatLegacyInputModule} from '@angular/material/legacy-input';
77
import {MatMenuModule} from '@angular/material/menu';
88
import {
@@ -64,7 +64,7 @@ const EXAMPLES = [
6464
imports: [
6565
CommonModule,
6666
MatButtonModule,
67-
MatDialogModule,
67+
MatLegacyDialogModule,
6868
MatLegacyInputModule,
6969
MatMenuModule,
7070
FormsModule,

src/dev-app/dialog/dialog-demo.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ import {MatButtonModule} from '@angular/material/button';
1414
import {MatLegacyCardModule} from '@angular/material/legacy-card';
1515
import {MatCheckboxModule} from '@angular/material/checkbox';
1616
import {
17-
MAT_DIALOG_DATA,
18-
MatDialog,
19-
MatDialogConfig,
20-
MatDialogRef,
21-
MatDialogModule,
17+
MAT_LEGACY_DIALOG_DATA,
18+
MatLegacyDialog,
19+
MatLegacyDialogConfig,
20+
MatLegacyDialogRef,
21+
MatLegacyDialogModule,
2222
} from '@angular/material/legacy-dialog';
2323
import {MatLegacyFormFieldModule} from '@angular/material/legacy-form-field';
2424
import {MatLegacyInputModule} from '@angular/material/legacy-input';
2525
import {MatSelectModule} from '@angular/material/select';
2626

27-
const defaultDialogConfig = new MatDialogConfig();
27+
const defaultDialogConfig = new MatLegacyDialogConfig();
2828

2929
@Component({
3030
selector: 'dialog-demo',
@@ -36,14 +36,14 @@ const defaultDialogConfig = new MatDialogConfig();
3636
MatButtonModule,
3737
MatLegacyCardModule,
3838
MatCheckboxModule,
39-
MatDialogModule,
39+
MatLegacyDialogModule,
4040
MatLegacyFormFieldModule,
4141
MatLegacyInputModule,
4242
MatSelectModule,
4343
],
4444
})
4545
export class DialogDemo {
46-
dialogRef: MatDialogRef<JazzDialog> | null;
46+
dialogRef: MatLegacyDialogRef<JazzDialog> | null;
4747
lastAfterClosedResult: string;
4848
lastBeforeCloseResult: string;
4949
actionsAlignment: 'start' | 'center' | 'end';
@@ -74,7 +74,7 @@ export class DialogDemo {
7474

7575
@ViewChild(TemplateRef) template: TemplateRef<any>;
7676

77-
constructor(public dialog: MatDialog, @Inject(DOCUMENT) doc: any) {
77+
constructor(public dialog: MatLegacyDialog, @Inject(DOCUMENT) doc: any) {
7878
// Possible useful example for the open and closeAll events.
7979
// Adding a class to the body if a dialog opens and
8080
// removing it after all open dialogs are closed
@@ -137,8 +137,8 @@ export class JazzDialog {
137137
private _dimensionToggle = false;
138138

139139
constructor(
140-
public dialogRef: MatDialogRef<JazzDialog>,
141-
@Inject(MAT_DIALOG_DATA) public data: any,
140+
public dialogRef: MatLegacyDialogRef<JazzDialog>,
141+
@Inject(MAT_LEGACY_DIALOG_DATA) public data: any,
142142
) {}
143143

144144
togglePosition(): void {
@@ -205,12 +205,12 @@ export class JazzDialog {
205205
</mat-dialog-actions>
206206
`,
207207
standalone: true,
208-
imports: [MatDialogModule, MatButtonModule],
208+
imports: [MatLegacyDialogModule, MatButtonModule],
209209
})
210210
export class ContentElementDialog {
211211
actionsAlignment: 'start' | 'center' | 'end';
212212

213-
constructor(public dialog: MatDialog) {}
213+
constructor(public dialog: MatLegacyDialog) {}
214214

215215
showInStackedDialog() {
216216
this.dialog.open(IFrameDialog);
@@ -227,7 +227,7 @@ export class ContentElementDialog {
227227
`,
228228
],
229229
standalone: true,
230-
imports: [MatDialogModule, MatButtonModule],
230+
imports: [MatLegacyDialogModule, MatButtonModule],
231231
template: `
232232
<h2 mat-dialog-title>Neptune</h2>
233233

src/dev-app/focus-trap/focus-trap-demo.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
QueryList,
1717
} from '@angular/core';
1818
import {A11yModule, CdkTrapFocus} from '@angular/cdk/a11y';
19-
import {MatDialog, MatDialogModule} from '@angular/material/legacy-dialog';
19+
import {MatLegacyDialog, MatLegacyDialogModule} from '@angular/material/legacy-dialog';
2020
import {_supportsShadowDom} from '@angular/cdk/platform';
2121
import {CommonModule} from '@angular/common';
2222
import {MatButtonModule} from '@angular/material/button';
@@ -42,7 +42,7 @@ export class FocusTrapShadowDomDemo {}
4242
CommonModule,
4343
MatButtonModule,
4444
MatLegacyCardModule,
45-
MatDialogModule,
45+
MatLegacyDialogModule,
4646
MatToolbarModule,
4747
FocusTrapShadowDomDemo,
4848
],
@@ -56,7 +56,7 @@ export class FocusTrapDemo implements AfterViewInit {
5656

5757
_supportsShadowDom = _supportsShadowDom();
5858

59-
constructor(public dialog: MatDialog) {}
59+
constructor(public dialog: MatLegacyDialog) {}
6060

6161
ngAfterViewInit() {
6262
// We want all the traps to be disabled by default, but doing so while using the value in
@@ -91,11 +91,11 @@ let dialogCount = 0;
9191
styleUrls: ['focus-trap-dialog-demo.css'],
9292
templateUrl: 'focus-trap-dialog-demo.html',
9393
standalone: true,
94-
imports: [MatDialogModule],
94+
imports: [MatLegacyDialogModule],
9595
})
9696
export class FocusTrapDialogDemo {
9797
id = dialogCount++;
98-
constructor(public dialog: MatDialog) {}
98+
constructor(public dialog: MatLegacyDialog) {}
9999

100100
openAnotherDialog() {
101101
this.dialog.open(FocusTrapDialogDemo);

src/dev-app/mdc-dialog/mdc-dialog-demo.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {Component, Inject, TemplateRef, ViewChild, ViewEncapsulation} from '@ang
1111
import {
1212
MAT_DIALOG_DATA,
1313
MatDialog,
14-
MatDialogConfig,
14+
MatLegacyDialogConfig,
1515
MatDialogRef,
1616
MatDialogModule,
1717
} from '@angular/material-experimental/mdc-dialog';
@@ -24,7 +24,7 @@ import {MatInputModule} from '@angular/material/input';
2424
import {MatSelectModule} from '@angular/material-experimental/mdc-select';
2525
import {DragDropModule} from '@angular/cdk/drag-drop';
2626

27-
const defaultDialogConfig = new MatDialogConfig();
27+
const defaultDialogConfig = new MatLegacyDialogConfig();
2828

2929
@Component({
3030
selector: 'mdc-dialog-demo',
@@ -112,7 +112,7 @@ export class DialogDemo {
112112
this.dialog.open(this.template, this._getDialogConfig());
113113
}
114114

115-
private _getDialogConfig(): MatDialogConfig {
115+
private _getDialogConfig(): MatLegacyDialogConfig {
116116
const config = {...this.config};
117117
if (this.enableLegacyPadding) {
118118
config.panelClass = `demo-dialog-legacy-padding`;

0 commit comments

Comments
 (0)