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 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | 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 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 458x 458x 458x 14x 14x 41x 41x 14x 14x 14x 14x 14x 14x 14x 14x 14x 14x 1x 1x 1x 1x 1x 1x 1x 1x 15x 12x 12x 12x 12x 15x 8x 5x 5x 7x 7x 7x 15x 15x 1x 1x 1x 1x 1x 1x | /******************************************************************************* * Copyright bei * Entwicklungs- und Pflegeverbund für das gemeinsame Fachverfahren gefa * *******************************************************************************/ import { Component, ElementRef, EventEmitter, Input, Output, ViewChild, } from '@angular/core'; import { FocusableElementOwner } from '../utils/util.types'; export type SwitchContentDisplay = 'text-left' | 'text-right'; /** * Switch component that allows users to quickly activate or deactivate a function. */ @Component({ selector: 'gc-switch', templateUrl: './switch.component.html', styleUrls: ['./../utils/styles/reset-button.css', './switch.component.css'], standalone: false, }) export class SwitchComponent implements FocusableElementOwner { /** * @ignore */ @ViewChild('input') public _inputElement!: ElementRef<HTMLInputElement>; /** * Text that will show near the switch. */ @Input() public label = ''; /** * Decides if the switch will be rendered in a disabled/enabled state. */ @Input() public disabled = false; /** * Decides if the switch will be rendered in a readonly state. */ @Input() public readonly = false; /** * Decides on which side of the switch the text is shown. */ @Input() public contentDisplay: SwitchContentDisplay = 'text-right'; /** * Enables setting of the value only when the Promise resolves with value "true". */ @Input() public permitValueChange?: (v: boolean) => Promise<boolean> | boolean; /** * Inform about the change of the selection state. */ @Output() public readonly valueChange: EventEmitter<boolean> = new EventEmitter<boolean>(); /** * Current value of the switch. */ @Input() get value(): boolean { return this._value; } set value(value: boolean) { this._value = value; } /** * @ignore */ public _hasFocus = false; /** * @ignore */ private _value = false; public focusChild(): boolean { if (!this.disabled) { this._inputElement.nativeElement.focus(); return true; } else { return false; } } /** @ignore */ public async _handleClick(): Promise<void> { const doChange = () => { this.value = !this.value; this._inputElement.nativeElement.focus(); this.valueChange.emit(this.value); }; if (this.permitValueChange) { const permit = await this.permitValueChange(!this.value); if (permit) { doChange(); } } else { doChange(); } } /** * @ignore */ public _setFocus(focused: boolean) { this._hasFocus = focused; } } |