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

91% Statements 91/100
80% Branches 4/5
66.66% Functions 2/3
91% Lines 91/100

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 100 1011x 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 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 7x 1x 1x 1x 2x 1x 1x 1x     2x 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 { BaseExtSearchRangeComponent } from '../base-ext-search/base-ext-search-range-field.component';
 
@Component({
  selector: 'gc-ext-search-date-range',
  templateUrl: './ext-search-date-range.component.html',
  styleUrls: ['./ext-search-date-range.component.css'],
  providers: [
    {
      provide: BaseExtSearchComponent,
      useExisting: ExtSearchDateRangeComponent,
    },
  ],
  standalone: false,
})
export class ExtSearchDateRangeComponent
  extends BaseExtSearchRangeComponent
  implements FocusableElementOwner
{
  @Input()
  public startSlotValue: Nullable<string | InvalidControlValue> = null;
 
  @Input()
  public endSlotValue: Nullable<string | InvalidControlValue> = null;
 
  /**
   * Fires on a start slot value change.
   */
  @Output()
  public readonly startSlotValueChange: EventEmitter<
    Nullable<string | InvalidControlValue>
  > = new EventEmitter<Nullable<string | InvalidControlValue>>();
 
  /**
   * Fires on an end slot value change.
   */
  @Output()
  public readonly endSlotValueChange: EventEmitter<
    Nullable<string | InvalidControlValue>
  > = new EventEmitter<Nullable<string | InvalidControlValue>>();
 
  /** @ignore */
  @ViewChild('startSlotEl')
  protected startSlotElement?: DateInputComponent;
 
  /** @ignore */
  @ViewChild('endSlotEl')
  protected endSlotElement?: DateInputComponent;
 
  /** @ignore */
  protected startSlotText = '';
 
  /** @ignore */
  protected endSlotText = '';
 
  /** @ignore */
  protected override readonly _widgetKeys: WidgetKeySet = createWidgetKeySet(
    'gc-ext-search-date-range',
  );
 
  public override focusRangeSlot(slot: 'start' | 'end'): boolean {
    if (slot === 'start' && this.startSlotElement) {
      return this.startSlotElement.focusChild();
    } else if (slot === 'end' && this.endSlotElement) {
      return this.endSlotElement.focusChild();
    }
    return false;
  }
 
  public override focusChild(): boolean {
    if (this.startSlotElement) {
      return this.startSlotElement.focusChild();
    } else if (this.endSlotElement) {
      return this.endSlotElement.focusChild();
    }
    return false;
  }
}