UNPKG

@igor2017/sat-popover

Version:
162 lines 9.52 kB
import { ElementRef, EventEmitter, TemplateRef, OnInit, ViewContainerRef, AfterViewInit } from '@angular/core'; import { AnimationEvent } from '@angular/animations'; import { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y'; import { BooleanInput, NumberInput } from '@angular/cdk/coercion'; import { SatPopoverScrollStrategy, SatPopoverHorizontalAlign, SatPopoverVerticalAlign, SatPopoverOpenOptions } from './types'; import { SatPopoverAnchoringService } from './popover-anchoring.service'; import * as i0 from "@angular/core"; export declare class SatPopoverAnchor implements AfterViewInit { elementRef: ElementRef; viewContainerRef: ViewContainerRef; get popover(): SatPopover; set popover(val: SatPopover); constructor(elementRef: ElementRef, viewContainerRef: ViewContainerRef); ngAfterViewInit(): void; static ɵfac: i0.ɵɵFactoryDeclaration<SatPopoverAnchor, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<SatPopoverAnchor, "[satPopoverAnchor]", ["satPopoverAnchor"], { "popover": { "alias": "satPopoverAnchor"; "required": false; }; }, {}, never, never, false, never>; } export declare class SatPopover implements OnInit { private _focusTrapFactory; private _viewContainerRef; private _defaultTransition; private _document; /** Anchor element. */ get anchor(): SatPopoverAnchor | ElementRef<HTMLElement> | HTMLElement; set anchor(val: SatPopoverAnchor | ElementRef<HTMLElement> | HTMLElement); private _anchor; /** Alignment of the popover on the horizontal axis. */ get horizontalAlign(): SatPopoverHorizontalAlign; set horizontalAlign(val: SatPopoverHorizontalAlign); private _horizontalAlign; /** Alignment of the popover on the x axis. Alias for `horizontalAlign`. */ get xAlign(): SatPopoverHorizontalAlign; set xAlign(val: SatPopoverHorizontalAlign); /** Alignment of the popover on the vertical axis. */ get verticalAlign(): SatPopoverVerticalAlign; set verticalAlign(val: SatPopoverVerticalAlign); private _verticalAlign; /** Alignment of the popover on the y axis. Alias for `verticalAlign`. */ get yAlign(): SatPopoverVerticalAlign; set yAlign(val: SatPopoverVerticalAlign); /** Whether the popover always opens with the specified alignment. */ get forceAlignment(): BooleanInput; set forceAlignment(val: BooleanInput); private _forceAlignment; /** * Whether the popover's alignment is locked after opening. This prevents the popover * from changing its alignement when scrolling or changing the size of the viewport. */ get lockAlignment(): BooleanInput; set lockAlignment(val: BooleanInput); private _lockAlignment; /** Whether the first focusable element should be focused on open. */ get autoFocus(): BooleanInput; set autoFocus(val: BooleanInput); private _autoFocus; _autoFocusOverride: boolean; /** Whether the popover should return focus to the previously focused element after closing. */ get restoreFocus(): BooleanInput; set restoreFocus(val: BooleanInput); private _restoreFocus; _restoreFocusOverride: boolean; /** How the popover should handle scrolling. */ get scrollStrategy(): SatPopoverScrollStrategy; set scrollStrategy(val: SatPopoverScrollStrategy); private _scrollStrategy; /** Whether the popover should have a backdrop (includes closing on click). */ get hasBackdrop(): BooleanInput; set hasBackdrop(val: BooleanInput); private _hasBackdrop; /** Whether the popover should close when the user clicks the backdrop or presses ESC. */ get interactiveClose(): boolean; set interactiveClose(val: BooleanInput); private _interactiveClose; /** Custom transition to use while opening. */ get openTransition(): string; set openTransition(val: string); private _openTransition; /** Custom transition to use while closing. */ get closeTransition(): string; set closeTransition(val: string); private _closeTransition; /** Scale value at the start of the :enter animation. */ get openAnimationStartAtScale(): NumberInput; set openAnimationStartAtScale(val: NumberInput); private _openAnimationStartAtScale; /** Scale value at the end of the :leave animation */ get closeAnimationEndAtScale(): NumberInput; set closeAnimationEndAtScale(val: NumberInput); private _closeAnimationEndAtScale; /** Optional backdrop class. */ backdropClass: string; /** Optional custom class to add to the overlay pane. */ panelClass: string | string[]; /** Emits when the popover is opened. */ opened: EventEmitter<void>; /** Emits when the popover is closed. */ closed: EventEmitter<any>; /** Emits when the popover has finished opening. */ afterOpen: EventEmitter<void>; /** Emits when the popover has finished closing. */ afterClose: EventEmitter<void>; /** Emits when the backdrop is clicked. */ backdropClicked: EventEmitter<void>; /** Emits when a keydown event is targeted to this popover's overlay. */ overlayKeydown: EventEmitter<KeyboardEvent>; /** Reference to template so it can be placed within a portal. */ _templateRef: TemplateRef<any>; /** Classes to be added to the popover for setting the correct transform origin. */ _classList: any; /** Whether the popover is presently open. */ _open: boolean; _state: 'enter' | 'void' | 'exit'; /** Reference to the element to build a focus trap around. */ private _focusTrapElement; /** Reference to the element that was focused before opening. */ private _previouslyFocusedElement; /** Reference to a focus trap around the popover. */ private _focusTrap; constructor(_focusTrapFactory: ConfigurableFocusTrapFactory, _anchoringService: SatPopoverAnchoringService, _viewContainerRef: ViewContainerRef, _defaultTransition: string, _document: any); ngOnInit(): void; /** Open this popover. */ open(options?: SatPopoverOpenOptions): void; /** Close this popover. */ close(value?: any): void; /** Toggle this popover open or closed. */ toggle(): void; /** Realign the popover to the anchor. */ realign(): void; /** Gets whether the popover is presently open. */ isOpen(): boolean; /** Allows programmatically setting a custom anchor. */ setCustomAnchor(viewContainer: ViewContainerRef, el: ElementRef<HTMLElement> | HTMLElement): void; /** Gets an animation config with customized (or default) transition values. */ get state(): "enter" | "exit" | "void"; get params(): { openTransition: string; closeTransition: string; startAtScale: NumberInput; endAtScale: NumberInput; }; /** Callback for when the popover is finished animating in or out. */ _onAnimationDone({ toState }: AnimationEvent): void; /** Starts the dialog exit animation. */ _startExitAnimation(): void; /** Apply alignment classes based on alignment inputs. */ _setAlignmentClasses(horizAlign?: SatPopoverHorizontalAlign, vertAlign?: SatPopoverVerticalAlign): void; /** Move the focus inside the focus trap and remember where to return later. */ private _trapFocus; /** Restore focus to the element focused before the popover opened. Also destroy trap. */ private _restoreFocusAndDestroyTrap; /** Save a reference to the element focused before the popover was opened. */ private _savePreviouslyFocusedElement; /** Throws an error if the alignment is not a valid horizontalAlign. */ private _validateHorizontalAlign; /** Throws an error if the alignment is not a valid verticalAlign. */ private _validateVerticalAlign; /** Throws an error if the scroll strategy is not a valid strategy. */ private _validateScrollStrategy; static ɵfac: i0.ɵɵFactoryDeclaration<SatPopover, [null, null, null, null, { optional: true; }]>; static ɵcmp: i0.ɵɵComponentDeclaration<SatPopover, "sat-popover", never, { "anchor": { "alias": "anchor"; "required": false; }; "horizontalAlign": { "alias": "horizontalAlign"; "required": false; }; "xAlign": { "alias": "xAlign"; "required": false; }; "verticalAlign": { "alias": "verticalAlign"; "required": false; }; "yAlign": { "alias": "yAlign"; "required": false; }; "forceAlignment": { "alias": "forceAlignment"; "required": false; }; "lockAlignment": { "alias": "lockAlignment"; "required": false; }; "autoFocus": { "alias": "autoFocus"; "required": false; }; "restoreFocus": { "alias": "restoreFocus"; "required": false; }; "scrollStrategy": { "alias": "scrollStrategy"; "required": false; }; "hasBackdrop": { "alias": "hasBackdrop"; "required": false; }; "interactiveClose": { "alias": "interactiveClose"; "required": false; }; "openTransition": { "alias": "openTransition"; "required": false; }; "closeTransition": { "alias": "closeTransition"; "required": false; }; "openAnimationStartAtScale": { "alias": "openAnimationStartAtScale"; "required": false; }; "closeAnimationEndAtScale": { "alias": "closeAnimationEndAtScale"; "required": false; }; "backdropClass": { "alias": "backdropClass"; "required": false; }; "panelClass": { "alias": "panelClass"; "required": false; }; }, { "opened": "opened"; "closed": "closed"; "afterOpen": "afterOpen"; "afterClose": "afterClose"; "backdropClicked": "backdropClicked"; "overlayKeydown": "overlayKeydown"; }, never, ["*"], false, never>; } //# sourceMappingURL=popover.component.d.ts.map