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 | 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 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 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x 2x 2x 2x 2x 2x 4x 4x 1x | /*******************************************************************************
* Copyright bei
* Entwicklungs- und Pflegeverbund für das gemeinsame Fachverfahren gefa
*
*******************************************************************************/
import {
Component,
EventEmitter,
HostBinding,
Input,
NgZone,
Output,
ViewChild,
} from '@angular/core';
import { FocusableElementOwner } from '../utils/util.types';
/**
* Displays a read-only value and provides the option to enter an alternative override value.
* The input component to enter an override is supplied in the component's content.
*
* This component does not move focus when the input field becomes visible, such functionality
* must be implemented by the user of the component if needed (the input is simply projected by this
* component, hence it is not aware of any details about the inserted input structure).
*/
@Component({
selector: 'gc-replaceable-text',
templateUrl: './replaceable-text.component.html',
styleUrls: ['./replaceable-text.component.css'],
standalone: false,
})
export class ReplaceableTextComponent implements FocusableElementOwner {
/** The (readonly) value */
@Input()
public value = '';
/** Label shown for the (readonly) value. */
@Input()
public label = '';
/**
* Indicates if an override is present, if `true` the input field is shown.
*/
@Input()
@HostBinding('class.gc-replaceable-has-override')
public hasOverride = false;
/**
* Label shown for the override value.
*/
@Input()
public overrideLabel = '';
/**
* Show a multi line text field
*/
@Input()
public multiLine = false;
/**
* Wrap the replacement elements (the overrides) inside a group.
*/
@Input()
public groupMode = false;
/**
* Decides if the control is rendered for usage as readonly component.
*
* Does not affect the replacement/override content, which must be managed by the user.
*/
@Input()
public readonly = false;
/**
* Decides if the edit/remove buttons are hidden.
*/
@Input()
public hideEditRemove = false;
/**
* Informs about changes of the `hasOverride` property, i.e. when the user
* adds or removes the override value.
*/
@Output()
public readonly hasOverrideChange: EventEmitter<boolean> =
new EventEmitter<boolean>();
/** @ignore */
@ViewChild('readOnlyInput')
private readonly readOnlyInputField?: FocusableElementOwner;
public constructor(private readonly ngZone: NgZone) {}
public focusChild(): boolean {
if (this.readOnlyInputField) {
return this.readOnlyInputField.focusChild();
} else {
return false;
}
}
/** @ignore */
protected changeHasOverride(hasOverride: boolean) {
this.hasOverride = hasOverride;
this.hasOverrideChange.emit(hasOverride);
if (!hasOverride) {
this.ngZone.runOutsideAngular(() => {
setTimeout(() => {
this.readOnlyInputField?.focusChild();
});
});
}
}
}
|