Added sorting, started on paging

This commit is contained in:
2024-09-10 21:58:24 -04:00
parent 1e3dc2938b
commit 7a525930db
18 changed files with 558 additions and 177 deletions

View File

@@ -1,15 +1,41 @@
import { CommonModule } from '@angular/common';
import { Component, Input } from '@angular/core';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Header } from '../../models/header';
import {
faSort,
faSortDown,
faSortUp,
} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { SORT } from '../../enums/sort';
import { Result } from '../../models/result';
import { Page } from '../../models/page';
@Component({
selector: 'fbi-table',
standalone: true,
imports: [CommonModule],
imports: [CommonModule, FontAwesomeModule],
templateUrl: './table.component.html',
styleUrl: './table.component.scss',
})
export class TableComponent {
@Input() headers!: Header[];
@Input() rows!: Record<string, any>[];
@Input() data!: Result;
@Output() page = new EventEmitter<Page>();
@Output() sort = new EventEmitter<Header>();
faSortDown = faSortDown;
faSortUp = faSortUp;
faSort = faSort;
SORT = SORT;
onPage(event: MouseEvent): void {
event.stopPropagation();
this.page.emit();
}
onSort(event: MouseEvent, header: Header): void {
event.stopPropagation();
this.sort.emit(header);
}
}