33 lines
1.3 KiB
TypeScript
33 lines
1.3 KiB
TypeScript
import { ChangeDetectionStrategy, Component, Input, TemplateRef } from '@angular/core';
|
|
import { Required } from '../../utils';
|
|
import { FilterService } from '../../filtering';
|
|
import { EntitiesService, ListingService } from '../services';
|
|
import { IListable, ListingMode, ListingModes, TableColumnConfig } from '../models';
|
|
import { Id } from '../models/trackable';
|
|
|
|
@Component({
|
|
selector: 'iqser-table-header',
|
|
templateUrl: './table-header.component.html',
|
|
styleUrls: ['./table-header.component.scss'],
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
})
|
|
export class TableHeaderComponent<T extends IListable<PrimaryKey>, PrimaryKey extends Id = T['id']> {
|
|
readonly listingModes = ListingModes;
|
|
|
|
@Input() @Required() tableHeaderLabel!: string;
|
|
@Input() @Required() tableColumnConfigs!: readonly TableColumnConfig<T>[];
|
|
@Input() hasEmptyColumn = false;
|
|
@Input() selectionEnabled = false;
|
|
@Input() listingMode: ListingMode = ListingModes.table;
|
|
@Input() totalSize?: number;
|
|
@Input() bulkActions?: TemplateRef<unknown>;
|
|
|
|
readonly quickFilters$ = this.filterService.getFilterModels$('quickFilters');
|
|
|
|
constructor(
|
|
readonly entitiesService: EntitiesService<T, T>,
|
|
readonly listingService: ListingService<T>,
|
|
readonly filterService: FilterService,
|
|
) {}
|
|
}
|