UNPKG

@blox/material

Version:

Material Components for Angular

101 lines (100 loc) 4.49 kB
import { AfterContentInit, ElementRef, OnDestroy, Renderer2, EventEmitter } from '@angular/core'; /** * The `mdcMenuSurface` is a reusable surface that appears above the content of the page * and can be positioned adjacent to an element. It is required as the surface for an `mdcMenu` * but can also be used by itself. */ export declare class MdcMenuSurfaceDirective implements AfterContentInit, OnDestroy { private _elm; private rndr; private _open; private _openFrom; /** * Assign an (optional) element or `mdcMenuAnchor`. If set the menu * will position itself relative to this anchor element. Assigning this property is not needed * if you wrap your surface inside an `mdcMenuAnchor`. */ menuAnchor: MdcMenuAnchorDirective | Element | null; /** * Assign any `HTMLElement` to this property to use as the viewport instead of * the window object. The menu will choose to open from the top or bottom, and * from the left or right, based on the space available inside the viewport. * * You should probably not use this property. We only use it to keep the documentation * snippets on our demo website contained in their window. */ viewport: HTMLElement | null; /** * Event emitted when the menu is opened or closed. (When this event is triggered, the * surface is starting to open/close, but the animation may not have fully completed * yet). */ readonly openChange: EventEmitter<boolean>; /** * Event emitted after the menu has fully opened. When this event is emitted the full * opening animation has completed, and the menu is visible. */ readonly afterOpened: EventEmitter<void>; /** * Event emitted after the menu has fully closed. When this event is emitted the full * closing animation has completed, and the menu is not visible anymore. */ readonly afterClosed: EventEmitter<void>; private _prevFocus; private _hoisted; private _fixed; private _handleBodyClick; private mdcAdapter; /** @docs-private */ private foundation; private document; constructor(_elm: ElementRef, rndr: Renderer2, doc: any); ngAfterContentInit(): void; ngOnDestroy(): void; /** * When this input is defined and does not have value false, the menu will be opened, * otherwise the menu will be closed. */ get open(): boolean; set open(val: boolean); static ngAcceptInputType_open: boolean | ''; /** * Set this value if you want to customize the direction from which the menu will be opened. * Use `tl` for top-left, `br` for bottom-right, etc. * When the left/right position depends on the text directionality, use `ts` for top-start, * `te` for top-end, etc. Start will map to left in left-to-right text directionality, and to * to right in right-to-left text directionality. End maps the other way around. * The default value is 'ts'. */ get openFrom(): 'tl' | 'tr' | 'bl' | 'br' | 'ts' | 'te' | 'bs' | 'be'; set openFrom(val: 'tl' | 'tr' | 'bl' | 'br' | 'ts' | 'te' | 'bs' | 'be'); private updateFoundationCorner; /** * Set to a value other then false to hoist the menu surface to the body so that the position offsets * are calculated relative to the page and not the anchor. (When a `viewport` is set, hoisting is done to * the viewport instead of the body). */ get hoisted(): boolean; set hoisted(val: boolean); static ngAcceptInputType_hoisted: boolean | ''; /** * Set to a value other then false use fixed positioning, so that the menu stays in the * same place on the window (or viewport) even if the page (or viewport) is * scrolled. */ get fixed(): boolean; set fixed(val: boolean); static ngAcceptInputType_fixed: boolean | ''; } /** * Defines an anchor to position an `mdcMenuSurface` to. If this directive is used as the direct parent of an `mdcMenuSurface`, * it will automatically be used as the anchor point. (Unless de `mdcMenuSurface` sets another anchor via its `menuAnchor`property). */ export declare class MdcMenuAnchorDirective implements AfterContentInit, OnDestroy { _elm: ElementRef; constructor(_elm: ElementRef); ngAfterContentInit(): void; ngOnDestroy(): void; private setSurfaces; } export declare const MENU_SURFACE_DIRECTIVES: (typeof MdcMenuSurfaceDirective | typeof MdcMenuAnchorDirective)[];