Skip to content

fix(compatibility): add missing mat- selectors #2923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/lib/core/compatibility/compatibility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@ export const MAT_ELEMENTS_SELECTOR = `
[mat-dialog-title],
[mat-fab],
[mat-icon-button],
[mat-menu-trigger-for],
[mat-mini-fab],
[mat-raised-button],
[mat-tab-label],
[mat-tab-link],
[mat-tab-nav-bar],
[matTooltip],
mat-autocomplete,
mat-button-toggle,
mat-button-toggle-group,
mat-button-toggle,
mat-card,
Expand Down Expand Up @@ -56,6 +59,7 @@ export const MAT_ELEMENTS_SELECTOR = `
mat-placeholder,
mat-progress-bar,
mat-progress-circle,
mat-pseudo-checkbox,
mat-radio-button,
mat-radio-group,
mat-select,
Expand All @@ -64,9 +68,10 @@ export const MAT_ELEMENTS_SELECTOR = `
mat-slider,
mat-spinner,
mat-tab,
mat-tab-body,
mat-tab-header,
mat-tab-group,
mat-toolbar,
matTooltip`;
mat-toolbar`;

/** Selector that matches all elements that may have style collisions with AngularJS Material. */
export const MD_ELEMENTS_SELECTOR = `
Expand All @@ -77,12 +82,15 @@ export const MD_ELEMENTS_SELECTOR = `
[md-dialog-title],
[md-fab],
[md-icon-button],
[md-menu-trigger-for],
[md-mini-fab],
[md-raised-button],
[md-tab-label],
[md-tab-link],
[md-tab-nav-bar],
[mdTooltip],
md-autocomplete,
md-button-toggle,
md-button-toggle-group,
md-button-toggle,
md-card,
Expand Down Expand Up @@ -114,6 +122,7 @@ export const MD_ELEMENTS_SELECTOR = `
md-placeholder,
md-progress-bar,
md-progress-circle,
md-pseudo-checkbox,
md-radio-button,
md-radio-group,
md-select,
Expand All @@ -122,9 +131,10 @@ export const MD_ELEMENTS_SELECTOR = `
md-slider,
md-spinner,
md-tab,
md-tab-body,
md-tab-header,
md-tab-group,
md-toolbar,
mdTooltip`;
md-toolbar`;

/** Directive that enforces that the `mat-` prefix cannot be used. */
@Directive({selector: MAT_ELEMENTS_SELECTOR})
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/selection/pseudo-checkbox/pseudo-checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type MdPseudoCheckboxState = 'unchecked' | 'checked' | 'indeterminate';
@Component({
moduleId: module.id,
encapsulation: ViewEncapsulation.None,
selector: 'md-pseudo-checkbox',
selector: 'md-pseudo-checkbox, mat-pseudo-checkbox',
styleUrls: ['pseudo-checkbox.css'],
template: '',
host: {
Expand Down
14 changes: 10 additions & 4 deletions src/lib/input/input-container.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<div class="mat-input-wrapper">
<div class="mat-input-table">
<div class="mat-input-prefix"><ng-content select="[mdPrefix], [md-prefix]"></ng-content></div>
<div class="mat-input-prefix">
<!-- TODO(andrewseguin): remove [md-prefix] -->
<ng-content select="[mdPrefix], [matPrefix], [md-prefix]"></ng-content>
</div>

<div class="mat-input-infix" [class.mat-end]="align == 'end'">
<ng-content selector="input, textarea"></ng-content>
Expand All @@ -13,13 +16,16 @@
[class.mat-accent]="dividerColor == 'accent'"
[class.mat-warn]="dividerColor == 'warn'"
*ngIf="_hasPlaceholder()">
<ng-content select="md-placeholder"></ng-content>
<ng-content select="md-placeholder, mat-placeholder"></ng-content>
{{_mdInputChild.placeholder}}
<span class="mat-placeholder-required" *ngIf="_mdInputChild.required">*</span>
</label>
</div>

<div class="mat-input-suffix"><ng-content select="[mdSuffix], [md-suffix]"></ng-content></div>
<div class="mat-input-suffix">
<!-- TODO(andrewseguin): remove [md-suffix] -->
<ng-content select="[mdSuffix], [matSuffix], [md-suffix]"></ng-content>
</div>
</div>

<div class="mat-input-underline"
Expand All @@ -31,5 +37,5 @@
</div>

<div *ngIf="hintLabel != ''" [attr.id]="_hintLabelId" class="mat-hint">{{hintLabel}}</div>
<ng-content select="md-hint"></ng-content>
<ng-content select="md-hint, mat-hint"></ng-content>
</div>
18 changes: 15 additions & 3 deletions src/lib/menu/menu-trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ import {MenuPositionX, MenuPositionY} from './menu-positions';
/**
* This directive is intended to be used in conjunction with an md-menu tag. It is
* responsible for toggling the display of the provided menu instance.
* TODO(andrewseguin): Remove the kebab versions in favor of camelCased attribute selectors
*/
@Directive({
selector: '[md-menu-trigger-for], [mat-menu-trigger-for], [mdMenuTriggerFor]',
selector: `[md-menu-trigger-for], [mat-menu-trigger-for],
[mdMenuTriggerFor], [matMenuTriggerFor]`,
host: {
'aria-haspopup': 'true',
'(mousedown)': '_handleMousedown($event)',
Expand All @@ -53,8 +55,18 @@ export class MdMenuTrigger implements AfterViewInit, OnDestroy {

/** @deprecated */
@Input('md-menu-trigger-for')
get _deprecatedMenuTriggerFor(): MdMenuPanel { return this.menu; }
set _deprecatedMenuTriggerFor(v: MdMenuPanel) { this.menu = v; }
get _deprecatedMdMenuTriggerFor(): MdMenuPanel { return this.menu; }
set _deprecatedMdMenuTriggerFor(v: MdMenuPanel) { this.menu = v; }

/** @deprecated */
@Input('mat-menu-trigger-for')
get _deprecatedMatMenuTriggerFor(): MdMenuPanel { return this.menu; }
set _deprecatedMatMenuTriggerFor(v: MdMenuPanel) { this.menu = v; }

// Trigger input for compatibility mode
@Input('matMenuTriggerFor')
get _matMenuTriggerFor(): MdMenuPanel { return this.menu; }
set _matMenuTriggerFor(v: MdMenuPanel) { this.menu = v; }

/** References the menu instance that the trigger is associated with. */
@Input('mdMenuTriggerFor') menu: MdMenuPanel;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tabs/tab-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export type MdTabBodyOriginState = 'left' | 'right';
*/
@Component({
moduleId: module.id,
selector: 'md-tab-body',
selector: 'md-tab-body, mat-tab-body',
templateUrl: 'tab-body.html',
host: {
'[class.mat-tab-body]': 'true',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tabs/tab-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export type MdTabHeaderPosition = 'above' | 'below';
*/
@Component({
moduleId: module.id,
selector: 'md-tab-group',
selector: 'md-tab-group, mat-tab-group',
templateUrl: 'tab-group.html',
styleUrls: ['tab-group.css'],
host: {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tabs/tab-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const EXAGGERATED_OVERSCROLL = 60;
*/
@Component({
moduleId: module.id,
selector: 'md-tab-header',
selector: 'md-tab-header, mat-tab-header',
templateUrl: 'tab-header.html',
styleUrls: ['tab-header.css'],
encapsulation: ViewEncapsulation.None,
Expand Down