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

100% Statements 79/79
100% Branches 5/5
100% Functions 4/4
100% Lines 79/79

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 801x 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 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 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 },
  ],
})
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;
  }
}