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

97.33% Statements 73/75
80% Branches 4/5
100% Functions 3/3
97.33% Lines 73/75

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 761x 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  
/*******************************************************************************
 * 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 { DateInputComponent } from '../../date-input/date-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-date',
  templateUrl: './ext-search-date.component.html',
  styleUrls: ['./ext-search-date.component.css'],
  providers: [
    { provide: BaseExtSearchComponent, useExisting: ExtSearchDateComponent },
  ],
  standalone: false,
})
export class ExtSearchDateComponent
  extends BaseExtSearchSingleFieldComponent
  implements FocusableElementOwner
{
  /**
   * Current value of the date input, in ISO 8601 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('dateInputField')
  protected dateInputField?: DateInputComponent;
 
  /** @ignore */
  protected sizeHelperText = '';
 
  /** @ignore */
  protected override readonly _widgetKeys: WidgetKeySet =
    createWidgetKeySet('gc-ext-search-date');
 
  public override focusChild(): boolean {
    if (this.dateInputField) {
      return this.dateInputField.focusChild();
    }
    return false;
  }
 
  /** @ignore */
  protected handleValueChange(): void {
    this.valueChange.emit(this.value);
  }
}