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 | 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 29x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 4x 4x 4x 2x 2x 2x 2x 2x 4x 4x 1x | /*******************************************************************************
* Copyright bei
* Entwicklungs- und Pflegeverbund für das gemeinsame Fachverfahren gefa
*
*******************************************************************************/
import {
Component,
NgZone,
computed,
input,
model,
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'],
host: {
'[class.gc-replaceable-has-override]': 'hasOverride()',
},
standalone: false,
})
export class ReplaceableTextComponent implements FocusableElementOwner {
/** The (readonly) value */
public value = input('');
/** Label shown for the (readonly) value. */
public label = input.required<string>();
/**
* Indicates if an override is present, if `true` the input field is shown.
*/
public hasOverride = model(false);
/**
* Label shown for the override value.
*/
public overrideLabel = input('');
/**
* Show a multi line text field
*/
public multiLine = input(false);
/**
* Wrap the replacement elements (the overrides) inside a group.
*/
public groupMode = input(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.
*/
public readonly = input(false);
/**
* Decides if the edit/remove buttons are hidden.
*/
public hideEditRemove = input(false);
/**
* Computed label.
*/
protected computedLabel = computed(() => {
return this.label() + (this.hasOverride() ? ' (deaktiviert)' : '');
});
/** @ignore */
private readonly readOnlyInputField =
viewChild.required<FocusableElementOwner>('readOnlyInput');
public constructor(private readonly ngZone: NgZone) {}
public focusChild(): boolean {
return this.readOnlyInputField().focusChild();
}
/** @ignore */
protected changeHasOverride(hasOverride: boolean) {
this.hasOverride.set(hasOverride);
if (!hasOverride) {
this.ngZone.runOutsideAngular(() => {
setTimeout(() => {
this.readOnlyInputField().focusChild();
});
});
}
}
}
|