add only orderBy

This commit is contained in:
Dan Percic 2021-11-17 16:13:35 +02:00
parent 2b73cfcc8b
commit 1b75b12fbd
5 changed files with 8 additions and 9 deletions

View File

@ -62,10 +62,6 @@ export abstract class ListingComponent<T extends IListable> extends AutoUnsubscr
this.listingService.select(entity);
}
isSelected(entity: T): boolean {
return this.listingService.isSelected(entity);
}
cast(entity: unknown): T {
return entity as T;
}

View File

@ -28,7 +28,7 @@
<ng-template #tableItem let-entity="entity">
<div (click)="listingComponent.toggleEntitySelected($event, entity)" *ngIf="selectionEnabled" class="selection-column">
<iqser-round-checkbox [active]="listingComponent.isSelected(entity)"></iqser-round-checkbox>
<iqser-round-checkbox [active]="listingService.isSelected(entity)"></iqser-round-checkbox>
</div>
<ng-container *ngTemplateOutlet="listingComponent.tableItemTemplate; context: { entity: entity }"></ng-container>

View File

@ -1,10 +1,10 @@
import { Injectable } from '@angular/core';
import { orderBy } from 'lodash';
import { BehaviorSubject } from 'rxjs';
import { SortingOption } from './models/sorting-option.model';
import { SortingOrder, SortingOrders } from './models/sorting-order.type';
import { KeysOf, shareDistinctLast } from '../utils';
import { IListable } from '../listing';
import orderBy from 'lodash/orderBy';
@Injectable()
export class SortingService<T extends IListable> {
@ -29,7 +29,7 @@ export class SortingService<T extends IListable> {
return order === SortingOrders.asc ? result : result.reverse();
}
return orderBy(values, [column], [order]);
return orderBy<T>(values, [column], [order]) as T[];
}
setSortingOption(value: SortingOption<T>): void {

View File

@ -17,7 +17,9 @@ export function humanize(value: string, lowercase = true): string {
return words.map(capitalize).join(' ');
}
export const log = tap(console.log);
export function log<T>() {
return tap<T>(res => console.log(res));
}
export function toNumber(str: string): number {
try {

View File

@ -8,7 +8,8 @@
"inlineSources": true,
"strict": true,
"types": [],
"lib": ["dom", "es2018"]
"lib": ["dom", "es2018"],
"allowSyntheticDefaultImports": true
},
"exclude": ["src/test-setup.ts", "**/*.spec.ts"],
"include": ["**/*.ts"]