/** * @license * Copyright Endlessjs. All Rights Reserved. * Licensed under the MIT License. See License.txt in the project root for license information. */ import { Location } from '@angular/common'; import { Params } from '@angular/router'; import { Observable, BehaviorSubject } from 'rxjs'; import { ElIconConfig } from '../icon/icon.component'; export interface ElMenuBag { tag: string; item: ElMenuItem; } /** * * * Menu Item options example * @stacked-example(Menu Link Parameters, menu/menu-link-params.component) * * */ export declare class ElMenuItem { /** * Item Title * @type {string} */ title: string; /** * Item relative link (for routerLink) * @type {string} */ link?: string; /** * Item URL (absolute) * @type {string} */ url?: string; /** * Icon class name or icon config object * @type {string | ElIconConfig} */ icon?: string | ElIconConfig; /** * Expanded by default * @type {boolean} */ expanded?: boolean; /** * Children items * @type {List} */ children?: ElMenuItem[]; /** * HTML Link target * @type {string} */ target?: string; /** * Hidden Item * @type {boolean} */ hidden?: boolean; /** * Item is selected when partly or fully equal to the current url * @type {string} */ pathMatch?: 'full' | 'prefix'; /** * Where this is a home item * @type {boolean} */ home?: boolean; /** * Whether the item is just a group (non-clickable) * @type {boolean} */ group?: boolean; /** Whether the item skipLocationChange is true or false *@type {boolean} */ skipLocationChange?: boolean; /** Map of query parameters *@type {Params} */ queryParams?: Params; parent?: ElMenuItem; selected?: boolean; data?: any; fragment?: string; /** * @returns item parents in top-down order */ static getParents(item: ElMenuItem): ElMenuItem[]; static isParent(item: ElMenuItem, possibleChild: ElMenuItem): boolean; } /** * * * Menu Service. Allows you to listen to menu events, or to interact with a menu. * @stacked-example(Menu Service, menu/menu-service.component) * * */ export declare class ElMenuService { /** * Add items to the end of the menu items list * @param {List} items * @param {string} tag */ addItems(items: ElMenuItem[], tag?: string): void; /** * Collapses all menu items * @param {string} tag */ collapseAll(tag?: string): void; /** * Navigate to the home menu item * @param {string} tag */ navigateHome(tag?: string): void; /** * Returns currently selected item. Won't subscribe to the future events. * @param {string} tag * @returns {Observable<{tag: string; item: ElMenuItem}>} */ getSelectedItem(tag?: string): Observable; onItemClick(): Observable; onItemSelect(): Observable; onItemHover(): Observable; onSubmenuToggle(): Observable; } export declare class ElMenuInternalService { private location; constructor(location: Location); prepareItems(items: ElMenuItem[]): void; selectFromUrl(items: ElMenuItem[], tag: string, collapseOther?: boolean): void; selectItem(item: ElMenuItem, items: ElMenuItem[], collapseOther: boolean, tag: string): void; collapseAll(items: ElMenuItem[], tag: string, except?: ElMenuItem): void; onAddItem(): Observable<{ tag: string; items: ElMenuItem[]; }>; onNavigateHome(): Observable<{ tag: string; }>; onCollapseAll(): Observable<{ tag: string; }>; onGetSelectedItem(): Observable<{ tag: string; listener: BehaviorSubject; }>; itemHover(item: ElMenuItem, tag?: string): void; submenuToggle(item: ElMenuItem, tag?: string): void; itemSelect(item: ElMenuItem, tag?: string): void; itemClick(item: ElMenuItem, tag?: string): void; /** * Unselect all given items deeply. * @param items array of items to unselect. * @returns items which selected value was changed. */ private resetSelection; /** * Collapse all given items deeply. * @param items array of items to collapse. * @param except menu item which shouldn't be collapsed, also disables collapsing for parents of this item. * @returns items which expanded value was changed. */ private collapseItems; private applyDefaults; private setParent; /** * Find deepest item which link matches current URL path. * @param items array of items to search in. * @returns found item of undefined. */ private findItemByUrl; private isSelectedInUrl; }