Skip to content

Commit b5faeec

Browse files
committed
Merge branch 'master' into dialog-animation
# Conflicts: # src/lib/dialog/dialog.ts
2 parents dc9a5f9 + fe113eb commit b5faeec

Some content is hidden

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

47 files changed

+699
-212
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@
3333
/libpeerconnection.log
3434
npm-debug.log
3535
testem.log
36-
/.chrome
36+
/.chrome

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ High level items planned for January 2017:
7575
| dialog | Available | [README][22] | [#114][0114] |
7676
| snackbar / toast | Available | [README][21] | [#115][0115] |
7777
| select | Available | [README][23] | [#118][0118] |
78-
| textarea | Available | - | - |
78+
| textarea | Available | [README][5] | - |
7979
| autocomplete | In-progress | - | [#117][0117] |
8080
| chips | Initial version, features evolving | - | [#120][0120] |
8181
| theming | Available, need guidance overlays | [Guide][20] | - |

e2e/components/dialog/dialog.e2e.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ describe('dialog', () => {
1111
expectToExist('md-dialog-container');
1212
});
1313

14+
it('should open a template dialog', () => {
15+
expectToExist('.my-template-dialog', false);
16+
element(by.id('template')).click();
17+
expectToExist('.my-template-dialog');
18+
});
19+
1420
it('should close by clicking on the backdrop', () => {
1521
element(by.id('default')).click();
1622

guides/theming.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The actual path will depend on your server setup.
4141
You can also concatenate the file with the rest of your application's css.
4242

4343
Finally, if your app's content **is not** placed inside of a `md-sidenav-container` element, you
44-
need to add the `md-app-background` class to your wrapper element (for example the `body`). This
44+
need to add the `mat-app-background` class to your wrapper element (for example the `body`). This
4545
ensures that the proper theme background is applied to your page.
4646

4747
### Defining a custom theme
@@ -55,19 +55,19 @@ the corresponding styles. A typical theme file will look something like this:
5555

5656
// Include the base styles for Angular Material core. We include this here so that you only
5757
// have to load a single css file for Angular Material in your app.
58-
@include md-core();
58+
@include mat-core();
5959

6060
// Define the palettes for your theme using the Material Design palettes available in palette.scss
6161
// (imported above). For each palette, you can optionally specify a default, lighter, and darker
6262
// hue.
63-
$candy-app-primary: md-palette($md-indigo);
64-
$candy-app-accent: md-palette($md-pink, A200, A100, A400);
63+
$candy-app-primary: mat-palette($mat-indigo);
64+
$candy-app-accent: mat-palette($mat-pink, A200, A100, A400);
6565

6666
// The warn palette is optional (defaults to red).
67-
$candy-app-warn: md-palette($md-red);
67+
$candy-app-warn: mat-palette($mat-red);
6868

6969
// Create the theme object (a Sass map containing all of the palettes).
70-
$candy-app-theme: md-light-theme($candy-app-primary, $candy-app-accent, $candy-app-warn);
70+
$candy-app-theme: mat-light-theme($candy-app-primary, $candy-app-accent, $candy-app-warn);
7171

7272
// Include theme styles for core and each component used in your app.
7373
// Alternatively, you can import and @include the theme mixins for each component
@@ -96,11 +96,11 @@ some selector. For example, we could append the following to the example above t
9696
secondary dark theme:
9797
```scss
9898
.unicorn-dark-theme {
99-
$dark-primary: md-palette($md-blue-grey);
100-
$dark-accent: md-palette($md-amber, A200, A100, A400);
101-
$dark-warn: md-palette($md-deep-orange);
99+
$dark-primary: mat-palette($mat-blue-grey);
100+
$dark-accent: mat-palette($mat-amber, A200, A100, A400);
101+
$dark-warn: mat-palette($mat-deep-orange);
102102

103-
$dark-theme: md-dark-theme($dark-primary, $dark-accent, $dark-warn);
103+
$dark-theme: mat-dark-theme($dark-primary, $dark-accent, $dark-warn);
104104

105105
@include angular-material-theme($dark-theme);
106106
}

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,12 @@
6666
"gulp-clean-css": "^2.3.2",
6767
"gulp-cli": "^1.2.2",
6868
"gulp-connect": "^5.0.0",
69+
"gulp-flatten": "^0.3.1",
70+
"gulp-highlight-files": "0.0.4",
6971
"gulp-htmlmin": "^3.0.0",
7072
"gulp-if": "^2.0.2",
7173
"gulp-markdown": "^1.2.0",
74+
"gulp-rename": "^1.2.2",
7275
"gulp-sass": "^3.1.0",
7376
"gulp-sourcemaps": "^2.4.0",
7477
"gulp-transform": "^1.1.0",
@@ -91,10 +94,11 @@
9194
"run-sequence": "^1.2.2",
9295
"sass": "^0.5.0",
9396
"selenium-webdriver": "^3.0.1",
94-
"stylelint": "^7.7.1",
97+
"stylelint": "^7.8.0",
9598
"travis-after-modes": "0.0.7",
9699
"ts-node": "^2.0.0",
97-
"tslint": "^3.13.0",
100+
"tslint": "^4.4.2",
101+
"tslint-no-unused-var": "0.0.6",
98102
"typescript": "~2.0.10",
99103
"uglify-js": "^2.7.5",
100104
"web-animations-js": "^2.2.2"

src/demo-app/dialog/dialog-demo.html

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
<h1>Dialog demo</h1>
22

3-
<button md-raised-button color="primary" (click)="openJazz()" [disabled]="dialogRef">Open dialog</button>
4-
<button md-raised-button color="accent" (click)="openContentElement()">Open dialog with content elements</button>
3+
<button md-raised-button color="primary" (click)="openJazz()" [disabled]="dialogRef">
4+
Open dialog
5+
</button>
6+
<button md-raised-button color="accent" (click)="openContentElement()">
7+
Open dialog with content elements
8+
</button>
9+
<button md-raised-button color="accent" (click)="openTemplate()">
10+
Open dialog with template content
11+
</button>
512

613
<md-card class="demo-dialog-card">
714
<md-card-content>
@@ -59,3 +66,7 @@ <h2>Other options</h2>
5966
</md-card>
6067

6168
<p>Last close result: {{lastCloseResult}}</p>
69+
70+
<template>
71+
I'm a template dialog. I've been opened {{numTemplateOpens}} times!
72+
</template>

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, Inject} from '@angular/core';
1+
import {Component, Inject, ViewChild, TemplateRef} from '@angular/core';
22
import {DOCUMENT} from '@angular/platform-browser';
33
import {MdDialog, MdDialogRef, MdDialogConfig, MD_DIALOG_DATA} from '@angular/material';
44

@@ -27,6 +27,9 @@ export class DialogDemo {
2727
message: 'Jazzy jazz jazz'
2828
}
2929
};
30+
numTemplateOpens = 0;
31+
32+
@ViewChild(TemplateRef) template: TemplateRef<any>;
3033

3134
constructor(public dialog: MdDialog, @Inject(DOCUMENT) doc: any) {
3235
// Possible useful example for the open and closeAll events.
@@ -55,6 +58,11 @@ export class DialogDemo {
5558
let dialogRef = this.dialog.open(ContentElementDialog, this.config);
5659
dialogRef.componentInstance.actionsAlignment = this.actionsAlignment;
5760
}
61+
62+
openTemplate() {
63+
this.numTemplateOpens++;
64+
this.dialog.open(this.template, this.config);
65+
}
5866
}
5967

6068

src/demo-app/select/select-demo.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<p> Touched: {{ drinkControl.touched }} </p>
2828
<p> Dirty: {{ drinkControl.dirty }} </p>
2929
<p> Status: {{ drinkControl.control?.status }} </p>
30-
<button md-button (click)="currentDrink='sprite-1'">SET VALUE</button>
30+
<button md-button (click)="currentDrink='water-2'">SET VALUE</button>
3131
<button md-button (click)="isRequired=!isRequired">TOGGLE REQUIRED</button>
3232
<button md-button (click)="isDisabled=!isDisabled">TOGGLE DISABLED</button>
3333
<button md-button (click)="drinkControl.reset()">RESET</button>

src/demo-app/tooltip/tooltip-demo.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="demo-tooltip">
22
<h1>Tooltip Demo</h1>
33

4-
<p class="centered">
4+
<div class="centered" cdk-scrollable>
55
<button #tooltip="mdTooltip"
66
md-raised-button
77
color="primary"
@@ -11,7 +11,9 @@ <h1>Tooltip Demo</h1>
1111
[mdTooltipHideDelay]="hideDelay">
1212
Mouse over to see the tooltip
1313
</button>
14-
</p>
14+
<div>Scroll down while tooltip is open to see it hide automatically</div>
15+
<div style="height: 400px;"></div>
16+
</div>
1517

1618
<p>
1719
<md-radio-group [(ngModel)]="position">

src/demo-app/tooltip/tooltip-demo.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
.demo-tooltip {
22
.centered {
33
text-align: center;
4+
height: 200px;
5+
overflow: auto;
6+
7+
button {
8+
margin: 16px;
9+
}
410
}
511
.mat-radio-button {
612
display: block;

src/e2e-app/dialog/dialog-e2e.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
<button id="default" (click)="openDefault()">DEFAULT</button>
22
<button id="disabled" (click)="openDisabled()">DISABLED</button>
3+
<button id="template" (click)="openTemplate()">TEMPLATE</button>
4+
5+
<template><div class="my-template-dialog">my template dialog</div></template>

src/e2e-app/dialog/dialog-e2e.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component} from '@angular/core';
1+
import {Component, ViewChild, TemplateRef} from '@angular/core';
22
import {MdDialog, MdDialogRef, MdDialogConfig} from '@angular/material';
33

44
@Component({
@@ -9,6 +9,8 @@ import {MdDialog, MdDialogRef, MdDialogConfig} from '@angular/material';
99
export class DialogE2E {
1010
dialogRef: MdDialogRef<TestDialog>;
1111

12+
@ViewChild(TemplateRef) templateRef: TemplateRef<any>;
13+
1214
constructor (private _dialog: MdDialog) { }
1315

1416
private _openDialog(config?: MdDialogConfig) {
@@ -28,6 +30,10 @@ export class DialogE2E {
2830
disableClose: true
2931
});
3032
}
33+
34+
openTemplate() {
35+
this.dialogRef = this._dialog.open(this.templateRef);
36+
}
3137
}
3238

3339
@Component({

src/lib/autocomplete/autocomplete-trigger.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,24 @@ export class MdAutocompleteTrigger implements AfterContentInit, ControlValueAcce
8484
private _blurStream = new Subject<any>();
8585

8686
/** View -> model callback called when value changes */
87-
_onChange: (value: any) => {};
87+
_onChange = (value: any) => {};
8888

8989
/** View -> model callback called when autocomplete has been touched */
9090
_onTouched = () => {};
9191

9292
/* The autocomplete panel to be attached to this trigger. */
9393
@Input('mdAutocomplete') autocomplete: MdAutocomplete;
9494

95+
/** Property with mat- prefix for no-conflict mode. */
96+
@Input('matAutocomplete')
97+
get _matAutocomplete(): MdAutocomplete {
98+
return this.autocomplete;
99+
}
100+
101+
set _matAutocomplete(autocomplete: MdAutocomplete) {
102+
this.autocomplete = autocomplete;
103+
}
104+
95105
constructor(private _element: ElementRef, private _overlay: Overlay,
96106
private _viewContainerRef: ViewContainerRef,
97107
@Optional() private _dir: Dir, private _zone: NgZone,

src/lib/autocomplete/autocomplete.spec.ts

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('MdAutocomplete', () => {
2424
imports: [
2525
MdAutocompleteModule.forRoot(), MdInputModule.forRoot(), ReactiveFormsModule
2626
],
27-
declarations: [SimpleAutocomplete],
27+
declarations: [SimpleAutocomplete, AutocompleteWithoutForms],
2828
providers: [
2929
{provide: OverlayContainer, useFactory: () => {
3030
overlayContainerElement = document.createElement('div');
@@ -790,6 +790,25 @@ describe('MdAutocomplete', () => {
790790

791791
});
792792

793+
describe('misc', () => {
794+
795+
it('should allow basic use without any forms directives', () => {
796+
expect(() => {
797+
const fixture = TestBed.createComponent(AutocompleteWithoutForms);
798+
fixture.detectChanges();
799+
800+
const input = fixture.debugElement.query(By.css('input')).nativeElement;
801+
input.value = 'd';
802+
dispatchEvent('input', input);
803+
fixture.detectChanges();
804+
805+
const options =
806+
overlayContainerElement.querySelectorAll('md-option') as NodeListOf<HTMLElement>;
807+
expect(options.length).toBe(1);
808+
}).not.toThrowError();
809+
});
810+
811+
});
793812
});
794813

795814
@Component({
@@ -849,6 +868,33 @@ class SimpleAutocomplete implements OnDestroy {
849868
}
850869

851870

871+
@Component({
872+
template: `
873+
<md-input-container>
874+
<input mdInput placeholder="State" [mdAutocomplete]="auto"
875+
(input)="onInput($event.target?.value)">
876+
</md-input-container>
877+
878+
<md-autocomplete #auto="mdAutocomplete">
879+
<md-option *ngFor="let state of filteredStates" [value]="state">
880+
<span> {{ state }} </span>
881+
</md-option>
882+
</md-autocomplete>
883+
`
884+
})
885+
class AutocompleteWithoutForms {
886+
filteredStates: any[];
887+
states = ['Alabama', 'California', 'Florida'];
888+
889+
constructor() {
890+
this.filteredStates = this.states.slice();
891+
}
892+
893+
onInput(value: any) {
894+
this.filteredStates = this.states.filter(s => new RegExp(value, 'gi').test(s));
895+
}
896+
897+
}
852898

853899
/**
854900
* TODO: Move this to core testing utility until Angular has event faking

src/lib/checkbox/checkbox.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[checked]="checked"
88
[disabled]="disabled"
99
[name]="name"
10-
[tabIndex]="tabindex"
10+
[tabIndex]="tabIndex"
1111
[indeterminate]="indeterminate"
1212
[attr.aria-label]="ariaLabel"
1313
[attr.aria-labelledby]="ariaLabelledby"

src/lib/checkbox/checkbox.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ class MultipleCheckboxes { }
727727
@Component({
728728
template: `
729729
<md-checkbox
730-
[tabindex]="customTabIndex"
730+
[tabIndex]="customTabIndex"
731731
[disabled]="isDisabled"
732732
[disableRipple]="disableRipple">
733733
</md-checkbox>`,

src/lib/checkbox/checkbox.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ export class MdCheckbox implements ControlValueAccessor {
139139
get disabled(): boolean { return this._disabled; }
140140
set disabled(value) { this._disabled = coerceBooleanProperty(value); }
141141

142-
/** @docs-private */
143-
@Input() tabindex: number = 0;
142+
/** Tabindex value that is passed to the underlying input element. */
143+
@Input() tabIndex: number = 0;
144144

145145
/** Name value will be applied to the input element if present */
146146
@Input() name: string = null;

0 commit comments

Comments
 (0)