1
|
import { Component, Input, OnChanges, SimpleChanges, ViewChild } from '@angular/core';
|
2
|
import { MatPaginator } from '@angular/material/paginator';
|
3
|
import { MatTableDataSource } from '@angular/material/table';
|
4
|
import { TextRegion } from '../../../../model/parts/TextRegion';
|
5
|
import { SearchResponse } from '../../../../model/SearchResponse';
|
6
|
|
7
|
@Component({
|
8
|
selector: 'app-search-paginator',
|
9
|
templateUrl: './search-paginator.component.html',
|
10
|
styleUrls: ['./search-paginator.component.css']
|
11
|
})
|
12
|
export class SearchPaginatorComponent implements OnChanges {
|
13
|
@ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
|
14
|
@Input() inputData: SearchResponse;
|
15
|
tableDataSource: MatTableDataSource<TextRegion>;
|
16
|
|
17
|
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
18
|
displayedColumns = ['image'];
|
19
|
|
20
|
ngOnChanges(changes: SimpleChanges): void {
|
21
|
this.tableDataSource = new MatTableDataSource<TextRegion>(this.inputData.textRegions);
|
22
|
this.tableDataSource.paginator = this.paginator;
|
23
|
}
|
24
|
|
25
|
}
|