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
|
import { DrawerService } from '../../../../services/drawer/drawer.service';
|
7
|
import { LoggerService } from '../../../../services/logger/logger.service';
|
8
|
import { TranslateService } from '@ngx-translate/core';
|
9
|
|
10
|
@Component({
|
11
|
selector: 'app-search-paginator',
|
12
|
templateUrl: './search-paginator.component.html',
|
13
|
styleUrls: ['./search-paginator.component.css']
|
14
|
})
|
15
|
export class SearchPaginatorComponent implements OnChanges {
|
16
|
@ViewChild(MatPaginator, {static: true}) paginator: MatPaginator;
|
17
|
@Input() inputData: SearchResponse;
|
18
|
tableDataSource: MatTableDataSource<TextRegion>;
|
19
|
|
20
|
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
21
|
displayedColumns = ['image'];
|
22
|
|
23
|
constructor(private LOGGER: LoggerService, private drawer: DrawerService, private translate: TranslateService) {
|
24
|
|
25
|
}
|
26
|
|
27
|
ngOnChanges(changes: SimpleChanges): void {
|
28
|
this.tableDataSource = new MatTableDataSource<TextRegion>(this.inputData.textRegions);
|
29
|
this.tableDataSource.paginator = this.paginator;
|
30
|
this.tableDataSource.paginator._intl.itemsPerPageLabel = '';
|
31
|
}
|
32
|
|
33
|
draw(result: TextRegion, imageId: string, canvasId: string) {
|
34
|
this.LOGGER.debug('Drawing method');
|
35
|
this.drawer.drawResult(result, imageId, canvasId);
|
36
|
}
|
37
|
}
|