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/state/wp-table-metadata.service.ts

46 lines
1.1 KiB

import {WorkPackageTableMetadata} from '../wp-table-metadata';
import {States} from '../../states.service';
import {opServicesModule} from '../../../angular-modules';
import {State} from '../../../helpers/reactive-fassade';
import {WPTableRowSelectionState} from '../wp-table.interfaces';
export class WorkPackageTableMetadataService {
// The current table metadata state
public metadata:State<WorkPackageTableMetadata>;
constructor(public states: States) {
"ngInject";
this.metadata = states.table.metadata;
}
/**
* Returns whether the given column is contained in the current set
* of groupable columns.
*/
public isGroupable(name:string):boolean {
return !!_.find(this.current.groupableColumns, (column) => column.name === name);
}
public showSums():boolean {
return !!this.current.totalSums;
}
/**
* Get current selection state.
* @returns {WPTableRowSelectionState}
*/
public get current():WorkPackageTableMetadata {
return this.metadata.getCurrentValue();
}
}
opServicesModule.service('wpTableMetadata', WorkPackageTableMetadataService);