All files / lib/badge-list badge-list.component.ts

91.17% Statements 62/68
100% Branches 8/8
75% Functions 3/4
91.17% Lines 62/68

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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 691x 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 1x 1x 1x 1x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 17x 1x 1x  
/*******************************************************************************
 * Copyright bei
 * Entwicklungs- und Pflegeverbund für das gemeinsame Fachverfahren gefa
 *
 *******************************************************************************/
import {
  Component,
  ContentChildren,
  Directive,
  Input,
  QueryList,
  TemplateRef,
} from '@angular/core';
 
import { BadgeItem } from '../utils/util.types';
 
/**
 * @deprecated
 */
@Directive({
  selector: '[data-gc-badge-list-item]',
})
export class BadgeListItemDirective {
  constructor(
    public readonly itemTemplate: TemplateRef<Record<string, never>>,
  ) {
    console.warn(
      'providing badges to the "gc-badge-list" via the directive is deprecated, prefer using the badge item input',
    );
  }
}
 
export interface BadgeItemTemplateContext {
  $implicit: BadgeItem;
}
 
/**
 * A BadgeList element is used to display multiple Badge components.
 */
@Component({
  selector: 'gc-badge-list',
  templateUrl: './badge-list.component.html',
  styleUrls: ['./badge-list.component.css'],
})
export class BadgeListComponent {
  /**
   * Badge items to show.
   */
  @Input()
  public badges: readonly BadgeItem[] = [];
 
  /**
   * If provided, this text is inserted for accessibility tools additionally in front of the badges.
   * May be used for example to separate the badges from preceeding (text) content.
   */
  @Input()
  public accessibleTextPrefix = '';
 
  /**
   * Icon provider for rendering badges with icons.
   */
  @Input()
  public iconProvider?: TemplateRef<BadgeItemTemplateContext>;
 
  /** @ignore */
  @ContentChildren(BadgeListItemDirective)
  protected badgeDirectives?: QueryList<BadgeListItemDirective>;
}