All files / lib/ext-search/ext-search-time ext-search-time.component.ts

97.5% Statements 78/80
83.33% Branches 5/6
100% Functions 4/4
97.5% Lines 78/80

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 811x 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 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 1x 1x 1x 1x     1x 1x 1x 1x 1x 1x 1x 1x 1x 19x 19x 1x  
/*******************************************************************************
 * Copyright bei
 * Entwicklungs- und Pflegeverbund für das gemeinsame Fachverfahren gefa
 *
 *******************************************************************************/
import {
  Component,
  EventEmitter,
  Input,
  Output,
  ViewChild,
} from '@angular/core';
 
import {
  FocusableElementOwner,
  InvalidControlValue,
  Nullable,
  WidgetKeySet,
} from '../../utils/util.types';
import { createWidgetKeySet } from '../../utils/utilities';
 
import { TimeInputComponent } from '../../time-input/time-input.component';
import { BaseExtSearchComponent } from '../base-ext-search/base-ext-search-field.component';
import { BaseExtSearchSingleFieldComponent } from '../base-ext-search/base-ext-search-single-field.component';
 
@Component({
  selector: 'gc-ext-search-time',
  templateUrl: './ext-search-time.component.html',
  styleUrls: ['./ext-search-time.component.css'],
  providers: [
    { provide: BaseExtSearchComponent, useExisting: ExtSearchTimeComponent },
  ],
  standalone: false,
})
export class ExtSearchTimeComponent
  extends BaseExtSearchSingleFieldComponent
  implements FocusableElementOwner
{
  /**
   * Current value of the time input, in HH:mm format.
   */
  @Input()
  public value: Nullable<string | InvalidControlValue> = null;
 
  /**
   * Informs about the change of the picked value. Does not fire when updating the value programmatically, only on user inputs.
   */
  @Output()
  public readonly valueChange: EventEmitter<
    Nullable<string | InvalidControlValue>
  > = new EventEmitter<Nullable<string | InvalidControlValue>>();
 
  /** @ignore */
  @ViewChild('timeInputField')
  protected timeInputField?: TimeInputComponent;
 
  /** @ignore */
  protected _text = '';
 
  /** @ignore */
  protected override readonly _widgetKeys: WidgetKeySet =
    createWidgetKeySet('gc-ext-search-time');
 
  public override focusChild(): boolean {
    if (this.timeInputField) {
      return this.timeInputField.focusChild();
    }
    return false;
  }
 
  /** @ignore */
  protected handleValueChange(): void {
    this.valueChange.emit(this.value);
  }
 
  /** @ignore */
  protected handleInputChange(value: string): void {
    this._text = value;
  }
}