All files / lib/wizard-header wizard-header.component.ts

95.95% Statements 95/99
75% Branches 6/8
80% Functions 4/5
95.95% Lines 95/99

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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 1001x 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 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 28x 28x   28x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 1x 1x 6x 6x 6x 6x 7x 7x 7x   7x 6x 6x 1x 1x 1x 1x 1x     1x 1x 1x 13x 13x 13x 1x  
/*******************************************************************************
 * Copyright bei
 * Entwicklungs- und Pflegeverbund für das gemeinsame Fachverfahren gefa
 *
 *******************************************************************************/
import {
  Component,
  ElementRef,
  EventEmitter,
  Input,
  NgZone,
  OnDestroy,
  Output,
} from '@angular/core';
 
import { observeSize } from '../utils/internal-utils';
import { Callback } from '../utils/util.types';
 
/**
 * Header component to show title and core controls above *Wizard* content.
 */
@Component({
  selector: 'gc-wizard-header',
  templateUrl: './wizard-header.component.html',
  styleUrls: ['./wizard-header.component.css'],
  standalone: false,
})
export class WizardHeaderComponent implements OnDestroy {
  /**
   * Text that will be rendered as the wizard label in the header.
   */
  @Input()
  public label = '';
 
  /**
   * Text that is displayed above the label.
   */
  @Input()
  public subLabel = '';
 
  /**
   * Text that describes the wizard action.
   */
  @Input()
  public sectionActionLabel = '';
 
  /**
   * Fires upon triggering the abort button action.
   */
  @Output()
  public readonly onAbortButtonAction: EventEmitter<void> =
    new EventEmitter<void>();
 
  /** @ignore */
  public get _ariaSectionName(): string {
    return this.sectionActionLabel
      ? `Kopfbereich ${this.sectionActionLabel}`
      : 'Kopfbereich';
  }
 
  /**
   * @ignore
   */
  protected iconOnlyButton = false;
 
  /** @ignore */
  protected twoLineCloseButton = false;
 
  /**
   * @ignore
   */
  private resizeDestroy: Callback;
 
  constructor(hostElement: ElementRef<HTMLElement>, zone: NgZone) {
    const hostElementWidth =
      hostElement.nativeElement.getBoundingClientRect().width;
    this.computeResponsiveness(hostElementWidth);
    this.resizeDestroy = observeSize(hostElement, zone, size => {
      const width =
        size.borderBoxSize.length > 0
          ? size.borderBoxSize[0].inlineSize
          : size.contentRect.width;
      this.computeResponsiveness(width);
    });
  }
 
  /**
   * @ignore
   */
  ngOnDestroy(): void {
    this.resizeDestroy();
  }
 
  /** @ignore */
  private computeResponsiveness(width: number): void {
    this.iconOnlyButton = width < 424; // 24 + 320 + 16 + 40 + 24
    this.twoLineCloseButton = width < 765; // 32 + 560 + 16 + 141 + 16
  }
}