Skip to content

Commit 2fc6a4c

Browse files
crisbetokara
authored andcommitted
refactor: turn off view encapsulation for all components (#6563)
Fixes #6037.
1 parent 0526689 commit 2fc6a4c

File tree

14 files changed

+103
-18
lines changed

14 files changed

+103
-18
lines changed

src/cdk/table/row.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import {
1515
IterableDiffers,
1616
SimpleChanges,
1717
TemplateRef,
18-
ViewContainerRef
18+
ViewContainerRef,
19+
ViewEncapsulation,
1920
} from '@angular/core';
2021
import {CdkCellDef} from './cell';
2122

@@ -147,6 +148,7 @@ export class CdkCellOutlet {
147148
'role': 'row',
148149
},
149150
changeDetection: ChangeDetectionStrategy.OnPush,
151+
encapsulation: ViewEncapsulation.None,
150152
})
151153
export class CdkHeaderRow { }
152154

@@ -159,5 +161,6 @@ export class CdkHeaderRow { }
159161
'role': 'row',
160162
},
161163
changeDetection: ChangeDetectionStrategy.OnPush,
164+
encapsulation: ViewEncapsulation.None,
162165
})
163166
export class CdkRow { }

src/lib/datepicker/datepicker.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ export class MdDatepickerContent<D> implements AfterContentInit {
122122
selector: 'md-datepicker, mat-datepicker',
123123
template: '',
124124
changeDetection: ChangeDetectionStrategy.OnPush,
125+
encapsulation: ViewEncapsulation.None,
125126
})
126127
export class MdDatepicker<D> implements OnDestroy {
127128
/** The date to open the calendar to initially. */

src/lib/grid-list/grid-tile.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export class MdGridTile {
6262
selector: 'md-grid-tile-header, mat-grid-tile-header, md-grid-tile-footer, mat-grid-tile-footer',
6363
templateUrl: 'grid-tile-text.html',
6464
changeDetection: ChangeDetectionStrategy.OnPush,
65+
encapsulation: ViewEncapsulation.None,
6566
})
6667
export class MdGridTileText implements AfterContentInit {
6768
/**

src/lib/menu/menu-item.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {Component, ElementRef, OnDestroy, ChangeDetectionStrategy} from '@angular/core';
9+
import {
10+
Component,
11+
ElementRef,
12+
OnDestroy,
13+
ChangeDetectionStrategy,
14+
ViewEncapsulation,
15+
} from '@angular/core';
1016
import {FocusableOption} from '../core/a11y/focus-key-manager';
1117
import {CanDisable, mixinDisabled} from '../core/common-behaviors/disabled';
1218
import {Subject} from 'rxjs/Subject';
@@ -36,6 +42,7 @@ export const _MdMenuItemMixinBase = mixinDisabled(MdMenuItemBase);
3642
'(mouseenter)': '_emitHoverEvent()',
3743
},
3844
changeDetection: ChangeDetectionStrategy.OnPush,
45+
encapsulation: ViewEncapsulation.None,
3946
templateUrl: 'menu-item.html',
4047
exportAs: 'mdMenuItem',
4148
})

src/lib/progress-bar/progress-bar.scss

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ $mat-progress-bar-full-animation-duration: 2000ms !default;
55
$mat-progress-bar-piece-animation-duration: 250ms !default;
66

77

8-
:host {
8+
.mat-progress-bar {
99
display: block;
1010
// Height is provided for md-progress-bar to act as a default.
1111
height: $mat-progress-bar-height;
@@ -59,6 +59,12 @@ $mat-progress-bar-piece-animation-duration: 250ms !default;
5959
left: 0;
6060
}
6161

62+
// Reverse the apparent directionality of progress vars for rtl.
63+
&[dir='rtl'],
64+
[dir='rtl'] & {
65+
transform: rotateY(180deg);
66+
}
67+
6268
&[mode='query'] {
6369
transform: rotateZ(180deg);
6470
}
@@ -99,11 +105,6 @@ $mat-progress-bar-piece-animation-duration: 250ms !default;
99105
}
100106

101107

102-
// Reverse the apparent directionality of progress vars for rtl.
103-
:host-context([dir='rtl']) {
104-
transform: rotateY(180deg);
105-
}
106-
107108
// The values used for animations in md-progress-bar, both timing and transformation, can be
108109
// considered magic values. They are sourced from the Material Design example spec and duplicate
109110
// the values of the original designers definitions.

src/lib/progress-bar/progress-bar.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {Component, ChangeDetectionStrategy, Input} from '@angular/core';
9+
import {Component, ChangeDetectionStrategy, Input, ViewEncapsulation} from '@angular/core';
1010

1111
// TODO(josephperrott): Benchpress tests.
1212
// TODO(josephperrott): Add ARIA attributes for progressbar "for".
@@ -32,6 +32,7 @@ import {Component, ChangeDetectionStrategy, Input} from '@angular/core';
3232
templateUrl: 'progress-bar.html',
3333
styleUrls: ['progress-bar.css'],
3434
changeDetection: ChangeDetectionStrategy.OnPush,
35+
encapsulation: ViewEncapsulation.None,
3536
})
3637
export class MdProgressBar {
3738
/** Color of the progress bar. */

src/lib/progress-spinner/progress-spinner.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $mat-progress-spinner-stroke-width: 10px !default;
1212
$mat-progress-spinner-viewport-size: 100px !default;
1313

1414

15-
:host {
15+
.mat-progress-spinner {
1616
display: block;
1717
// Height and width are provided for mat-progress-spinner to act as a default.
1818
// The height and width are expected to be overwritten by application css.

src/lib/progress-spinner/progress-spinner.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
Renderer2,
1717
Directive,
1818
ViewChild,
19+
ViewEncapsulation,
1920
} from '@angular/core';
2021
import {CanColor, mixinColor} from '../core/common-behaviors/color';
2122

@@ -70,6 +71,7 @@ export const _MdProgressSpinnerMixinBase = mixinColor(MdProgressSpinnerBase, 'pr
7071
selector: 'md-progress-spinner, mat-progress-spinner',
7172
host: {
7273
'role': 'progressbar',
74+
'class': 'mat-progress-spinner',
7375
'[attr.aria-valuemin]': '_ariaValueMin',
7476
'[attr.aria-valuemax]': '_ariaValueMax',
7577
'[attr.aria-valuenow]': 'value',
@@ -79,6 +81,7 @@ export const _MdProgressSpinnerMixinBase = mixinColor(MdProgressSpinnerBase, 'pr
7981
templateUrl: 'progress-spinner.html',
8082
styleUrls: ['progress-spinner.css'],
8183
changeDetection: ChangeDetectionStrategy.OnPush,
84+
encapsulation: ViewEncapsulation.None,
8285
})
8386
export class MdProgressSpinner extends _MdProgressSpinnerMixinBase
8487
implements OnDestroy, CanColor {
@@ -279,12 +282,13 @@ export class MdProgressSpinner extends _MdProgressSpinnerMixinBase
279282
host: {
280283
'role': 'progressbar',
281284
'mode': 'indeterminate',
282-
'class': 'mat-spinner',
285+
'class': 'mat-spinner mat-progress-spinner',
283286
},
284287
inputs: ['color'],
285288
templateUrl: 'progress-spinner.html',
286289
styleUrls: ['progress-spinner.css'],
287290
changeDetection: ChangeDetectionStrategy.OnPush,
291+
encapsulation: ViewEncapsulation.None,
288292
})
289293
export class MdSpinner extends MdProgressSpinner {
290294
constructor(elementRef: ElementRef, ngZone: NgZone, renderer: Renderer2) {

src/lib/table/row.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {ChangeDetectionStrategy, Component, Directive} from '@angular/core';
9+
import {ChangeDetectionStrategy, Component, Directive, ViewEncapsulation} from '@angular/core';
1010
import {
1111
CdkHeaderRow,
1212
CdkRow,
@@ -52,6 +52,7 @@ export class MdRowDef extends _MdCdkRowDef { }
5252
'role': 'row',
5353
},
5454
changeDetection: ChangeDetectionStrategy.OnPush,
55+
encapsulation: ViewEncapsulation.None,
5556
})
5657
export class MdHeaderRow extends _MdHeaderRow { }
5758

@@ -64,5 +65,6 @@ export class MdHeaderRow extends _MdHeaderRow { }
6465
'role': 'row',
6566
},
6667
changeDetection: ChangeDetectionStrategy.OnPush,
68+
encapsulation: ViewEncapsulation.None,
6769
})
6870
export class MdRow extends _MdRow { }

src/lib/tabs/tab-group.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
@import '../core/style/layout-common';
33
@import 'tabs-common';
44

5-
:host {
5+
.mat-tab-group {
66
display: flex;
77
flex-direction: column;
88

@@ -23,8 +23,8 @@
2323
}
2424
}
2525

26-
:host[md-stretch-tabs] .mat-tab-label,
27-
:host[mat-stretch-tabs] .mat-tab-label {
26+
.mat-tab-group[md-stretch-tabs] .mat-tab-label,
27+
.mat-tab-group[mat-stretch-tabs] .mat-tab-label {
2828
flex-basis: 0;
2929
flex-grow: 1;
3030
}
@@ -51,7 +51,7 @@
5151
flex-grow: 1;
5252
}
5353

54-
:host.mat-tab-group-dynamic-height &.mat-tab-body-active {
54+
.mat-tab-group.mat-tab-group-dynamic-height &.mat-tab-body-active {
5555
overflow-y: hidden;
5656
}
5757
}

0 commit comments

Comments
 (0)