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

97.61% Statements 82/84
90% Branches 9/10
100% Functions 8/8
97.61% Lines 82/84

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 851x 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 1x 1x 1x 81x 81x 81x 81x 81x 81x 81x 81x 81x 81x 81x 81x 81x 81x 81x 81x 81x 81x 81x 81x 81x 81x 81x 81x 1x 1x 4x 4x     4x 4x 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,
  WidgetKeySet,
} from '../../utils/util.types';
import { createWidgetKeySet } from '../../utils/utilities';
 
import { TextInputComponent } from '../../text-input-field/text-input-field.component';
import { TextInputFormatter } from '../../text-input-field/text-input-field.formatters';
import { BaseExtSearchComponent } from '../base-ext-search/base-ext-search-field.component';
import { BaseExtSearchSingleFieldComponent } from '../base-ext-search/base-ext-search-single-field.component';
 
/**
 * `gc-ext-search-text` is a search parameter element for text input used exclusively in the extended search to filter a large number of results
 */
@Component({
  selector: 'gc-ext-search-text',
  templateUrl: './ext-search-text.component.html',
  styleUrls: ['./ext-search-text.component.css'],
  providers: [
    { provide: BaseExtSearchComponent, useExisting: ExtSearchTextComponent },
  ],
  standalone: false,
})
export class ExtSearchTextComponent
  extends BaseExtSearchSingleFieldComponent
  implements FocusableElementOwner
{
  /**
   * Input slot value.
   */
  @Input()
  public value: string | InvalidControlValue = '';
 
  /**
   * Fires on a input slot value change.
   */
  @Output()
  public readonly valueChange: EventEmitter<string | InvalidControlValue> =
    new EventEmitter<string | InvalidControlValue>();
 
  /**
   * Formatter to display the value in a custom format and convert user input to the internal representation
   */
  @Input()
  public formatter?: TextInputFormatter;
 
  /** @ignore */
  @ViewChild('textInputField')
  protected textInputField?: TextInputComponent;
 
  /** @ignore */
  protected override readonly _widgetKeys: WidgetKeySet =
    createWidgetKeySet('gc-ext-search-text');
 
  /** @ignore */
  protected _text = '';
 
  public override focusChild(): boolean {
    if (this.textInputField) {
      return this.textInputField.focusChild();
    } else {
      return false;
    }
  }
 
  /** @ignore */
  protected handleValueChange(): void {
    this.valueChange.emit(this.value);
  }
}