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 198 | 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 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 21x 2882x 2882x 2882x 21x 21x 31x 31x 21x 21x 556x 556x 556x 21x 21x 21x 21x 21x 21x 21x 381x 381x 21x 21x 21x 255x 255x 255x 255x 255x 255x 255x 255x 255x 21x 21x 21x 21x 21x 21x 1x 1x 1x 1x 1x 1x 1x 21x 21x 1x 1x 21x 21x 1x 1x 2295x 2295x 1x 1x 1x 1x 255x 255x 255x 255x 255x 255x 255x 255x 255x 255x 1x 1x 5x 5x 5x 5x 5x 1x 1x 1x 5x 5x 5x 5x 5x 5x 5x 5x 1x 1x 1x 5x 5x 5x 1x 1x 1x 16x 16x 16x 16x 16x 16x 16x 16x 16x 1x 1x 1x 105x 105x 1x 1x 1x 23x 23x 23x 46x 23x 23x 46x 46x 23x 23x 23x 23x 23x 46x 23x 23x 23x 1x | /******************************************************************************* * Copyright bei * Entwicklungs- und Pflegeverbund für das gemeinsame Fachverfahren gefa * *******************************************************************************/ import { Component, ElementRef, EventEmitter, Input, Output, ViewChild, } from '@angular/core'; import { IndexedItem, textToLine } from '../../../utils/internal-utils'; import { Item, Key, WidgetKeySet } from '../../../utils/util.types'; import { createWidgetKeySet, itemTrack } from '../../../utils/utilities'; import { KeyFocusTarget, LegacyBasePickerComponent, } from '../../../picker/legacy-base-picker.component'; import { SelectionEvent } from '../../listbox.directive'; @Component({ selector: 'gc-wizard-stepper-horizontal', templateUrl: './wizard-stepper-horizontal.component.html', styleUrls: [ './../../../utils/styles/reset-button.css', './wizard-stepper-horizontal.component.css', ], standalone: false, }) export class WizardStepperHorizontalComponent extends LegacyBasePickerComponent< Item, Item > { /** Inform about the change of the selection state */ @Output() public readonly valueChange: EventEmitter<Item> = new EventEmitter<Item>(); @Input() public selectableItems: readonly Item[] = []; @Input() public controlledId = ''; @Input() public invalidItemKeys: ReadonlySet<Key> = new Set(); @ViewChild('button') public button!: ElementRef<HTMLButtonElement>; @ViewChild('wizardStepperContainer') private containerElement!: ElementRef<HTMLDivElement>; /** * The value represents the selected value */ @Input() public get value(): Item | undefined { return this.storage.selected; } public set value(value: Item | undefined) { this.storage.selected = value; } @Input() public override get items(): readonly Item[] { return super.items; } public override set items(items: readonly Item[]) { super.items = items; } /** @ignore */ public get _listboxId(): string { return this._widgetKeys.baseKey + '-lb'; } /** @ignore */ public get _ariaControls(): string | undefined { const idList = [ this._impl_drawerOpen ? this._listboxId : '', this.controlledId, ] .join(' ') .trim(); return idList ? idList : undefined; } public readonly _widgetKeys: WidgetKeySet = createWidgetKeySet( 'gc-wizard-stepper-horizontal', ); public _hasFocus = false; /** * @ignore */ public _processItemText(text: string) { return textToLine(text, 32, '<br>'); } public getAnker(): ElementRef<HTMLElement> { return this.button; } public getScrollTarget(): ElementRef<HTMLElement> | undefined { return this.containerElement; } public _isSelected(item: IndexedItem<Item>): boolean { return item.value === this.value; } public _isSelectable(key: Key): boolean { return this.selectableItems.some(i => i.key === key); } public _getAriaMessage(): string { const itemIndex = this.items.findIndex(i => i.key === this.value?.key); return ( 'Arbeitsschritt ' + (itemIndex !== -1 ? itemIndex + 1 : 1).toString() + ' von ' + this.items.length.toString() + (this.invalidItemKeys.size > 0 ? this.getInvalidStepIndexes() : '') + '.' ); } public _onSelect(event: SelectionEvent): void { const item = this.storage.indexItems.find(i => i.key === event.key); if (item && !this.disabledItems.has(item.key)) { this._impl_onSelect(item.key); } } /** @ignore */ public _impl_onSelect(key: Key): void { if (!this._isDisabled(key)) { const value = this.storage.getValueByKey(key); if (value != undefined) { this._impl_handleChange(value); this._impl_close(true); } } } /** @ignore */ public _impl_handleChange(value: Item): void { this.value = value; this.valueChange.emit(value); } /** @ignore */ protected _impl_onOpen(focusItem: KeyFocusTarget): KeyFocusTarget { // always open selected value if set if (this.value != undefined) { const key = this.storage.getItemByValue(this.value)?.key; if (key != undefined) { focusItem = key; } } return focusItem; } /** @ignore */ protected _itemTrackBy(item: Item): string { return itemTrack(item); } /** @ignore */ private getInvalidStepIndexes() { let invalidItemsAriaText = ' - Fehlerhafte Eingaben in Schritt '; const invalidStepIndexes: number[] = []; this.invalidItemKeys.forEach(value => { invalidStepIndexes.push(this.items.findIndex(i => i.key === value)); }); invalidStepIndexes.forEach((stepIndex, idx) => { const stringifiedIndex = (stepIndex + 1).toString(); if (idx === 0) { invalidItemsAriaText += stringifiedIndex; } else { invalidItemsAriaText += idx === invalidStepIndexes.length - 1 ? ` und ${stringifiedIndex}` : `, ${stringifiedIndex}`; } }); return invalidItemsAriaText; } } |