member_webapp/@overflow/notification/component/list/list.component.ts
crusader df378be2d1 ing
2018-06-07 16:28:27 +09:00

36 lines
1.1 KiB
TypeScript

import { Component, Input, EventEmitter, Output, ViewChild, OnInit, OnChanges, SimpleChanges } from '@angular/core';
import { Notification } from '@overflow/commons-typescript/model/notification';
import { Page, PageParams } from '@overflow/commons-typescript/core/model';
import { Paginator } from 'primeng/primeng';
@Component({
selector: 'of-notification-list',
templateUrl: './list.component.html',
})
export class NotificationListComponent implements OnChanges {
@Input() notificationPage: Page<Notification>;
@Output() pageChange = new EventEmitter<number>();
@Output() markAll = new EventEmitter();
@Output() select = new EventEmitter();
@ViewChild('paginator') paginator: Paginator;
ngOnChanges(changes: SimpleChanges): void {
if (changes['notificationPage'] && this.paginator) {
this.paginator.changePage(this.notificationPage.number);
}
}
onPaginate(e) {
this.pageChange.emit(e.page);
}
onRowSelect(e) {
this.select.emit(e.data);
}
onMarkAllAsRead() {
this.markAll.emit();
}
}