Skip to content

Commit

Permalink
feat: add ViewEncapsulation.None to the rest of components (#3535)
Browse files Browse the repository at this point in the history
Previously it was added only to components with custom styles

Fixes #3479
  • Loading branch information
maxokorokov committed Jan 9, 2020
1 parent 8574673 commit 5a5a8a7
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 20 deletions.
4 changes: 3 additions & 1 deletion src/accordion/accordion.ts
Expand Up @@ -9,7 +9,8 @@ import {
Optional,
Output,
QueryList,
TemplateRef
TemplateRef,
ViewEncapsulation
} from '@angular/core';

import {isString} from '../util/util';
Expand Down Expand Up @@ -146,6 +147,7 @@ export interface NgbPanelChangeEvent {
@Component({
selector: 'ngb-accordion',
exportAs: 'ngbAccordion',
encapsulation: ViewEncapsulation.None,
host: {'class': 'accordion', 'role': 'tablist', '[attr.aria-multiselectable]': '!closeOtherPanels'},
template: `
<ng-template #t ngbPanelHeader let-panel>
Expand Down
8 changes: 5 additions & 3 deletions src/carousel/carousel.ts
Expand Up @@ -7,6 +7,7 @@ import {
ContentChildren,
Directive,
EventEmitter,
HostListener,
Inject,
Input,
NgZone,
Expand All @@ -15,14 +16,14 @@ import {
PLATFORM_ID,
QueryList,
TemplateRef,
HostListener
ViewEncapsulation
} from '@angular/core';
import {isPlatformBrowser} from '@angular/common';

import {NgbCarouselConfig} from './carousel-config';

import {Subject, timer, BehaviorSubject, combineLatest, NEVER} from 'rxjs';
import {startWith, map, switchMap, takeUntil, distinctUntilChanged} from 'rxjs/operators';
import {BehaviorSubject, combineLatest, NEVER, Subject, timer} from 'rxjs';
import {distinctUntilChanged, map, startWith, switchMap, takeUntil} from 'rxjs/operators';

let nextId = 0;

Expand All @@ -49,6 +50,7 @@ export class NgbSlide {
selector: 'ngb-carousel',
exportAs: 'ngbCarousel',
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
host: {
'class': 'carousel slide',
'[style.display]': '"block"',
Expand Down
3 changes: 2 additions & 1 deletion src/modal/modal-backdrop.ts
@@ -1,7 +1,8 @@
import {Component, Input} from '@angular/core';
import {Component, Input, ViewEncapsulation} from '@angular/core';

@Component({
selector: 'ngb-modal-backdrop',
encapsulation: ViewEncapsulation.None,
template: '',
host:
{'[class]': '"modal-backdrop fade show" + (backdropClass ? " " + backdropClass : "")', 'style': 'z-index: 1050'}
Expand Down
3 changes: 2 additions & 1 deletion src/progressbar/progressbar.ts
@@ -1,4 +1,4 @@
import {Component, Input, ChangeDetectionStrategy} from '@angular/core';
import {ChangeDetectionStrategy, Component, Input, ViewEncapsulation} from '@angular/core';
import {getValueInRange, isNumber} from '../util/util';
import {NgbProgressbarConfig} from './progressbar-config';

Expand All @@ -8,6 +8,7 @@ import {NgbProgressbarConfig} from './progressbar-config';
@Component({
selector: 'ngb-progressbar',
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
template: `
<div class="progress" [style.height]="height">
<div class="progress-bar{{type ? ' bg-' + type : ''}}{{textType ? ' text-' + textType : ''}}
Expand Down
18 changes: 10 additions & 8 deletions src/rating/rating.ts
@@ -1,16 +1,17 @@
import {
Component,
ChangeDetectionStrategy,
Input,
Output,
ChangeDetectorRef,
Component,
ContentChild,
EventEmitter,
OnInit,
TemplateRef,
forwardRef,
Input,
OnChanges,
OnInit,
Output,
SimpleChanges,
ContentChild,
forwardRef,
ChangeDetectorRef
TemplateRef,
ViewEncapsulation
} from '@angular/core';
import {NgbRatingConfig} from './rating-config';
import {getValueInRange} from '../util/util';
Expand Down Expand Up @@ -44,6 +45,7 @@ const NGB_RATING_VALUE_ACCESSOR = {
@Component({
selector: 'ngb-rating',
changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None,
host: {
'class': 'd-inline-flex',
'tabindex': '0',
Expand Down
12 changes: 7 additions & 5 deletions src/tabset/tabset.ts
@@ -1,13 +1,14 @@
import {
AfterContentChecked,
Component,
Input,
ContentChildren,
QueryList,
Directive,
TemplateRef,
AfterContentChecked,
EventEmitter,
Input,
Output,
EventEmitter
QueryList,
TemplateRef,
ViewEncapsulation
} from '@angular/core';
import {NgbTabsetConfig} from './tabset-config';

Expand Down Expand Up @@ -97,6 +98,7 @@ export interface NgbTabChangeEvent {
@Component({
selector: 'ngb-tabset',
exportAs: 'ngbTabset',
encapsulation: ViewEncapsulation.None,
template: `
<ul [class]="'nav nav-' + type + (orientation == 'horizontal'? ' ' + justifyClass : ' flex-column')" role="tablist">
<li class="nav-item" *ngFor="let tab of tabs">
Expand Down
3 changes: 2 additions & 1 deletion src/typeahead/typeahead-window.ts
@@ -1,4 +1,4 @@
import {Component, Input, Output, EventEmitter, TemplateRef, OnInit} from '@angular/core';
import {Component, EventEmitter, Input, OnInit, Output, TemplateRef, ViewEncapsulation} from '@angular/core';

import {toString} from '../util/util';

Expand All @@ -20,6 +20,7 @@ export interface ResultTemplateContext {
@Component({
selector: 'ngb-typeahead-window',
exportAs: 'ngbTypeaheadWindow',
encapsulation: ViewEncapsulation.None,
host: {'(mousedown)': '$event.preventDefault()', 'class': 'dropdown-menu show', 'role': 'listbox', '[id]': 'id'},
template: `
<ng-template #rt let-result="result" let-term="term" let-formatter="formatter">
Expand Down

0 comments on commit 5a5a8a7

Please sign in to comment.