29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { AsyncPipe, NgClass } from '@angular/common';
|
|
import { ChangeDetectionStrategy, Component, Input, Optional } from '@angular/core';
|
|
import { MatIcon } from '@angular/material/icon';
|
|
import { MatTooltip } from '@angular/material/tooltip';
|
|
import { TranslateModule } from '@ngx-translate/core';
|
|
import { SortingOrders, SortingService } from '../../sorting';
|
|
import { KeysOf } from '../../utils';
|
|
import { Id, IListable } from '../models';
|
|
|
|
@Component({
|
|
selector: 'iqser-table-column-name [label]',
|
|
templateUrl: './table-column-name.component.html',
|
|
styleUrls: ['./table-column-name.component.scss'],
|
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
imports: [MatIcon, MatTooltip, TranslateModule, AsyncPipe, NgClass],
|
|
})
|
|
export class TableColumnNameComponent<T extends IListable<PrimaryKey>, PrimaryKey extends Id = T['id']> {
|
|
readonly sortingOrders = SortingOrders;
|
|
|
|
@Input() label!: string;
|
|
@Input() sortByKey?: KeysOf<T>;
|
|
@Input() class?: string;
|
|
@Input() leftIcon?: string;
|
|
@Input() rightIcon?: string;
|
|
@Input() rightIconTooltip?: string;
|
|
|
|
constructor(@Optional() readonly sortingService: SortingService<T>) {}
|
|
}
|