All files / lib/table table-cell-actions.component.ts

91.48% Statements 43/47
83.33% Branches 5/6
80% Functions 4/5
91.48% Lines 43/47

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 481x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5816x 5816x 5816x 5816x 5816x 1x 1x 5816x 5816x     5816x 5816x 1x 1x 1x     1x  
/*******************************************************************************
 * Copyright bei
 * Entwicklungs- und Pflegeverbund für das gemeinsame Fachverfahren gefa
 *
 *******************************************************************************/
import { Component, Input } from '@angular/core';
 
import { Item } from '../utils/util.types';
 
export interface TableCellAction extends Item {
  /** The action to be executed. */
  execute(): void;
}
 
/**
 * A actions table cell.
 */
@Component({
  selector: 'gc-table-cell-actions',
  templateUrl: './table-cell-actions.component.html',
  styleUrls: ['./table-cell-actions.component.css'],
})
export class TableCellActionsComponent {
  /** The actions of this cell. */
  @Input()
  public actions?: TableCellAction[];
 
  get primaryAction(): TableCellAction | undefined {
    if (this.actions !== undefined && this.actions.length > 0) {
      return this.actions[0];
    }
    return undefined;
  }
 
  get secondaryActions(): TableCellAction[] {
    if (this.actions !== undefined) {
      return this.actions;
    } else {
      return [];
    }
  }
 
  /** @ignore */
  execute(action: TableCellAction): void {
    action.execute();
  }
}