import { AfterContentChecked, AfterContentInit, ChangeDetectorRef, EventEmitter, OnDestroy, QueryList, TemplateRef } from '@angular/core'; import { FocusOrigin } from '@angular/cdk/a11y'; import { Direction } from '@angular/cdk/bidi'; import { AnimationEvent } from '@angular/animations'; import { BehaviorSubject, Observable, Subject } from 'rxjs'; import { ClientInputInterface, ClientOutputInterface } from '../core/client-environment'; import { GraniteMenuItemComponent } from './menu-item.component'; import { ClosedEventType, OpenedEventType, GraniteMenuPanelInterface } from './menu-panel'; import { MenuPositionX, MenuPositionY } from './menu-positions'; import * as i0 from "@angular/core"; /** Menu panel animation states */ type TransformMenuStates = 'void' | 'enter' | 'enter-from-below' | 'below-with-delay' | 'below' | 'pan' | 'hide' | 'pan-hidden'; /** * Menu panel animation transform/state object. Has to be an object as we supply * the `xOffset` parameter and not just the state name. */ type TransformMenu = { /** Current animation state name */ value: TransformMenuStates; params: { /** How far the menu has been panned/swiped by the user */ xOffset: number; }; }; /** Base class with all of the menu functionality. */ export declare class _MenuBaseComponent implements AfterContentInit, OnDestroy, AfterContentChecked, GraniteMenuPanelInterface { private _changeDetectorRef; /** Position of the menu in the X axis. */ get xPosition(): MenuPositionX; set xPosition(value: MenuPositionX); /** Position of the menu in the Y axis. */ get yPosition(): MenuPositionY; set yPosition(value: MenuPositionY); /** Optional touch menu panel title */ title: string; /** * Touch menu close button label. If not set, any label set by parent will * be used. */ closeLabel: string; openOnHover: boolean; scrollStrategy: 'reposition' | 'close'; /** * Styles to be applied to the menu. * Added as there is no way to apply styles to the menu from the outside. */ styles: { [key: string]: string; }; touchStyles: { [key: string]: string; }; templateRef: TemplateRef; /** All items inside the menu. Includes items nested inside another menu. */ _allItems: QueryList; /** * Event emitted when the menu is closed */ readonly closed: EventEmitter; /** * Event emitted when the menu is opened */ readonly opened: EventEmitter; /** * Used for locating the panel in tests and setting the aria-control attribute * for the menu trigger. */ readonly panelId: string; /** Parent menu of the current menu panel. */ parentMenu: GraniteMenuPanelInterface | undefined; /** Layout direction of the menu. */ direction: Direction; /** Whether to show back button in touch menu title bar */ showBackButton: boolean; /** Whether to show touch menu title bar */ showTitle: boolean; /** Whether to add a close button below the menu */ showCloseButton: boolean; /** Observable current state of the panel animation. */ _transformMenu: BehaviorSubject; /** Emits whenever an animation on the menu completes. */ _animationDone: Subject; /** Whether the menu is animating. */ _isAnimating: boolean; /** Whether the menu is about to be destroyed. */ _isClosing: boolean; /** Client input device information */ _clientInput: ClientInputInterface; /** Client output device information */ _clientOutput: ClientOutputInterface; private _menuEmpty$; _isMenuEmpty$: Observable; /** Only the direct descendant menu items. */ private _directDescendantItems; private _keyManager; /** Subscription to tab events on the menu panel */ private _tabSubscription; private _xPosition; private _yPosition; /** Current state of the panel animation. */ set _panelAnimationState(state: TransformMenuStates); /** * Current horizontal offset. Used with `pan` and `pan-hidden` * animation states. */ private xOffset; constructor(_changeDetectorRef: ChangeDetectorRef); ngAfterContentChecked(): void; ngAfterContentInit(): void; ngOnDestroy(): void; /** * Stream that combines the `_hovered` observables of all the menu's items * into a single observable. Emits whenever the hovered menu item changes. */ _hovered(): Observable; /** Handle a keyboard event from the menu, delegating to the appropriate action. */ _handleKeydown(event: KeyboardEvent): void; /** * Focus the first item in the menu. * @param origin Action from which the focus originated. Used to set the correct styling. */ focusFirstItem(origin?: FocusOrigin): void; /** Updates the `showTitle` property for touch device UI */ _updateShowTitle(): void; /** Starts the enter animation */ _startAnimation(): void; /** Resets the panel animation to its initial state. */ _resetAnimation(): void; /** * Starts the 'below' animation, moving a menu down, out of view below the * viewport. Used to close the whole menu, for example when clicking * the backdrop. */ _startTouchCloseDownAnimation(): void; /** * Starts the 'below-with-delay' animation, moving a menu down, out of view below the * viewport. Used to close the whole menu as a response to the user tapping * a menu item. There is a short delay before the animation starts, to that * the user gets a visual feedback on what item was selected. */ _startTouchCloseDownAnimationWithDelay(): void; /** * Starts the 'void' animation, moving a (sub) menu out of view to the side * of the viewport. Used when going "back" from a sub menu. */ _startTouchCloseSideAnimation(): void; /** * Starts the enter-from-below animation, moving a (root) menu into view, * Animates upwards from a starting position below the viewport. */ _startTouchRootEnterAnimation(): void; /** Starts the enter animation, moving a (sub) menu into view. */ _startTouchSubmenuEnterAnimation(): void; /** * Starts the pan animation, to position a submenu in a response * to user dragging sideways (panning). */ _startTouchPanAnimation(xOffset: number): void; /** * Starts the pan-hidden animation, to position a parent menu next to an * active submenu that the user is dragging sideways (panning). */ _startTouchHidePanAnimation(xOffset: number): void; /** * Starts the hide animation, to make a parent menu slide out to leave * space for a submenu. */ _startTouchHideAnimation(): void; /** Callback that is invoked when the panel animation completes. */ _onAnimationDone(event: AnimationEvent): void; _onAnimationStart(event: AnimationEvent): void; /** * Handle click on the menu by emitting on the `closed` emitter * with a `click` reason */ _handleClick(): void; /** * Handle click on the close button by emitting on the `closed` emitter * without any particular reason */ _handleCloseClick(): void; /** * Handle click on the back icon by emitting on the `clicked` emitter */ _handleBackClick(e: MouseEvent): void; /** * Update client device information for the menu and its menu items. */ _setDevice(clientInput: ClientInputInterface, clientOutput: ClientOutputInterface): void; /** * Resets the active item in the menu. This is used when the menu is opened, allowing * the user to start from the first option when pressing the down arrow. */ resetActiveItem(): void; /** * Sets up a stream that will keep track of any newly-added menu items and will update the list * of direct descendants. We collect the descendants this way, because `_allItems` can include * items that are part of child menus, and using a custom way of registering items is unreliable * when it comes to maintaining the item order. */ private _updateDirectDescendants; static ɵfac: i0.ɵɵFactoryDeclaration<_MenuBaseComponent, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<_MenuBaseComponent, never, never, { "xPosition": { "alias": "xPosition"; "required": false; }; "yPosition": { "alias": "yPosition"; "required": false; }; "title": { "alias": "title"; "required": false; }; "closeLabel": { "alias": "closeLabel"; "required": false; }; "openOnHover": { "alias": "openOnHover"; "required": false; }; "scrollStrategy": { "alias": "scrollStrategy"; "required": false; }; "styles": { "alias": "styles"; "required": false; }; "touchStyles": { "alias": "touchStyles"; "required": false; }; }, { "closed": "closed"; "opened": "opened"; }, ["_allItems"], never, true, never>; } export {};