File
    Implements
    
    
    
    Index
    
        
                
                    | Properties | 
                
                    |  | 
                
                    | Methods | 
                
                    |  | 
                
                    | Inputs | 
                
                    |  | 
                
                    | Outputs | 
                
                    |  | 
                    
                        | Accessors | 
                    
                        |  | 
        
    
    
    
        
            
                
                    | collapsed | 
                
                    | Type : boolean | 
                
                    | Default value : false | 
                        
                            |  | 
            
        
        
            
                
                    | compact | 
                
                    | Type : boolean | 
                
                    | Default value : false | 
                        
                            |  | 
            
        
        
            
                
                    | horizontal | 
                
                    | Type : boolean | 
                
                    | Default value : false | 
                        
                            |  | 
            
        
        
            
                
                    | isForbidden | 
                
                    | Type : boolean | 
                
                    | Default value : false | 
                        
                            |  | 
            
        
        
        
    
    
    
    
        Methods
    
    
        
            
                | getSectionLabel | 
            
                | getSectionLabel(id: string) | 
            
                |  | 
            
                | 
                        Parameters :
                        
                        
                            
                                
                                    | Name | Type | Optional |  
                                    | id | string | No |  
                     
                        
                     | 
        
    
    
        
            
                | onKeydown | 
            
                | onKeydown($event: KeyboardEvent, undefined: literal type) | 
            
                |  | 
            
                | 
                        Parameters :
                        
                        
                            
                                
                                    | Name | Type | Optional |  
                                    | $event | KeyboardEvent | No |  
                                    | literal type | No |  
                     
                        
                     | 
        
    
    
        
            
                | requestSection | 
            
                | requestSection(undefined: literal type) | 
            
                |  | 
            
                | 
                        Parameters :
                        
                        
                            
                                
                                    | Name | Type | Optional |  
                                    | literal type | No |  
                     
                        
                     | 
        
    
    
    
    
    
        
            
                | focusIndex | 
                
                    | Type : number | null | 
                
                    | Default value : null | 
                    
                        |  | 
        
    
    
    
    
    
        Accessors
    
        
            
                
                    | currentSectionIndex | 
                
                    | get currentSectionIndex() | 
                            
                                |  | 
            
        
        import { FocusKeyManager } from '@angular/cdk/a11y';
import {
  AfterViewInit,
  Component,
  EventEmitter,
  HostBinding,
  Input,
  OnChanges,
  Output,
  QueryList,
  ViewChildren
} from '@angular/core';
import { SectionConfig, SectionWithState } from './model';
import { StepState } from './navigation-step-state';
import { NavigationStepComponent } from './navigation-step.component';
import { pushEvent } from '@allianz/tracking';
@Component({
  selector: 'frame-navigation-view',
  templateUrl: './navigation-view.component.html',
  styleUrls: ['./navigation-view.component.scss'],
  standalone: false
})
export class NavigationViewComponent implements AfterViewInit, OnChanges {
  @HostBinding('class.is-horizontal')
  @Input()
  horizontal = false;
  @Input() collapsed = false;
  @Input() compact = false;
  @Input() sectionStates: SectionWithState[] = [];
  @Input() sections?: SectionConfig;
  @Input() isForbidden = false;
  @Output() goto = new EventEmitter<string>();
  private currentState: SectionWithState | undefined;
  mobileBreadcrumbsText: string | undefined;
  focusIndex: number | null = null;
  @ViewChildren(NavigationStepComponent) items!: QueryList<NavigationStepComponent>;
  private keyManager!: FocusKeyManager<NavigationStepComponent>;
  onKeydown($event: KeyboardEvent, { sectionId }: { sectionId: string }) {
    const key = $event.key;
    if (key === 'Enter') {
      this.requestSection({ sectionId });
      $event.preventDefault();
    } else {
      this.keyManager.onKeydown($event);
      this.focusIndex = this.getFocusIndex();
    }
  }
  ngOnChanges() {
    const previousState = this.currentState;
    this.currentState = this.getCurrentState();
    this.mobileBreadcrumbsText = this.getMobileBreadcrumbsText();
    // this.keyManager is not initialized on the first call of ngOnChanges()
    if (this.keyManager) {
      this.keyManager.updateActiveItem(this.currentSectionIndex);
    }
    if (this.hasCurrentStepChanged(previousState)) {
      this.trackNavigationEvent();
    }
  }
  ngAfterViewInit() {
    this.keyManager = new FocusKeyManager(this.items)
      .withWrap()
      .skipPredicate((item) => item.isPending)
      .withHorizontalOrientation('ltr')
      .withVerticalOrientation();
  }
  getSectionLabel(id: string) {
    const section = this.sections?.get(id);
    return section?.label;
  }
  private getCurrentState(): SectionWithState | undefined {
    return this.sectionStates.find((item) => item.state === StepState.CURRENT);
  }
  private getFocusIndex() {
    return this.keyManager.activeItemIndex;
  }
  get currentSectionIndex() {
    return this.currentState ? this.sectionStates.indexOf(this.currentState) : -1;
  }
  requestSection({ sectionId }: { sectionId: string }) {
    this.goto.emit(sectionId);
  }
  private trackNavigationEvent() {
    if (!this.currentState) return;
    const currentIndex = this.currentSectionIndex;
    const totalSteps = this.sectionStates.length;
    const baseEventName = 'navigation';
    pushEvent(baseEventName, {
      currentStep: currentIndex + 1,
      totalSteps,
      stepId: this.currentState.sectionId,
      stepLabel: this.getSectionLabel(this.currentState.sectionId)
    });
  }
  private hasCurrentStepChanged(previousState: SectionWithState | undefined): boolean {
    return previousState?.sectionId !== this.currentState?.sectionId;
  }
  private getMobileBreadcrumbsText(): string | undefined {
    let text;
    if (this.currentState) {
      text =
        $localize`Step ` +
        `${this.currentSectionIndex + 1}/${this.sectionStates.length}` +
        $localize`:@@frame.navigation.step-separator::` +
        ` ${this.getSectionLabel(this.currentState.sectionId)}`;
    }
    return text;
  }
}
     
    
        @if (compact) { @if (mobileBreadcrumbsText) {
<div class="compact">{{ mobileBreadcrumbsText }}</div>
} } @if (!compact) {
<div class="navigation-steps" role="tablist">
  @for (section of sectionStates; track section.sectionId; let i = $index) {
  <frame-navigation-step
    (click)="requestSection(section)"
    (keydown)="onKeydown($event, section)"
    [tabindex]="focusIndex === i ? 0 : -1"
    [state]="section.state"
    [label]="getSectionLabel(section.sectionId)"
    [hideLabel]="collapsed"
    [horizontal]="horizontal"
    [isForbidden]="isForbidden"
    [labelId]="'frame-navigation-step-' + i"
  >
  </frame-navigation-step>
  }
</div>
}
     
    
                
                :host {
  display: block;
}
:host(.is-horizontal) {
  .navigation-steps {
    display: flex;
  }
  .dots,
  .labels {
    display: flex;
  }
}
.compact {
  text-align: center;
  font-size: var(--progress-indicator-mobile-font-size);
  line-height: var(--progress-indicator-mobile-line-height);
}
     
    
        
        
            
                Legend
            
            
            
            
                Html element with directive