remove withSort property
This commit is contained in:
parent
c552ed2e21
commit
6811739c79
@ -2,8 +2,7 @@ import { KeysOf } from '../../utils/types/utility-types';
|
||||
|
||||
export interface TableColumnConfig<T extends object> {
|
||||
readonly label: string;
|
||||
readonly column?: KeysOf<T>;
|
||||
readonly withSort?: boolean;
|
||||
readonly sortByKey?: KeysOf<T>;
|
||||
readonly class?: string;
|
||||
readonly leftIcon?: string;
|
||||
readonly rightIcon?: string;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<div (click)="withSort && sortingService?.toggleSort(column)" [class.pointer]="withSort" [ngClass]="class">
|
||||
<div (click)="!!sortByKey && sortingService?.toggleSort(sortByKey)" [class.pointer]="!!sortByKey" [ngClass]="class">
|
||||
<mat-icon *ngIf="!!leftIcon" [svgIcon]="leftIcon"></mat-icon>
|
||||
|
||||
<span class="all-caps-label">{{ label }}</span>
|
||||
@ -6,7 +6,7 @@
|
||||
<mat-icon *ngIf="!!rightIcon" [matTooltip]="rightIconTooltip" [svgIcon]="rightIcon" matTooltipPosition="above"></mat-icon>
|
||||
|
||||
<ng-container *ngIf="sortingService?.sortingOption$ | async as sortingOption">
|
||||
<div *ngIf="withSort" [class.force-display]="sortingOption.column === column" class="sort-arrows-container">
|
||||
<div *ngIf="!!sortByKey" [class.force-display]="sortingOption.column === sortByKey" class="sort-arrows-container">
|
||||
<mat-icon *ngIf="sortingOption.order === sortingOrders.asc" svgIcon="iqser:sort-asc"></mat-icon>
|
||||
<mat-icon *ngIf="sortingOption.order === sortingOrders.desc" svgIcon="iqser:sort-desc"></mat-icon>
|
||||
</div>
|
||||
|
||||
@ -4,7 +4,6 @@ import { Required } from '../../utils/decorators/required.decorator';
|
||||
import { KeysOf } from '../../utils/types/utility-types';
|
||||
import { SortingService } from '../../sorting/sorting.service';
|
||||
|
||||
const ifNeedsSort = <T extends object>(thisArg: TableColumnNameComponent<T>) => thisArg.withSort;
|
||||
const ifHasRightIcon = <T extends object>(thisArg: TableColumnNameComponent<T>) => !!thisArg.rightIcon;
|
||||
|
||||
@Component({
|
||||
@ -17,8 +16,7 @@ export class TableColumnNameComponent<T extends object> {
|
||||
readonly sortingOrders = SortingOrders;
|
||||
|
||||
@Input() @Required() label!: string;
|
||||
@Input() @Required(ifNeedsSort) column?: KeysOf<T>;
|
||||
@Input() withSort = false;
|
||||
@Input() sortByKey?: KeysOf<T>;
|
||||
@Input() class?: string;
|
||||
@Input() leftIcon?: string;
|
||||
@Input() rightIcon?: string;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user