Skip to content

Commit ede57cb

Browse files
committed
build: switch autocomplete demo use MDC
Switches the demo for the autocomplete to use the MDC implementation.
1 parent 3fda4b7 commit ede57cb

File tree

15 files changed

+69
-67
lines changed

15 files changed

+69
-67
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
/src/dev-app/legacy-tooltip/** @crisbeto
199199
/src/dev-app/list/** @andrewseguin @crisbeto @devversion
200200
/src/dev-app/live-announcer/** @jelbourn
201-
/src/dev-app/mdc-autocomplete/** @crisbeto
201+
/src/dev-app/legacy-autocomplete/** @crisbeto
202202
/src/dev-app/mdc-button/** @andrewseguin
203203
/src/dev-app/legacy-button/** @andrewseguin
204204
/src/dev-app/mdc-chips/** @mmalerba

src/components-examples/material/autocomplete/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ ng_test_library(
4646
"//src/cdk/testing/testbed",
4747
"//src/material/autocomplete",
4848
"//src/material/autocomplete/testing",
49+
"@npm//@angular/platform-browser",
4950
"@npm//@angular/platform-browser-dynamic",
5051
],
5152
)

src/components-examples/material/autocomplete/autocomplete-harness/autocomplete-harness-example.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ import {MatAutocompleteHarness} from '@angular/material/autocomplete/testing';
44
import {HarnessLoader} from '@angular/cdk/testing';
55
import {MatAutocompleteModule} from '@angular/material/autocomplete';
66
import {AutocompleteHarnessExample} from './autocomplete-harness-example';
7+
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
78

89
describe('AutocompleteHarnessExample', () => {
910
let fixture: ComponentFixture<AutocompleteHarnessExample>;
1011
let loader: HarnessLoader;
1112

1213
beforeEach(async () => {
1314
await TestBed.configureTestingModule({
14-
imports: [MatAutocompleteModule],
15+
imports: [MatAutocompleteModule, NoopAnimationsModule],
1516
declarations: [AutocompleteHarnessExample],
1617
}).compileComponents();
1718
fixture = TestBed.createComponent(AutocompleteHarnessExample);

src/dev-app/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ ng_module(
4747
"//src/dev-app/input",
4848
"//src/dev-app/input-modality",
4949
"//src/dev-app/layout",
50+
"//src/dev-app/legacy-autocomplete",
5051
"//src/dev-app/legacy-button",
5152
"//src/dev-app/legacy-card",
5253
"//src/dev-app/legacy-checkbox",
@@ -66,7 +67,6 @@ ng_module(
6667
"//src/dev-app/legacy-tooltip",
6768
"//src/dev-app/list",
6869
"//src/dev-app/live-announcer",
69-
"//src/dev-app/mdc-autocomplete",
7070
"//src/dev-app/mdc-chips",
7171
"//src/dev-app/mdc-slide-toggle",
7272
"//src/dev-app/menu",

src/dev-app/autocomplete/BUILD.bazel

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ ng_module(
1010
":autocomplete_demo_scss",
1111
],
1212
deps = [
13-
"//src/material/legacy-autocomplete",
14-
"//src/material/legacy-button",
15-
"//src/material/legacy-card",
16-
"//src/material/legacy-form-field",
17-
"//src/material/legacy-input",
13+
"//src/material/autocomplete",
14+
"//src/material/button",
15+
"//src/material/card",
16+
"//src/material/form-field",
17+
"//src/material/input",
1818
"@npm//@angular/forms",
1919
],
2020
)

src/dev-app/autocomplete/autocomplete-demo.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div>Reactive value: {{ stateCtrl.value | json }}</div>
77
<div>Reactive dirty: {{ stateCtrl.dirty }}</div>
88

9-
<mat-form-field floatLabel="never">
9+
<mat-form-field>
1010
<mat-label>State</mat-label>
1111
<input matInput [matAutocomplete]="reactiveAuto" [formControl]="stateCtrl">
1212
<mat-autocomplete #reactiveAuto="matAutocomplete" [displayWith]="displayFn">

src/dev-app/autocomplete/autocomplete-demo.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
display: flex;
33
flex-flow: row wrap;
44

5-
.mat-card {
5+
.mat-mdc-card {
66
width: 400px;
77
margin: 24px;
8+
padding: 16px;
89
}
910

10-
.mat-form-field {
11+
.mat-mdc-form-field {
1112
margin-top: 16px;
1213
min-width: 200px;
1314
max-width: 100%;

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

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77
*/
88

99
import {Component, ViewChild} from '@angular/core';
10+
import {FormControl, NgModel, FormsModule, ReactiveFormsModule} from '@angular/forms';
1011
import {CommonModule} from '@angular/common';
11-
import {FormControl, FormsModule, NgModel, ReactiveFormsModule} from '@angular/forms';
12-
import {MatLegacyAutocompleteModule} from '@angular/material/legacy-autocomplete';
13-
import {MatLegacyButtonModule} from '@angular/material/legacy-button';
14-
import {MatLegacyCardModule} from '@angular/material/legacy-card';
15-
import {MatLegacyFormFieldModule} from '@angular/material/legacy-form-field';
16-
import {MatLegacyInputModule} from '@angular/material/legacy-input';
12+
import {MatAutocompleteModule} from '@angular/material/autocomplete';
13+
import {MatButtonModule} from '@angular/material/button';
14+
import {MatCardModule} from '@angular/material/card';
15+
import {MatInputModule} from '@angular/material/input';
1716
import {Observable} from 'rxjs';
1817
import {map, startWith} from 'rxjs/operators';
1918

@@ -35,11 +34,10 @@ export interface StateGroup {
3534
imports: [
3635
CommonModule,
3736
FormsModule,
38-
MatLegacyAutocompleteModule,
39-
MatLegacyButtonModule,
40-
MatLegacyCardModule,
41-
MatLegacyFormFieldModule,
42-
MatLegacyInputModule,
37+
MatAutocompleteModule,
38+
MatButtonModule,
39+
MatCardModule,
40+
MatInputModule,
4341
ReactiveFormsModule,
4442
],
4543
})

src/dev-app/dev-app/dev-app-layout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ export class DevAppLayout {
103103
{name: 'Typography', route: '/typography'},
104104
{name: 'Virtual Scrolling', route: '/virtual-scroll'},
105105
{name: 'YouTube Player', route: '/youtube-player'},
106-
{name: 'MDC Autocomplete', route: '/mdc-autocomplete'},
107106
{name: 'MDC Chips', route: '/mdc-chips'},
108107
{name: 'MDC Progress Bar', route: '/mdc-progress-bar'},
109108
{name: 'MDC Slide Toggle', route: '/mdc-slide-toggle'},
110109
{name: 'MDC Slider', route: '/mdc-slider'},
110+
{name: 'Legacy Autocomplete', route: '/legacy-autocomplete'},
111111
{name: 'Legacy Tabs', route: '/legacy-tabs'},
112112
{name: 'Legacy Button', route: '/legacy-button'},
113113
{name: 'Legacy Card', route: '/legacy-card'},
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
load("//tools:defaults.bzl", "ng_module", "sass_binary")
2+
3+
package(default_visibility = ["//visibility:public"])
4+
5+
ng_module(
6+
name = "legacy-autocomplete",
7+
srcs = glob(["**/*.ts"]),
8+
assets = [
9+
"legacy-autocomplete-demo.html",
10+
":legacy_autocomplete_demo_scss",
11+
],
12+
deps = [
13+
"//src/material/legacy-autocomplete",
14+
"//src/material/legacy-button",
15+
"//src/material/legacy-card",
16+
"//src/material/legacy-form-field",
17+
"//src/material/legacy-input",
18+
"@npm//@angular/forms",
19+
],
20+
)
21+
22+
sass_binary(
23+
name = "legacy_autocomplete_demo_scss",
24+
src = "legacy-autocomplete-demo.scss",
25+
)

src/dev-app/mdc-autocomplete/mdc-autocomplete-demo.html renamed to src/dev-app/legacy-autocomplete/legacy-autocomplete-demo.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<div>Reactive value: {{ stateCtrl.value | json }}</div>
77
<div>Reactive dirty: {{ stateCtrl.dirty }}</div>
88

9-
<mat-form-field>
9+
<mat-form-field floatLabel="never">
1010
<mat-label>State</mat-label>
1111
<input matInput [matAutocomplete]="reactiveAuto" [formControl]="stateCtrl">
1212
<mat-autocomplete #reactiveAuto="matAutocomplete" [displayWith]="displayFn">

src/dev-app/mdc-autocomplete/mdc-autocomplete-demo.scss renamed to src/dev-app/legacy-autocomplete/legacy-autocomplete-demo.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
display: flex;
33
flex-flow: row wrap;
44

5-
.mat-mdc-card {
5+
.mat-card {
66
width: 400px;
77
margin: 24px;
8-
padding: 16px;
98
}
109

11-
.mat-mdc-form-field {
10+
.mat-form-field {
1211
margin-top: 16px;
1312
min-width: 200px;
1413
max-width: 100%;

src/dev-app/mdc-autocomplete/mdc-autocomplete-demo.ts renamed to src/dev-app/legacy-autocomplete/legacy-autocomplete-demo.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77
*/
88

99
import {Component, ViewChild} from '@angular/core';
10-
import {FormControl, NgModel, FormsModule, ReactiveFormsModule} from '@angular/forms';
1110
import {CommonModule} from '@angular/common';
12-
import {MatAutocompleteModule} from '@angular/material/autocomplete';
13-
import {MatButtonModule} from '@angular/material/button';
14-
import {MatCardModule} from '@angular/material/card';
15-
import {MatInputModule} from '@angular/material/input';
11+
import {FormControl, FormsModule, NgModel, ReactiveFormsModule} from '@angular/forms';
12+
import {MatLegacyAutocompleteModule} from '@angular/material/legacy-autocomplete';
13+
import {MatLegacyButtonModule} from '@angular/material/legacy-button';
14+
import {MatLegacyCardModule} from '@angular/material/legacy-card';
15+
import {MatLegacyFormFieldModule} from '@angular/material/legacy-form-field';
16+
import {MatLegacyInputModule} from '@angular/material/legacy-input';
1617
import {Observable} from 'rxjs';
1718
import {map, startWith} from 'rxjs/operators';
1819

@@ -27,21 +28,22 @@ export interface StateGroup {
2728
}
2829

2930
@Component({
30-
selector: 'mdc-autocomplete-demo',
31-
templateUrl: 'mdc-autocomplete-demo.html',
32-
styleUrls: ['mdc-autocomplete-demo.css'],
31+
selector: 'legacy-autocomplete-demo',
32+
templateUrl: 'legacy-autocomplete-demo.html',
33+
styleUrls: ['legacy-autocomplete-demo.css'],
3334
standalone: true,
3435
imports: [
3536
CommonModule,
3637
FormsModule,
37-
MatAutocompleteModule,
38-
MatButtonModule,
39-
MatCardModule,
40-
MatInputModule,
38+
MatLegacyAutocompleteModule,
39+
MatLegacyButtonModule,
40+
MatLegacyCardModule,
41+
MatLegacyFormFieldModule,
42+
MatLegacyInputModule,
4143
ReactiveFormsModule,
4244
],
4345
})
44-
export class MdcAutocompleteDemo {
46+
export class LegacyAutocompleteDemo {
4547
stateCtrl = new FormControl({code: 'CA', name: 'California'});
4648
currentState = '';
4749
currentGroupedState = '';

src/dev-app/mdc-autocomplete/BUILD.bazel

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/dev-app/routes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ export const DEV_APP_ROUTES: Routes = [
142142
loadComponent: () => import('./menubar/mat-menubar-demo').then(m => m.MatMenuBarDemo),
143143
},
144144
{
145-
path: 'mdc-autocomplete',
145+
path: 'legacy-autocomplete',
146146
loadComponent: () =>
147-
import('./mdc-autocomplete/mdc-autocomplete-demo').then(m => m.MdcAutocompleteDemo),
147+
import('./legacy-autocomplete/legacy-autocomplete-demo').then(m => m.LegacyAutocompleteDemo),
148148
},
149149
{
150150
path: 'legacy-button',

0 commit comments

Comments
 (0)