36 lines
1.1 KiB
TypeScript
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 } from '@overflow/commons-typescript/model/commons/Page';
|
|
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();
|
|
}
|
|
}
|