Skip to content

Commit f29f7ab

Browse files
andrewseguintinayuangao
authored andcommitted
fix(compatibility): add missing mat- selectors (#2923)
* add missing mat- selectors * comments * put mat-hint in the right spot
1 parent bf0f625 commit f29f7ab

File tree

7 files changed

+43
-15
lines changed

7 files changed

+43
-15
lines changed

src/lib/core/compatibility/compatibility.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ export const MAT_ELEMENTS_SELECTOR = `
1919
[mat-dialog-title],
2020
[mat-fab],
2121
[mat-icon-button],
22+
[mat-menu-trigger-for],
2223
[mat-mini-fab],
2324
[mat-raised-button],
2425
[mat-tab-label],
2526
[mat-tab-link],
2627
[mat-tab-nav-bar],
28+
[matTooltip],
2729
mat-autocomplete,
30+
mat-button-toggle,
2831
mat-button-toggle-group,
2932
mat-button-toggle,
3033
mat-card,
@@ -56,6 +59,7 @@ export const MAT_ELEMENTS_SELECTOR = `
5659
mat-placeholder,
5760
mat-progress-bar,
5861
mat-progress-circle,
62+
mat-pseudo-checkbox,
5963
mat-radio-button,
6064
mat-radio-group,
6165
mat-select,
@@ -64,9 +68,10 @@ export const MAT_ELEMENTS_SELECTOR = `
6468
mat-slider,
6569
mat-spinner,
6670
mat-tab,
71+
mat-tab-body,
72+
mat-tab-header,
6773
mat-tab-group,
68-
mat-toolbar,
69-
matTooltip`;
74+
mat-toolbar`;
7075

7176
/** Selector that matches all elements that may have style collisions with AngularJS Material. */
7277
export const MD_ELEMENTS_SELECTOR = `
@@ -77,12 +82,15 @@ export const MD_ELEMENTS_SELECTOR = `
7782
[md-dialog-title],
7883
[md-fab],
7984
[md-icon-button],
85+
[md-menu-trigger-for],
8086
[md-mini-fab],
8187
[md-raised-button],
8288
[md-tab-label],
8389
[md-tab-link],
8490
[md-tab-nav-bar],
91+
[mdTooltip],
8592
md-autocomplete,
93+
md-button-toggle,
8694
md-button-toggle-group,
8795
md-button-toggle,
8896
md-card,
@@ -114,6 +122,7 @@ export const MD_ELEMENTS_SELECTOR = `
114122
md-placeholder,
115123
md-progress-bar,
116124
md-progress-circle,
125+
md-pseudo-checkbox,
117126
md-radio-button,
118127
md-radio-group,
119128
md-select,
@@ -122,9 +131,10 @@ export const MD_ELEMENTS_SELECTOR = `
122131
md-slider,
123132
md-spinner,
124133
md-tab,
134+
md-tab-body,
135+
md-tab-header,
125136
md-tab-group,
126-
md-toolbar,
127-
mdTooltip`;
137+
md-toolbar`;
128138

129139
/** Directive that enforces that the `mat-` prefix cannot be used. */
130140
@Directive({selector: MAT_ELEMENTS_SELECTOR})

src/lib/core/selection/pseudo-checkbox/pseudo-checkbox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export type MdPseudoCheckboxState = 'unchecked' | 'checked' | 'indeterminate';
2222
@Component({
2323
moduleId: module.id,
2424
encapsulation: ViewEncapsulation.None,
25-
selector: 'md-pseudo-checkbox',
25+
selector: 'md-pseudo-checkbox, mat-pseudo-checkbox',
2626
styleUrls: ['pseudo-checkbox.css'],
2727
template: '',
2828
host: {

src/lib/input/input-container.html

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<div class="mat-input-wrapper">
22
<div class="mat-input-table">
3-
<div class="mat-input-prefix"><ng-content select="[mdPrefix], [md-prefix]"></ng-content></div>
3+
<div class="mat-input-prefix">
4+
<!-- TODO(andrewseguin): remove [md-prefix] -->
5+
<ng-content select="[mdPrefix], [matPrefix], [md-prefix]"></ng-content>
6+
</div>
47

58
<div class="mat-input-infix" [class.mat-end]="align == 'end'">
69
<ng-content selector="input, textarea"></ng-content>
@@ -13,13 +16,16 @@
1316
[class.mat-accent]="dividerColor == 'accent'"
1417
[class.mat-warn]="dividerColor == 'warn'"
1518
*ngIf="_hasPlaceholder()">
16-
<ng-content select="md-placeholder"></ng-content>
19+
<ng-content select="md-placeholder, mat-placeholder"></ng-content>
1720
{{_mdInputChild.placeholder}}
1821
<span class="mat-placeholder-required" *ngIf="_mdInputChild.required">*</span>
1922
</label>
2023
</div>
2124

22-
<div class="mat-input-suffix"><ng-content select="[mdSuffix], [md-suffix]"></ng-content></div>
25+
<div class="mat-input-suffix">
26+
<!-- TODO(andrewseguin): remove [md-suffix] -->
27+
<ng-content select="[mdSuffix], [matSuffix], [md-suffix]"></ng-content>
28+
</div>
2329
</div>
2430

2531
<div class="mat-input-underline"
@@ -31,5 +37,5 @@
3137
</div>
3238

3339
<div *ngIf="hintLabel != ''" [attr.id]="_hintLabelId" class="mat-hint">{{hintLabel}}</div>
34-
<ng-content select="md-hint"></ng-content>
40+
<ng-content select="md-hint, mat-hint"></ng-content>
3541
</div>

src/lib/menu/menu-trigger.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ import {MenuPositionX, MenuPositionY} from './menu-positions';
3030
/**
3131
* This directive is intended to be used in conjunction with an md-menu tag. It is
3232
* responsible for toggling the display of the provided menu instance.
33+
* TODO(andrewseguin): Remove the kebab versions in favor of camelCased attribute selectors
3334
*/
3435
@Directive({
35-
selector: '[md-menu-trigger-for], [mat-menu-trigger-for], [mdMenuTriggerFor]',
36+
selector: `[md-menu-trigger-for], [mat-menu-trigger-for],
37+
[mdMenuTriggerFor], [matMenuTriggerFor]`,
3638
host: {
3739
'aria-haspopup': 'true',
3840
'(mousedown)': '_handleMousedown($event)',
@@ -53,8 +55,18 @@ export class MdMenuTrigger implements AfterViewInit, OnDestroy {
5355

5456
/** @deprecated */
5557
@Input('md-menu-trigger-for')
56-
get _deprecatedMenuTriggerFor(): MdMenuPanel { return this.menu; }
57-
set _deprecatedMenuTriggerFor(v: MdMenuPanel) { this.menu = v; }
58+
get _deprecatedMdMenuTriggerFor(): MdMenuPanel { return this.menu; }
59+
set _deprecatedMdMenuTriggerFor(v: MdMenuPanel) { this.menu = v; }
60+
61+
/** @deprecated */
62+
@Input('mat-menu-trigger-for')
63+
get _deprecatedMatMenuTriggerFor(): MdMenuPanel { return this.menu; }
64+
set _deprecatedMatMenuTriggerFor(v: MdMenuPanel) { this.menu = v; }
65+
66+
// Trigger input for compatibility mode
67+
@Input('matMenuTriggerFor')
68+
get _matMenuTriggerFor(): MdMenuPanel { return this.menu; }
69+
set _matMenuTriggerFor(v: MdMenuPanel) { this.menu = v; }
5870

5971
/** References the menu instance that the trigger is associated with. */
6072
@Input('mdMenuTriggerFor') menu: MdMenuPanel;

src/lib/tabs/tab-body.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export type MdTabBodyOriginState = 'left' | 'right';
4646
*/
4747
@Component({
4848
moduleId: module.id,
49-
selector: 'md-tab-body',
49+
selector: 'md-tab-body, mat-tab-body',
5050
templateUrl: 'tab-body.html',
5151
host: {
5252
'[class.mat-tab-body]': 'true',

src/lib/tabs/tab-group.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export type MdTabHeaderPosition = 'above' | 'below';
5050
*/
5151
@Component({
5252
moduleId: module.id,
53-
selector: 'md-tab-group',
53+
selector: 'md-tab-group, mat-tab-group',
5454
templateUrl: 'tab-group.html',
5555
styleUrls: ['tab-group.css'],
5656
host: {

src/lib/tabs/tab-header.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const EXAGGERATED_OVERSCROLL = 60;
4040
*/
4141
@Component({
4242
moduleId: module.id,
43-
selector: 'md-tab-header',
43+
selector: 'md-tab-header, mat-tab-header',
4444
templateUrl: 'tab-header.html',
4545
styleUrls: ['tab-header.css'],
4646
encapsulation: ViewEncapsulation.None,

0 commit comments

Comments
 (0)