30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import { ChangeDetectionStrategy, Component, Input, TemplateRef } from '@angular/core';
|
|
import { Required } from '../../utils';
|
|
import { FilterService } from '../../filtering';
|
|
import { EntitiesService } from '../services';
|
|
import { Listable, TableColumnConfig } from '../models';
|
|
|
|
export const ListingModes = {
|
|
list: 'list',
|
|
workflow: 'workflow'
|
|
} as const;
|
|
|
|
export type ListingMode = keyof typeof ListingModes;
|
|
|
|
@Component({
|
|
selector: 'iqser-table-header',
|
|
templateUrl: './table-header.component.html',
|
|
styleUrls: ['./table-header.component.scss'],
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
})
|
|
export class TableHeaderComponent<T extends Listable> {
|
|
@Input() @Required() tableHeaderLabel!: string;
|
|
@Input() @Required() tableColumnConfigs!: readonly TableColumnConfig<T>[];
|
|
@Input() hasEmptyColumn = false;
|
|
@Input() selectionEnabled = false;
|
|
@Input() mode: ListingMode = ListingModes.list;
|
|
@Input() bulkActions?: TemplateRef<unknown>;
|
|
|
|
constructor(readonly entitiesService: EntitiesService<T>, readonly filterService: FilterService) {}
|
|
}
|