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 | 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 199x 199x 199x 1x 1x 1x 1x 1x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 39x 1x 1x 5x 5x 5x 5x 5x 1x 1x 1x 450x 450x 450x 450x 1x 1x 1x 90x 90x 1x 1x 1x 1x 1x 1x 90x 90x 90x 90x 1x 1x 1x 1x 1x 45x 45x 1x | /*******************************************************************************
* Copyright bei
* Entwicklungs- und Pflegeverbund für das gemeinsame Fachverfahren gefa
*
*******************************************************************************/
import {
ChangeDetectionStrategy,
Component,
ElementRef,
input,
viewChild,
} from '@angular/core';
import { LinkEvent } from '../../utils/event.types';
import {
Consumer,
FocusableElementOwner,
FormattedTextContent,
Item,
LinkItem,
} from '../../utils/util.types';
import { itemTrack } from '../../utils/utilities';
export type FormattedDescription = FormattedTextContent | string;
/**
* Hint component that is used to show hint messages in forms or accordions.
*/
@Component({
selector: 'gc-hint',
templateUrl: './hint.component.html',
styleUrls: ['./hint.component.css'],
changeDetection: ChangeDetectionStrategy.Eager,
standalone: false,
})
export class HintComponent implements FocusableElementOwner {
/** @ignore */
protected get _ariaSectionName(): string {
const shortLabel = this.shortLabel();
return shortLabel ? `Hinweis: ${shortLabel}` : 'Hinweis';
}
/**
* @ignore
*/
public readonly focusContainer =
viewChild<ElementRef<HTMLElement>>('focusContainer');
/**
* Text that will be shown as the hint.
*/
public readonly label = input('');
/**
* Additional abbreviated version of the (long) label, which is used to improve presentation
* to accessibility technologies if present.
*/
public readonly shortLabel = input('');
/**
* Decides if the passed content will be shown.
*/
public readonly items = input<readonly LinkItem[]>([]);
/**
* Optional content block that can contain a string or an array of strings and/or formatted text.
* If an array is provided, each entry is rendered in a separate div element.
*/
public readonly description = input<readonly FormattedDescription[] | string>(
'',
);
/**
* Optional handler to customize handling of navigation requests
*/
public readonly linkHandler = input<Consumer<LinkEvent>>();
focusChild(): boolean {
const focusContainer = this.focusContainer();
if (focusContainer) {
focusContainer.nativeElement.focus();
return true;
}
return false;
}
/** @ignore */
protected _isFormattedType(
content: FormattedDescription | string,
): content is Exclude<FormattedDescription, string> {
return typeof content !== 'string';
}
/** @ignore */
protected _isSingleValuedDescription() {
return typeof this.description() === 'string';
}
/** @ignore */
protected _singleValueDescription(): string {
const description = this.description();
return typeof description === 'string'
? description
: 'ERROR: multi valued';
}
/** @ignore */
protected _multiValueDescription(): readonly FormattedDescription[] {
const description = this.description();
return typeof description !== 'string'
? description
: ['ERROR: single valued'];
}
/**
* @ignore
*/
protected _itemTrackBy(item: Item): string {
return itemTrack(item);
}
}
|