import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnInit, QueryList } from '@angular/core'; import { BehaviorSubject } from 'rxjs'; /** * Define the user object interface */ export interface TsUser { /** * The user's full name */ fullName: string; } /** * Base allowed keys for an item passed to the {@link TsNavigationComponent} */ export interface NavigationItemBase { /** * The value to use as the item text */ name: string; /** * Define if the item should only be allowed in the secondary navigation */ alwaysHidden: boolean; /** * Define if the item is disabled */ isDisabled?: boolean; /** * Define if the item is for admin functionality only */ isForAdmin?: boolean; } /** * Link specific keys for an item passed to the {@link TsNavigationComponent} */ export interface TsNavigationLinkItem extends NavigationItemBase { /** * The destination for items with a 'navigate' action. Single strings are used for external * locations while an array of strings are used for routerLinks */ destination: string | string[]; /** * Whether this link should navigate via the router or standard href */ isExternal?: boolean; } /** * Action specific keys for an item passed to the {@link TsNavigationComponent} */ export interface TsNavigationActionItem extends NavigationItemBase { /** * The action to emit upon interaction */ action: { type: string; }; } /** * Determine if a navigation item is a {@link TsNavigationLinkItem} * * @param x - The item to check * @returns True if the item is a TsNavigationLinkItem */ export declare const isLinkItem: (x: TsNavigationLinkItem | TsNavigationActionItem) => x is TsNavigationLinkItem; /** * Define the allowed keys and types for an item passed to the {@link TsNavigationComponent} */ export declare type TsNavigationItem = TsNavigationLinkItem | TsNavigationActionItem; /** * Define the expected response from the {@link TsNavigationComponent} emitter */ export interface TsNavigationPayload { /** * The mouse click event */ event: MouseEvent; /** * The selected item */ action: { type: string; }; } /** * This is the navigation UI Component * * @example * * * https://getterminus.github.io/ui-demos-release/components/navigation */ export declare class TsNavigationComponent implements OnInit, AfterViewInit { private changeDetectorRef; /** * Store a pristine copy of the navigation items */ private pristineItems; /** * Getter to return the available navigation width * * @returns The available navigation space */ private get availableSpace(); /** * Define an array of widths at which to break the navigation */ private breakWidths; /** * Define the list of hidden items */ hiddenItems: BehaviorSubject; /** * Getter to return the user's full name if it exists * * @returns The user's full name */ get usersFullName(): string | null; /** * The collection of visible navigation items */ visibleItems: BehaviorSubject; /** * Getter to return the count of visible items * * @returns The number of visible items */ get visibleItemsLength(): number; /** * Accept the array of navigation items and trigger setup * * @param value */ set items(value: TsNavigationItem[]); /** * Accept the user data */ user: TsUser; /** * Define the user name length */ userNameLength: number; /** * Define the welcome message */ welcomeMessage: string; /** * Define the welcome message length */ welcomeMsgLength: number; /** * Element reference for visible list items */ visibleItemsList: ElementRef; /** * Query list of all elements from the visible items list */ visibleLinkElement: QueryList; /** * Emit the click event with the {@link TsNavigationPayload} */ readonly action: EventEmitter; /** * Trigger a layout update when the window resizes */ onResize(): void; constructor(changeDetectorRef: ChangeDetectorRef); /** * Set up initial link groups */ ngOnInit(): void; /** * Trigger initial layout update after the view initializes */ ngAfterViewInit(): void; /** * Generate the array of breakWidths */ private generateBreakWidths; /** * Clone the nav items and split into the initially visible/hidden lists * * @param items - The complete list of navigation items */ private setUpInitialArrays; /** * Move items between the two lists as required by the available space */ private updateLists; /** * If the destination is a string and begins with `http` * * @param destination - The destination to check * @returns Boolean determining if the link is external */ isExternalLink(destination: string | string[]): boolean; /** * Function for tracking for-loops changes * * @param index - The item index * @returns The unique ID */ trackByFn(index: any): number; }