Skip to content

Commit

Permalink
fix(module:notice-icon): fix missing class (#317)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed Dec 14, 2018
1 parent f0e4768 commit 8cb86b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/abc/notice-icon/notice-icon.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<div *ngIf="data?.length === 0">
<ng-template [ngTemplateOutlet]="badgeTpl"></ng-template>
</div>
<nz-dropdown *ngIf="data?.length > 0" [nzVisible]="popoverVisible" (nzVisibleChange)="onVisibleChange($event)"
<nz-dropdown #dd *ngIf="data?.length > 0" [nzVisible]="popoverVisible" (nzVisibleChange)="onVisibleChange($event)"
nzTrigger="click" nzPlacement="bottomRight">
<div nz-dropdown>
<div nz-dropdown (click)="fixCls()">
<ng-template [ngTemplateOutlet]="badgeTpl"></ng-template>
</div>
<nz-spin [nzSpinning]="loading" [nzDelay]="0">
Expand Down
15 changes: 7 additions & 8 deletions packages/abc/notice-icon/notice-icon.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
AfterViewInit,
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
Expand All @@ -24,7 +23,7 @@ import { NoticeIconSelect, NoticeItem } from './notice-icon.types';
host: { '[class.notice-icon__btn]': 'true' },
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class NoticeIconComponent implements OnInit, AfterViewInit, OnChanges, OnDestroy {
export class NoticeIconComponent implements OnInit, OnChanges, OnDestroy {
private i18n$: Subscription;
// tslint:disable-next-line:no-any
locale: any = {};
Expand All @@ -39,14 +38,19 @@ export class NoticeIconComponent implements OnInit, AfterViewInit, OnChanges, On
@Output() readonly clear = new EventEmitter<string>();
@Output() readonly popoverVisibleChange = new EventEmitter<boolean>();

@ViewChild(NzDropDownComponent) ddc: NzDropDownComponent;
@ViewChild('dd') ddc: NzDropDownComponent;

constructor(private i18n: DelonLocaleService, private cdr: ChangeDetectorRef) { }

onVisibleChange(result: boolean) {
this.popoverVisibleChange.emit(result);
}

fixCls() {
// TODO: https://github.com/NG-ZORRO/ng-zorro-antd/issues/2634
this.ddc.cdkOverlay.panelClass = ['header-dropdown', 'notice-icon'];
}

onSelect(i: NoticeIconSelect) {
this.select.emit(i);
}
Expand All @@ -62,11 +66,6 @@ export class NoticeIconComponent implements OnInit, AfterViewInit, OnChanges, On
});
}

ngAfterViewInit() {
if (!this.ddc) return;
this.ddc.cdkOverlay.panelClass = ['header-dropdown', 'notice-icon'];
}

ngOnChanges() {
this.cdr.markForCheck();
}
Expand Down

0 comments on commit 8cb86b5

Please sign in to comment.