mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ACS-7430] Make name optional in SortableByCategoryItem interface (#9735)
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
export interface SortableByCategoryItem {
|
export interface SortableByCategoryItem {
|
||||||
name: string;
|
name?: string;
|
||||||
category?: string;
|
category?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,7 +31,6 @@ export interface ItemsByCategory<T> {
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class SortByCategoryMapperService<T extends SortableByCategoryItem = SortableByCategoryItem> {
|
export class SortByCategoryMapperService<T extends SortableByCategoryItem = SortableByCategoryItem> {
|
||||||
|
|
||||||
private defaultCategories: string[] = [];
|
private defaultCategories: string[] = [];
|
||||||
|
|
||||||
mapItems(items: T[], defaultCategories: string[]): ItemsByCategory<T>[] {
|
mapItems(items: T[], defaultCategories: string[]): ItemsByCategory<T>[] {
|
||||||
@@ -83,15 +82,14 @@ export class SortByCategoryMapperService<T extends SortableByCategoryItem = Sort
|
|||||||
}
|
}
|
||||||
|
|
||||||
return itemA.category.localeCompare(itemB.category);
|
return itemA.category.localeCompare(itemB.category);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private mapItemDefaultCategory(listItem: SortableByCategoryItem): string {
|
private mapItemDefaultCategory(listItem: SortableByCategoryItem): string {
|
||||||
const itemCategory = listItem.category;
|
const itemCategory = listItem.category;
|
||||||
|
|
||||||
if (!this.isDefaultCategory(itemCategory)) {
|
if (!this.isDefaultCategory(itemCategory)) {
|
||||||
return (itemCategory ?? '');
|
return itemCategory ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
|
Reference in New Issue
Block a user