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

91.66% Statements 44/48
80% Branches 4/5
75% Functions 3/4
91.66% Lines 44/48

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 48 491x 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 1x 6168x 6168x 6168x 6168x 6168x 1x 1x 6168x 6168x     6168x 6168x 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'],
  standalone: false,
})
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();
  }
}