Skip to content

Commit 4c49f5f

Browse files
karammalerba
authored andcommitted
chore(autocomplete): add autocomplete scaffold (#2092)
1 parent 62cc830 commit 4c49f5f

17 files changed

+94
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="demo-autocomplete">
2+
<md-autocomplete></md-autocomplete>
3+
</div>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.demo-autocomplete {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import {Component} from '@angular/core';
2+
3+
@Component({
4+
moduleId: module.id,
5+
selector: 'autocomplete-demo',
6+
templateUrl: 'autocomplete-demo.html',
7+
styleUrls: ['autocomplete-demo.css'],
8+
})
9+
export class AutocompleteDemo {}

src/demo-app/demo-app-module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import {MenuDemo} from './menu/menu-demo';
3636
import {TabsDemo, SunnyTabContent, RainyTabContent, FoggyTabContent} from './tabs/tabs-demo';
3737
import {ProjectionDemo, ProjectionTestComponent} from './projection/projection-demo';
3838
import {PlatformDemo} from './platform/platform-demo';
39+
import {AutocompleteDemo} from './autocomplete/autocomplete-demo';
3940

4041
@NgModule({
4142
imports: [
@@ -47,6 +48,7 @@ import {PlatformDemo} from './platform/platform-demo';
4748
MaterialModule.forRoot(),
4849
],
4950
declarations: [
51+
AutocompleteDemo,
5052
BaselineDemo,
5153
ButtonDemo,
5254
ButtonToggleDemo,

src/demo-app/demo-app/demo-app.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export class Home {}
2020
})
2121
export class DemoApp {
2222
navItems = [
23+
{name: 'Autocomplete', route: 'autocomplete'},
2324
{name: 'Button', route: 'button'},
2425
{name: 'Button Toggle', route: 'button-toggle'},
2526
{name: 'Card', route: 'card'},

src/demo-app/demo-app/routes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ import {SnackBarDemo} from '../snack-bar/snack-bar-demo';
3131
import {ProjectionDemo} from '../projection/projection-demo';
3232
import {TABS_DEMO_ROUTES} from '../tabs/routes';
3333
import {PlatformDemo} from '../platform/platform-demo';
34+
import {AutocompleteDemo} from '../autocomplete/autocomplete-demo';
3435

3536
export const DEMO_APP_ROUTES: Routes = [
3637
{path: '', component: Home},
38+
{path: 'autocomplete', component: AutocompleteDemo},
3739
{path: 'button', component: ButtonDemo},
3840
{path: 'card', component: CardDemo},
3941
{path: 'chips', component: ChipsDemo},

src/lib/autocomplete/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
## Not yet implemented!
3+
4+
The autocomplete is not yet implemented. This is only a scaffold to make
5+
subsequent PRs easier to read. Please do not try to use yet :)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@import '../core/theming/theming';
2+
3+
@mixin md-autocomplete-theme($theme) {
4+
5+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
I'm an autocomplete!

src/lib/autocomplete/autocomplete.scss

Whitespace-only changes.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import {TestBed, async} from '@angular/core/testing';
2+
import {Component} from '@angular/core';
3+
import {MdAutocompleteModule} from './index';
4+
5+
describe('MdAutocomplete', () => {
6+
7+
beforeEach(async(() => {
8+
TestBed.configureTestingModule({
9+
imports: [MdAutocompleteModule.forRoot()],
10+
declarations: [SimpleAutocomplete],
11+
providers: []
12+
});
13+
14+
TestBed.compileComponents();
15+
}));
16+
17+
it('should have a test', () => {
18+
expect(true).toBe(true);
19+
});
20+
21+
});
22+
23+
@Component({
24+
template: `
25+
<md-autocomplete></md-autocomplete>
26+
`
27+
})
28+
class SimpleAutocomplete {}
29+

src/lib/autocomplete/autocomplete.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {Component, ViewEncapsulation} from '@angular/core';
2+
3+
@Component({
4+
moduleId: module.id,
5+
selector: 'md-autocomplete, mat-autocomplete',
6+
templateUrl: 'autocomplete.html',
7+
styleUrls: ['autocomplete.css'],
8+
encapsulation: ViewEncapsulation.None,
9+
})
10+
export class MdAutocomplete {}
11+

src/lib/autocomplete/index.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import {ModuleWithProviders, NgModule} from '@angular/core';
2+
import {DefaultStyleCompatibilityModeModule} from '../core';
3+
import {MdAutocomplete} from './autocomplete';
4+
export * from './autocomplete';
5+
6+
@NgModule({
7+
imports: [DefaultStyleCompatibilityModeModule],
8+
exports: [MdAutocomplete, DefaultStyleCompatibilityModeModule],
9+
declarations: [MdAutocomplete],
10+
})
11+
export class MdAutocompleteModule {
12+
static forRoot(): ModuleWithProviders {
13+
return {
14+
ngModule: MdAutocompleteModule,
15+
providers: []
16+
};
17+
}
18+
}

src/lib/core/compatibility/default-mode.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const MATERIAL_COMPATIBILITY_MODE = new OpaqueToken('md-compatibiility-mo
55

66
/** Selector that matches all elements that may have style collisions with material1. */
77
export const MAT_ELEMENTS_SELECTOR = `
8+
mat-autocomplete,
89
mat-card,
910
mat-card-actions,
1011
mat-card-content,

src/lib/core/compatibility/no-conflict-mode.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {MATERIAL_COMPATIBILITY_MODE} from './default-mode';
44

55
/** Selector that matches all elements that may have style collisions with material1. */
66
export const MD_ELEMENTS_SELECTOR = `
7+
md-autocomplete,
78
md-card,
89
md-card-actions,
910
md-card-content,

src/lib/core/theming/_all-theme.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Import all the theming functionality.
22
@import '../core';
3+
@import '../../autocomplete/autocomplete-theme';
34
@import '../../button/button-theme';
45
@import '../../button-toggle/button-toggle-theme';
56
@import '../../card/card-theme';
@@ -26,6 +27,7 @@
2627
// Create a theme.
2728
@mixin angular-material-theme($theme) {
2829
@include md-core-theme($theme);
30+
@include md-autocomplete-theme($theme);
2931
@include md-button-theme($theme);
3032
@include md-button-toggle-theme($theme);
3133
@include md-card-theme($theme);

src/lib/module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ import {MdTooltipModule} from './tooltip/index';
3333
import {MdMenuModule} from './menu/index';
3434
import {MdDialogModule} from './dialog/index';
3535
import {PlatformModule} from './core/platform/platform';
36-
36+
import {MdAutocompleteModule} from './autocomplete/index';
3737

3838
const MATERIAL_MODULES = [
39+
MdAutocompleteModule,
3940
MdButtonModule,
4041
MdButtonToggleModule,
4142
MdCardModule,
@@ -70,6 +71,7 @@ const MATERIAL_MODULES = [
7071

7172
@NgModule({
7273
imports: [
74+
MdAutocompleteModule.forRoot(),
7375
MdButtonModule.forRoot(),
7476
MdCardModule.forRoot(),
7577
MdChipsModule.forRoot(),

0 commit comments

Comments
 (0)