OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/frontend/app/components/wp-fast-table/builders/modes/grouped/grouped-rows-helpers.ts

27 lines
731 B

import {GroupObject} from '../../../../api/api-v3/hal-resources/wp-collection-resource.service';
export function groupIdentifier(group:GroupObject) {
let value = group.value || 'nullValue';
value = value.toLowerCase().replace(/[^a-z0-9]+/g, '-');
return `${groupByProperty(group)}-${value}`;
}
export function groupName(group:GroupObject) {
let value = group.value;
if (value === null) {
return '-';
} else {
return value;
}
}
export function groupByProperty(group:GroupObject):string {
return group._links!.groupBy.href.split('/').pop()!;
}
/**
* Get the row group class name for the given group id.
*/
export function groupedRowClassName(groupIndex:number) {
return `__row-group-${groupIndex}`;
}