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 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | 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 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 10x 10x 10x 1x 1x 1x 1x 1x 10x 10x 10x 10x 10x 10x 1x 1x 1x 1x 1x 1x 1x 3x 1x 2x 1x 1x 1x 3x 3x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 50x 50x 50x 50x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 10x 10x 10x 10x 1x | /******************************************************************************* * Copyright bei * Entwicklungs- und Pflegeverbund für das gemeinsame Fachverfahren gefa * *******************************************************************************/ import { AfterViewInit, Component, ElementRef, EventEmitter, Input, NgZone, OnDestroy, Output, TemplateRef, ViewChild, } from '@angular/core'; import { ActionEvent } from '../utils/event.types'; import { badgeListAsString, observeSize } from '../utils/internal-utils'; import { BadgeItem, Callback, FocusableElementOwner, } from '../utils/util.types'; import { createWidgetKeySet, itemTrack } from '../utils/utilities'; import { ButtonComponent } from '../button/button.component'; /** * `gc-component-group` is a container component that wraps around other components and marks it's area with a border. */ @Component({ selector: 'gc-component-group', templateUrl: './component-group.component.html', styleUrls: ['./component-group.component.css'], standalone: false, }) export class ComponentGroupComponent implements AfterViewInit, OnDestroy, FocusableElementOwner { /** * Label of the group. */ @Input() public label = ''; /** * Decides if the button is shown or not. */ @Input() public showButton: boolean | 'disabled' = false; /** * Decides if the component group is deactivated or not. */ @Input() public deactivated = false; /** * Badge items to display in the header */ @Input() public badgeItems: readonly BadgeItem[] = []; /** * Icon provider for badge */ @Input() public badgeIconProvider?: TemplateRef<unknown>; /** * Control if the group is expanded. Only used when the group is deactivated. */ @Input() public expanded = true; /** * The method that gets fired when the button is pressed. */ @Output() public readonly onAction: EventEmitter<ActionEvent> = new EventEmitter<ActionEvent>(); /** * Inform about the change of the expanded state */ @Output() public readonly expandedChange: EventEmitter<boolean> = new EventEmitter<boolean>(); /** * @ignore */ @ViewChild('content') private contentElement!: ElementRef<HTMLDivElement>; /** * @ignore */ @ViewChild('removeButton', { read: ButtonComponent }) private removeButton?: ButtonComponent; /** * @ignore */ @ViewChild('expandButton', { read: ButtonComponent }) private expandButton?: ButtonComponent; /** * @ignore */ public _titleIsTooNarrow = false; /** @ignore */ protected readonly contentId: string; /** * @ignore */ private resizeObserver?: Callback; constructor(private readonly zone: NgZone) { const widgetKeys = createWidgetKeySet('gc-component-group'); this.contentId = `${widgetKeys.baseKey}-group-content`; } /** * @ignore */ ngAfterViewInit(): void { this.resizeObserver = observeSize( this.contentElement, this.zone, this.resizeCallback.bind(this), ); } /** * @ignore */ ngOnDestroy(): void { if (this.resizeObserver) { this.resizeObserver(); } } public focusChild(): boolean { if (this.removeButton && this.showButton !== 'disabled') { return this.removeButton.focusChild(); } else if (this.expandButton) { return this.expandButton.focusChild(); } else { return false; } } /** * @ignore */ protected onButtonPress(event: ActionEvent): void { this.onAction.emit(event); } /** @ignore */ protected badgeLegendText() { if (this.badgeItems.length > 0) { return ', ' + badgeListAsString(this.badgeItems); } return ''; } /** * @ignore */ protected _toggle(): void { this.expanded = !this.expanded; this.expandedChange.emit(this.expanded); } /** * @ignore */ protected _itemTrackBy(item: BadgeItem): string { return itemTrack(item); } /** * @ignore */ private resizeCallback(): void { // 148 === padding of title with icon-right button this._titleIsTooNarrow = this.contentElement.nativeElement.clientWidth - 148 < 200; } } |