diff --git a/src/ui-kit/experimental/filter-drawer/filter-drawer.component.ts b/src/ui-kit/experimental/filter-drawer/filter-drawer.component.ts index 75f425849..7e92ea541 100755 --- a/src/ui-kit/experimental/filter-drawer/filter-drawer.component.ts +++ b/src/ui-kit/experimental/filter-drawer/filter-drawer.component.ts @@ -6,8 +6,6 @@ import { Input, QueryList, forwardRef, - ChangeDetectionStrategy, - AfterContentChecked, } from '@angular/core'; @Component({ @@ -15,9 +13,10 @@ import { template: ` {{ label }} - @@ -25,7 +24,8 @@ import { }) export class SamFilterDrawerChip { @Input() public label: string; - @Output() public click = new EventEmitter(); + @Input() public disabled = false; + @Output() public remove = new EventEmitter(); } @Component({ @@ -36,7 +36,8 @@ export class SamFilterDrawerChip {
  • @@ -45,9 +46,10 @@ export class SamFilterDrawerChip { export class SamFilterDrawerItemComponent { @Input() public label: string; @Input() public values: any[]; + @Input() public disabled = true; @Output() public remove = new EventEmitter(); - public removeFilter (value) { + public removeFilter (value): void { const removed = {}; removed[this.label] = value; this.remove.emit(removed); @@ -57,13 +59,8 @@ export class SamFilterDrawerItemComponent { @Component({ selector: 'sam-filter-drawer', templateUrl: 'filter-drawer.template.html', - changeDetection: ChangeDetectionStrategy.OnPush }) -export class SamFilterDrawerComponent implements AfterContentChecked { - /** - * Emits event when remove item is clicked - */ - @Output() public remove = new EventEmitter(); +export class SamFilterDrawerComponent { /** * Event emitter for the 'clear' event */ @@ -71,21 +68,9 @@ export class SamFilterDrawerComponent implements AfterContentChecked { @ContentChildren(forwardRef(() => SamFilterDrawerItemComponent)) public items: QueryList; - - constructor () {} - - public ngAfterContentChecked () { - this.setupPageServiceHandling(); - } - private setupPageServiceHandling(){ - if(this.items){ - this.items.forEach( - (el: SamFilterDrawerItemComponent) => { - el.remove.subscribe(evt => this.remove.emit(evt)); - } - ); - } + public get showClear (): boolean { + return this.items.length > 0; } } diff --git a/src/ui-kit/experimental/filter-drawer/filter-drawer.template.html b/src/ui-kit/experimental/filter-drawer/filter-drawer.template.html index 7b2757507..8477b0b15 100755 --- a/src/ui-kit/experimental/filter-drawer/filter-drawer.template.html +++ b/src/ui-kit/experimental/filter-drawer/filter-drawer.template.html @@ -2,6 +2,7 @@ diff --git a/src/ui-kit/experimental/patterns/layout/components/page/page.component.ts b/src/ui-kit/experimental/patterns/layout/components/page/page.component.ts index 17cb899d7..fc0a7d350 100644 --- a/src/ui-kit/experimental/patterns/layout/components/page/page.component.ts +++ b/src/ui-kit/experimental/patterns/layout/components/page/page.component.ts @@ -15,7 +15,10 @@ import { faTimes, } from '@fortawesome/free-solid-svg-icons'; -import { MdSidenavContainer, MdSidenav } from '../sidenav/sidenav'; +import { + MdSidenavContainer, + MdSidenav +} from '../sidenav/sidenav'; import { SamToolbarComponent } from '../toolbar.component'; @Component({ @@ -25,41 +28,49 @@ import { SamToolbarComponent } from '../toolbar.component'; styleUrls: ['./sam-page-next.scss'], }) export class SamPageNextComponent extends MdSidenavContainer { - @Input() backButtonText = ""; - @Output() backButton: any = new EventEmitter(); + @Input() public backButtonText = ''; + @Output() public backButtonClick = new EventEmitter(); @HostListener('window:resize') - resize() { if (this.aside) { this._responsiveAside(); } } + public resize() { + if (this.aside) { + this._responsiveAside(); + } + } @ContentChild(MdSidenav) public aside: MdSidenav; @ContentChild(SamToolbarComponent) - public toolbar: SamToolbarComponent; + public toolbar: SamToolbarComponent; - faLongArrowAltLeft = faLongArrowAltLeft; - faTimes = faTimes; + public backIcon = faLongArrowAltLeft; + public closeIcon = faTimes; constructor(_element: ElementRef, _renderer: Renderer2, _ngZone: NgZone) { super(null, _element, _renderer, _ngZone); } - ngAfterContentInit () { + public ngAfterContentInit (): void { super.ngAfterContentInit(); this._setupToolbar(); } - ngAfterViewInit (){ + public ngAfterViewInit (): void { this._setupAside(); } + + public backBtnClick (): void { + this.backButtonClick.emit(); + } - private _setupAside () { + private _setupAside (): void { if (this.aside) { this._responsiveAside(); } } - private _setupToolbar () { + private _setupToolbar (): void { if (this.toolbar) { if (this.aside) { // Attach sidenav to toolbar @@ -68,20 +79,17 @@ export class SamPageNextComponent extends MdSidenavContainer { } } - private _responsiveAside () { + private _responsiveAside (): void { this.aside.mode = !this._isSmallScreen() ? 'side' : 'over'; - if(this.aside.opened && this._isSmallScreen()){ + + if (this.aside.opened && this._isSmallScreen()) { this.aside.opened = false; - }else if(!this.aside.opened && !this._isSmallScreen()){ + } else if (!this.aside.opened && !this._isSmallScreen()) { this.aside.opened = true; } } - private _isSmallScreen () { + private _isSmallScreen (): boolean { return window.innerWidth <= 600 ? true : false; } - - backBtnClick(){ - this.backButton.emit(); - } } diff --git a/src/ui-kit/experimental/patterns/layout/components/page/page.template.html b/src/ui-kit/experimental/patterns/layout/components/page/page.template.html index 5e64fdcdd..b00ee80a3 100644 --- a/src/ui-kit/experimental/patterns/layout/components/page/page.template.html +++ b/src/ui-kit/experimental/patterns/layout/components/page/page.template.html @@ -1,11 +1,16 @@
    - +
    - - +
    - +
    @@ -16,8 +21,8 @@
    + [class.mat-sidenav-shown]="_isShowingBackdrop()"> +