UNPKG

@ng-matero/extensions

Version:
1 lines 67.6 kB
{"version":3,"file":"mtxPopover.mjs","sources":["../../../projects/extensions/popover/popover-content.ts","../../../projects/extensions/popover/popover-errors.ts","../../../projects/extensions/popover/popover.ts","../../../projects/extensions/popover/popover.html","../../../projects/extensions/popover/popover-target.ts","../../../projects/extensions/popover/popover-trigger.ts","../../../projects/extensions/popover/popover-module.ts","../../../projects/extensions/popover/mtxPopover.ts"],"sourcesContent":["import { DomPortalOutlet, TemplatePortal } from '@angular/cdk/portal';\nimport {\n ApplicationRef,\n ChangeDetectorRef,\n Directive,\n DOCUMENT,\n Inject,\n InjectionToken,\n Injector,\n OnDestroy,\n TemplateRef,\n ViewContainerRef,\n} from '@angular/core';\nimport { Subject } from 'rxjs';\n\n/**\n * Injection token that can be used to reference instances of `MtxPopoverContent`. It serves\n * as alternative token to the actual `MtxPopoverContent` class which could cause unnecessary\n * retention of the class and its directive metadata.\n */\nexport const MTX_POPOVER_CONTENT = new InjectionToken<MtxPopoverContent>('MtxPopoverContent');\n\n@Directive()\nexport abstract class _MtxPopoverContentBase implements OnDestroy {\n private _portal!: TemplatePortal<any>;\n private _outlet!: DomPortalOutlet;\n\n /** Emits when the popover content has been attached. */\n readonly _attached = new Subject<void>();\n\n constructor(\n private _template: TemplateRef<any>,\n private _appRef: ApplicationRef,\n private _injector: Injector,\n private _viewContainerRef: ViewContainerRef,\n @Inject(DOCUMENT) private _document: any,\n private _changeDetectorRef?: ChangeDetectorRef\n ) {}\n\n /**\n * Attaches the content with a particular context.\n * @docs-private\n */\n attach(context: any = {}) {\n if (!this._portal) {\n this._portal = new TemplatePortal(this._template, this._viewContainerRef);\n }\n\n this.detach();\n\n if (!this._outlet) {\n this._outlet = new DomPortalOutlet(\n this._document.createElement('div'),\n this._appRef,\n this._injector\n );\n }\n\n const element: HTMLElement = this._template.elementRef.nativeElement;\n\n // Because we support opening the same popover from different triggers (which in turn have their\n // own `OverlayRef` panel), we have to re-insert the host element every time, otherwise we\n // risk it staying attached to a pane that's no longer in the DOM.\n element.parentNode!.insertBefore(this._outlet.outletElement, element);\n\n // When `MtxPopoverContent` is used in an `OnPush` component, the insertion of the popover\n // content via `createEmbeddedView` does not cause the content to be seen as \"dirty\"\n // by Angular. This causes the `@ContentChildren` for popover items within the popover to\n // not be updated by Angular. By explicitly marking for check here, we tell Angular that\n // it needs to check for new popover items and update the `@ContentChild` in `MtxPopover`.\n // @breaking-change 9.0.0 Make change detector ref required\n if (this._changeDetectorRef) {\n this._changeDetectorRef.markForCheck();\n }\n\n this._portal.attach(this._outlet, context);\n this._attached.next();\n }\n\n /**\n * Detaches the content.\n * @docs-private\n */\n detach() {\n if (this._portal.isAttached) {\n this._portal.detach();\n }\n }\n\n ngOnDestroy() {\n if (this._outlet) {\n this._outlet.dispose();\n }\n }\n}\n\n/**\n * Popover content that will be rendered lazily once the popover is opened.\n */\n@Directive({\n selector: 'ng-template[mtxPopoverContent]',\n providers: [{ provide: MTX_POPOVER_CONTENT, useExisting: MtxPopoverContent }],\n})\nexport class MtxPopoverContent extends _MtxPopoverContentBase {}\n","/**\n * Throws an exception for the case when popover trigger doesn't have a valid mtx-popover instance\n */\nexport function throwMtxPopoverMissingError() {\n throw Error(`mtx-popover-trigger: must pass in an mtx-popover instance.\n\n Example:\n <mtx-popover #popover=\"mtxPopover\"></mtx-popover>\n <button [mtxPopoverTriggerFor]=\"popover\"></button>`);\n}\n\n/**\n * Throws an exception for the case when popover's mtxPopoverPosition[0] value isn't valid.\n * In other words, it doesn't match 'above', 'below', 'before' or 'after'.\n */\nexport function throwMtxPopoverInvalidPositionStart() {\n throw Error(`mtxPopoverPosition[0] value must be either 'above', 'below', 'before' or 'after'.\n Example: <mtx-popover [position]=\"['below', 'after']\" #popover=\"mtxPopover\"></mtx-popover>`);\n}\n\n/**\n * Throws an exception for the case when popover's mtxPopoverPosition[1] value isn't valid.\n * In other words, it doesn't match 'above', 'below', 'before', 'after' or 'center'.\n */\nexport function throwMtxPopoverInvalidPositionEnd() {\n throw Error(`mtxPopoverPosition[1] value must be either 'above', 'below', 'before', 'after' or 'center'.\n Example: <mtx-popover [position]=\"['below', 'after']\" #popover=\"mtxPopover\"></mtx-popover>`);\n}\n","import { CdkTrapFocus } from '@angular/cdk/a11y';\nimport { Direction } from '@angular/cdk/bidi';\nimport { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n ContentChild,\n ElementRef,\n EventEmitter,\n InjectionToken,\n Input,\n NgZone,\n OnDestroy,\n OnInit,\n Output,\n TemplateRef,\n ViewChild,\n ViewEncapsulation,\n booleanAttribute,\n inject,\n} from '@angular/core';\nimport { _animationsDisabled } from '@angular/material/core';\nimport { Subject } from 'rxjs';\nimport { MTX_POPOVER_CONTENT, MtxPopoverContent } from './popover-content';\nimport {\n throwMtxPopoverInvalidPositionEnd,\n throwMtxPopoverInvalidPositionStart,\n} from './popover-errors';\nimport { MtxPopoverDefaultOptions, MtxPopoverPanel } from './popover-interfaces';\nimport { MtxPopoverPosition, MtxPopoverTriggerEvent, PopoverCloseReason } from './popover-types';\n\n/** Injection token to be used to override the default options for `mtx-popover`. */\nexport const MTX_POPOVER_DEFAULT_OPTIONS = new InjectionToken<MtxPopoverDefaultOptions>(\n 'mtx-popover-default-options',\n {\n providedIn: 'root',\n factory: () => ({\n backdropClass: 'cdk-overlay-transparent-backdrop',\n }),\n }\n);\n\nlet popoverPanelUid = 0;\n\n/** Name of the enter animation `@keyframes`. */\nconst ENTER_ANIMATION = '_mtx-popover-enter';\n\n/** Name of the exit animation `@keyframes`. */\nconst EXIT_ANIMATION = '_mtx-popover-exit';\n\n@Component({\n selector: 'mtx-popover',\n templateUrl: './popover.html',\n styleUrl: './popover.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n exportAs: 'mtxPopover',\n imports: [CdkTrapFocus],\n})\nexport class MtxPopover implements MtxPopoverPanel, OnInit, OnDestroy {\n private _changeDetectorRef = inject(ChangeDetectorRef);\n private _elementRef = inject(ElementRef);\n private _unusedNgZone = inject(NgZone);\n private _defaultOptions = inject<MtxPopoverDefaultOptions>(MTX_POPOVER_DEFAULT_OPTIONS);\n\n private _previousElevation?: string;\n private _elevationPrefix = 'mat-elevation-z';\n private _baseElevation: number | null = null;\n private _exitFallbackTimeout: ReturnType<typeof setTimeout> | undefined;\n\n /** Whether animations are currently disabled. */\n protected _animationsDisabled = _animationsDisabled();\n\n /** Config object to be passed into the popover's class. */\n _classList: { [key: string]: boolean } = {};\n\n /** Current state of the panel animation. */\n _panelAnimationState: 'void' | 'enter' = 'void';\n\n /** Emits whenever an animation on the popover completes. */\n readonly _animationDone = new Subject<'void' | 'enter'>();\n\n /** Whether the popover is animating. */\n _isAnimating = false;\n\n /** Closing disabled on popover */\n closeDisabled = false;\n\n /** Config object to be passed into the popover's arrow style */\n arrowStyles?: Record<string, unknown>;\n\n /** Layout direction of the popover. */\n direction?: Direction;\n\n /** Class or list of classes to be added to the overlay panel. */\n overlayPanelClass: string | string[] = this._defaultOptions.overlayPanelClass || '';\n\n /** Class to be added to the backdrop element. */\n @Input() backdropClass = this._defaultOptions.backdropClass;\n\n /** aria-label for the popover panel. */\n @Input('aria-label') ariaLabel?: string;\n\n /** aria-labelledby for the popover panel. */\n @Input('aria-labelledby') ariaLabelledby?: string;\n\n /** aria-describedby for the popover panel. */\n @Input('aria-describedby') ariaDescribedby?: string;\n\n /** Popover's trigger event. */\n @Input() triggerEvent: MtxPopoverTriggerEvent = this._defaultOptions.triggerEvent ?? 'hover';\n\n /** Popover's enter delay. */\n @Input() enterDelay = this._defaultOptions.enterDelay ?? 100;\n\n /** Popover's leave delay. */\n @Input() leaveDelay = this._defaultOptions.leaveDelay ?? 100;\n\n /** Popover's position. */\n @Input()\n get position() {\n return this._position;\n }\n set position(value: MtxPopoverPosition) {\n if (!['before', 'after', 'above', 'below'].includes(value[0])) {\n throwMtxPopoverInvalidPositionStart();\n }\n if (!['before', 'after', 'above', 'below', 'center'].includes(value[1])) {\n throwMtxPopoverInvalidPositionEnd();\n }\n this._position = value;\n this.setPositionClasses();\n }\n private _position = this._defaultOptions.position ?? ['below', 'after'];\n\n /** Popover-panel's X offset. */\n @Input() xOffset = this._defaultOptions.xOffset ?? 0;\n\n /** Popover-panel's Y offset. */\n @Input() yOffset = this._defaultOptions.yOffset ?? 0;\n\n /** Popover-arrow's width. */\n @Input() arrowWidth = this._defaultOptions.arrowWidth ?? 16;\n\n /** Popover-arrow's height. */\n @Input() arrowHeight = this._defaultOptions.arrowHeight ?? 16;\n\n /** Popover-arrow's X offset. */\n @Input() arrowOffsetX = this._defaultOptions.arrowOffsetX ?? 20;\n\n /** Popover-arrow's Y offset. */\n @Input() arrowOffsetY = this._defaultOptions.arrowOffsetY ?? 20;\n\n /** Whether the popover arrow should be hidden. */\n @Input({ transform: booleanAttribute })\n hideArrow = this._defaultOptions.hideArrow ?? false;\n\n /** Whether popover can be closed when click the popover-panel. */\n @Input({ transform: booleanAttribute })\n closeOnPanelClick = this._defaultOptions.closeOnPanelClick ?? false;\n\n /** Whether popover can be closed when click the backdrop. */\n @Input({ transform: booleanAttribute })\n closeOnBackdropClick = this._defaultOptions.closeOnBackdropClick ?? true;\n\n /** Whether enable focus trap using `cdkTrapFocus`. */\n @Input({ transform: booleanAttribute })\n focusTrapEnabled = this._defaultOptions.focusTrapEnabled ?? false;\n\n /** Whether enable focus trap auto capture using `cdkTrapFocusAutoCapture`. */\n @Input({ transform: booleanAttribute })\n focusTrapAutoCaptureEnabled = this._defaultOptions.focusTrapAutoCaptureEnabled ?? false;\n\n /** Whether the popover has a backdrop. It will always be false if the trigger event is hover. */\n @Input({ transform: booleanAttribute })\n hasBackdrop = this._defaultOptions.hasBackdrop;\n\n /**\n * This method takes classes set on the host mtx-popover element and applies them on the\n * popover template that displays in the overlay container. Otherwise, it's difficult\n * to style the containing popover from outside the component.\n * @param classes list of class names\n */\n @Input('class')\n set panelClass(classes: string) {\n const previousPanelClass = this._previousPanelClass;\n const newClassList = { ...this._classList };\n\n if (previousPanelClass && previousPanelClass.length) {\n previousPanelClass.split(' ').forEach((className: string) => {\n newClassList[className] = false;\n });\n }\n\n this._previousPanelClass = classes;\n\n if (classes && classes.length) {\n classes.split(' ').forEach((className: string) => {\n newClassList[className] = true;\n });\n\n this._elementRef.nativeElement.className = '';\n\n this.setPositionClasses();\n }\n\n this._classList = newClassList;\n }\n private _previousPanelClass?: string;\n\n /**\n * This method takes classes set on the host mtx-popover element and applies them on the\n * popover template that displays in the overlay container. Otherwise, it's difficult\n * to style the containing popover from outside the component.\n * @deprecated Use `panelClass` instead.\n * @breaking-change 8.0.0\n */\n @Input()\n get classList(): string {\n return this.panelClass;\n }\n set classList(classes: string) {\n this.panelClass = classes;\n }\n\n /** Event emitted when the popover is closed. */\n @Output() closed = new EventEmitter<PopoverCloseReason>();\n\n /** @docs-private */\n @ViewChild(TemplateRef) templateRef!: TemplateRef<any>;\n\n /**\n * Popover content that will be rendered lazily.\n * @docs-private\n */\n @ContentChild(MTX_POPOVER_CONTENT) lazyContent?: MtxPopoverContent;\n\n readonly panelId = `mtx-popover-panel-${popoverPanelUid++}`;\n\n ngOnInit() {\n this.setPositionClasses();\n }\n\n ngOnDestroy() {\n this.closed.complete();\n clearTimeout(this._exitFallbackTimeout);\n }\n\n /** Handle a keyboard event from the popover, delegating to the appropriate action. */\n _handleKeydown(event: KeyboardEvent) {\n const keyCode = event.keyCode;\n\n switch (keyCode) {\n case ESCAPE:\n if (!hasModifierKey(event)) {\n event.preventDefault();\n this.closed.emit('keydown');\n }\n break;\n }\n }\n\n /** Close popover on click if `closeOnPanelClick` is true. */\n _handleClick() {\n if (this.closeOnPanelClick) {\n this.closed.emit('click');\n }\n }\n\n /** Disables close of popover when leaving trigger element and mouse over the popover. */\n _handleMouseOver() {\n if (this.triggerEvent === 'hover') {\n this.closeDisabled = true;\n }\n }\n\n /** Enables close of popover when mouse leaving popover element. */\n _handleMouseLeave() {\n if (this.triggerEvent === 'hover') {\n setTimeout(() => {\n this.closeDisabled = false;\n this.closed.emit();\n }, this.leaveDelay);\n }\n }\n\n /** Sets the current styles for the popover to allow for dynamically changing settings. */\n setCurrentStyles(pos = this.position) {\n const left =\n pos[1] === 'after'\n ? `${this.arrowOffsetX - this.arrowWidth / 2}px`\n : pos[1] === 'center'\n ? `calc(50% - ${this.arrowWidth / 2}px)`\n : '';\n const right = pos[1] === 'before' ? `${this.arrowOffsetX - this.arrowWidth / 2}px` : '';\n\n const bottom =\n pos[1] === 'above'\n ? `${this.arrowOffsetY - this.arrowHeight / 2}px`\n : pos[1] === 'center'\n ? `calc(50% - ${this.arrowHeight / 2}px)`\n : '';\n const top = pos[1] === 'below' ? `${this.arrowOffsetY - this.arrowHeight / 2}px` : '';\n\n this.arrowStyles =\n pos[0] === 'above' || pos[0] === 'below'\n ? {\n left: this.direction === 'ltr' ? left : right,\n right: this.direction === 'ltr' ? right : left,\n }\n : { top, bottom };\n }\n\n /**\n * It's necessary to set position-based classes to ensure the popover panel animation\n * folds out from the correct direction.\n */\n setPositionClasses(pos = this.position): void {\n this._classList = {\n ...this._classList,\n ['mtx-popover-before-above']: pos[0] === 'before' && pos[1] === 'above',\n ['mtx-popover-before-center']: pos[0] === 'before' && pos[1] === 'center',\n ['mtx-popover-before-below']: pos[0] === 'before' && pos[1] === 'below',\n ['mtx-popover-after-above']: pos[0] === 'after' && pos[1] === 'above',\n ['mtx-popover-after-center']: pos[0] === 'after' && pos[1] === 'center',\n ['mtx-popover-after-below']: pos[0] === 'after' && pos[1] === 'below',\n ['mtx-popover-above-before']: pos[0] === 'above' && pos[1] === 'before',\n ['mtx-popover-above-center']: pos[0] === 'above' && pos[1] === 'center',\n ['mtx-popover-above-after']: pos[0] === 'above' && pos[1] === 'after',\n ['mtx-popover-below-before']: pos[0] === 'below' && pos[1] === 'before',\n ['mtx-popover-below-center']: pos[0] === 'below' && pos[1] === 'center',\n ['mtx-popover-below-after']: pos[0] === 'below' && pos[1] === 'after',\n };\n\n this._changeDetectorRef.markForCheck();\n }\n\n /** Sets the popover-panel's elevation. */\n setElevation(): void {\n // The base elevation depends on which version of the spec\n // we're running so we have to resolve it at runtime.\n if (this._baseElevation === null) {\n const styles =\n typeof getComputedStyle === 'function'\n ? getComputedStyle(this._elementRef.nativeElement)\n : null;\n const value = styles?.getPropertyValue('--mtx-popover-base-elevation-level') || '8';\n this._baseElevation = parseInt(value);\n }\n\n // The elevation starts at the base and increases by one for each level.\n // Capped at 24 because that's the maximum elevation defined in the Material design spec.\n const elevation = Math.min(this._baseElevation, 24);\n const newElevation = `${this._elevationPrefix}${elevation}`;\n const customElevation = Object.keys(this._classList).find(className => {\n return className.startsWith(this._elevationPrefix);\n });\n if (!customElevation || customElevation === this._previousElevation) {\n const newClassList = { ...this._classList };\n if (this._previousElevation) {\n newClassList[this._previousElevation] = false;\n }\n newClassList[newElevation] = true;\n this._previousElevation = newElevation;\n this._classList = newClassList;\n }\n }\n\n /** Callback that is invoked when the panel animation completes. */\n protected _onAnimationDone(state: string) {\n const isExit = state === EXIT_ANIMATION;\n\n if (isExit || state === ENTER_ANIMATION) {\n if (isExit) {\n clearTimeout(this._exitFallbackTimeout);\n this._exitFallbackTimeout = undefined;\n }\n this._animationDone.next(isExit ? 'void' : 'enter');\n this._isAnimating = false;\n }\n }\n\n protected _onAnimationStart(state: string) {\n if (state === ENTER_ANIMATION || state === EXIT_ANIMATION) {\n this._isAnimating = true;\n }\n }\n\n _setIsOpen(isOpen: boolean) {\n this._panelAnimationState = isOpen ? 'enter' : 'void';\n\n if (isOpen) {\n //\n } else if (!this._animationsDisabled) {\n // Some apps do `* { animation: none !important; }` in tests which will prevent the\n // `animationend` event from firing. Since the exit animation is loading-bearing for\n // removing the content from the DOM, add a fallback timer.\n this._exitFallbackTimeout = setTimeout(() => this._onAnimationDone(EXIT_ANIMATION), 200);\n }\n\n // Animation events won't fire when animations are disabled so we simulate them.\n if (this._animationsDisabled) {\n setTimeout(() => {\n this._onAnimationDone(isOpen ? ENTER_ANIMATION : EXIT_ANIMATION);\n });\n }\n\n this._changeDetectorRef.markForCheck();\n }\n}\n","<ng-template>\n <!-- eslint-disable @angular-eslint/template/mouse-events-have-key-events -->\n <div\n [id]=\"panelId\"\n class=\"mtx-popover-panel\"\n [class]=\"_classList\"\n [class.mtx-popover-panel-animations-disabled]=\"_animationsDisabled\"\n [class.mtx-popover-panel-exit-animation]=\"_panelAnimationState === 'void'\"\n [class.mtx-popover-panel-animating]=\"_isAnimating\"\n [class.mtx-popover-panel-without-arrow]=\"hideArrow\"\n (keydown)=\"_handleKeydown($event)\"\n (click)=\"_handleClick()\"\n (mouseover)=\"_handleMouseOver()\"\n (mouseleave)=\"_handleMouseLeave()\"\n tabindex=\"-1\"\n role=\"dialog\"\n (animationstart)=\"_onAnimationStart($event.animationName)\"\n (animationend)=\"_onAnimationDone($event.animationName)\"\n (animationcancel)=\"_onAnimationDone($event.animationName)\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"ariaLabelledby || null\"\n [attr.aria-describedby]=\"ariaDescribedby || null\"\n [cdkTrapFocus]=\"focusTrapEnabled\"\n [cdkTrapFocusAutoCapture]=\"focusTrapAutoCaptureEnabled\"\n >\n <div class=\"mtx-popover-content\">\n <ng-content></ng-content>\n </div>\n @if (!hideArrow) {\n <div class=\"mtx-popover-direction-arrow\" [style]=\"arrowStyles\"></div>\n }\n </div>\n</ng-template>\n","import { Directive, ElementRef, inject } from '@angular/core';\n\n@Directive({\n selector: 'mtx-popover-target, [mtxPopoverTarget]',\n exportAs: 'mtxPopoverTarget',\n})\nexport class MtxPopoverTarget {\n elementRef = inject(ElementRef);\n}\n","import { FocusMonitor, FocusOrigin, isFakeMousedownFromScreenReader } from '@angular/cdk/a11y';\nimport { Direction, Directionality } from '@angular/cdk/bidi';\nimport { ENTER, SPACE } from '@angular/cdk/keycodes';\nimport {\n ConnectedPosition,\n FlexibleConnectedPositionStrategy,\n HorizontalConnectionPos,\n Overlay,\n OverlayConfig,\n OverlayRef,\n ScrollStrategy,\n VerticalConnectionPos,\n} from '@angular/cdk/overlay';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport {\n AfterContentInit,\n ChangeDetectorRef,\n Directive,\n ElementRef,\n EventEmitter,\n InjectionToken,\n Input,\n OnDestroy,\n Output,\n ViewContainerRef,\n inject,\n} from '@angular/core';\nimport { merge, of as observableOf, Subscription } from 'rxjs';\nimport { filter, take, takeUntil } from 'rxjs/operators';\nimport { MtxPopover } from './popover';\nimport { throwMtxPopoverMissingError } from './popover-errors';\nimport { MtxPopoverPanel } from './popover-interfaces';\nimport { MtxPopoverTarget } from './popover-target';\nimport {\n MtxPopoverPosition,\n MtxPopoverPositionStart,\n MtxPopoverTriggerEvent,\n PopoverCloseReason,\n} from './popover-types';\n\n/** Injection token that determines the scroll handling while the popover is open. */\nexport const MTX_POPOVER_SCROLL_STRATEGY = new InjectionToken<() => ScrollStrategy>(\n 'mtx-popover-scroll-strategy',\n {\n providedIn: 'root',\n factory: () => {\n const overlay = inject(Overlay);\n return () => overlay.scrollStrategies.reposition();\n },\n }\n);\n\n/**\n * This directive is intended to be used in conjunction with an `mtx-popover` tag. It is\n * responsible for toggling the display of the provided popover instance.\n */\n@Directive({\n selector: '[mtx-popover-trigger-for], [mtxPopoverTriggerFor]',\n exportAs: 'mtxPopoverTrigger',\n host: {\n 'aria-haspopup': 'true',\n '[attr.aria-expanded]': 'popoverOpen',\n '[attr.aria-controls]': 'popoverOpen ? popover.panelId : null',\n '(click)': '_handleClick($event)',\n '(mouseenter)': '_handleMouseEnter($event)',\n '(mouseleave)': '_handleMouseLeave($event)',\n '(mousedown)': '_handleMousedown($event)',\n '(keydown)': '_handleKeydown($event)',\n },\n})\nexport class MtxPopoverTrigger implements AfterContentInit, OnDestroy {\n private _overlay = inject(Overlay);\n private _elementRef = inject<ElementRef<HTMLElement>>(ElementRef);\n private _viewContainerRef = inject(ViewContainerRef);\n private _dir = inject(Directionality, { optional: true });\n private _changeDetectorRef = inject(ChangeDetectorRef);\n private _focusMonitor = inject(FocusMonitor);\n\n private _portal?: TemplatePortal;\n private _overlayRef: OverlayRef | null = null;\n private _popoverOpen = false;\n private _halt = false;\n private _positionSubscription = Subscription.EMPTY;\n private _popoverCloseSubscription = Subscription.EMPTY;\n private _pendingRemoval: Subscription | undefined;\n private _closingActionsSubscription = Subscription.EMPTY;\n private _scrollStrategy = inject(MTX_POPOVER_SCROLL_STRATEGY);\n private _mouseoverTimer: any;\n\n // Tracking input type is necessary so it's possible to only auto-focus\n // the first item of the list when the popover is opened via the keyboard\n _openedBy: Exclude<FocusOrigin, 'program' | null> | undefined = undefined;\n\n /** References the popover instance that the trigger is associated with. */\n @Input('mtxPopoverTriggerFor')\n get popover() {\n return this._popover;\n }\n set popover(popover: MtxPopoverPanel) {\n if (popover === this._popover) {\n return;\n }\n\n this._popover = popover;\n this._popoverCloseSubscription.unsubscribe();\n\n if (popover) {\n this._popoverCloseSubscription = popover.closed.subscribe((reason: PopoverCloseReason) => {\n this._destroyPopover(reason);\n });\n }\n }\n private _popover!: MtxPopoverPanel;\n\n /** Data to be passed along to any lazily-rendered content. */\n @Input('mtxPopoverTriggerData') popoverData: any;\n\n /** References the popover target instance that the trigger is associated with. */\n @Input('mtxPopoverTargetAt') targetElement?: MtxPopoverTarget;\n\n /** Popover trigger event */\n @Input('mtxPopoverTriggerOn') triggerEvent?: MtxPopoverTriggerEvent;\n\n /** Event emitted when the associated popover is opened. */\n @Output() popoverOpened = new EventEmitter<void>();\n\n /** Event emitted when the associated popover is closed. */\n @Output() popoverClosed = new EventEmitter<void>();\n\n ngAfterContentInit() {\n this._checkPopover();\n this._setCurrentConfig();\n }\n\n ngOnDestroy() {\n this._halt = true;\n this._positionSubscription.unsubscribe();\n this._pendingRemoval?.unsubscribe();\n this._popoverCloseSubscription.unsubscribe();\n this._closingActionsSubscription.unsubscribe();\n\n if (this._overlayRef) {\n this._overlayRef.dispose();\n this._overlayRef = null;\n }\n }\n\n private _setCurrentConfig() {\n if (this.triggerEvent) {\n this.popover.triggerEvent = this.triggerEvent;\n }\n\n this.popover.setCurrentStyles();\n }\n\n /** Whether the popover is open. */\n get popoverOpen(): boolean {\n return this._popoverOpen;\n }\n\n /** The text direction of the containing app. */\n get dir(): Direction {\n return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';\n }\n\n /** Handles mouse click on the trigger. */\n _handleClick(event: MouseEvent): void {\n if (this.popover.triggerEvent === 'click') {\n this.togglePopover();\n }\n }\n\n /** Handles mouse enter on the trigger. */\n _handleMouseEnter(event: MouseEvent): void {\n this._halt = false;\n\n if (this.popover.triggerEvent === 'hover') {\n this._mouseoverTimer = setTimeout(() => {\n this.openPopover();\n }, this.popover.enterDelay);\n }\n }\n\n /** Handles mouse leave on the trigger. */\n _handleMouseLeave(event: MouseEvent): void {\n if (this.popover.triggerEvent === 'hover') {\n if (this._mouseoverTimer) {\n clearTimeout(this._mouseoverTimer);\n this._mouseoverTimer = null;\n }\n\n if (this._popoverOpen) {\n setTimeout(() => {\n if (!this.popover.closeDisabled) {\n this.closePopover();\n }\n }, this.popover.leaveDelay);\n } else {\n this._halt = true;\n }\n }\n }\n\n /** Handles mouse presses on the trigger. */\n _handleMousedown(event: MouseEvent): void {\n if (!isFakeMousedownFromScreenReader(event)) {\n // Since right or middle button clicks won't trigger the `click` event,\n // we shouldn't consider the popover as opened by mouse in those cases.\n this._openedBy = event.button === 0 ? 'mouse' : undefined;\n }\n }\n\n /** Handles key presses on the trigger. */\n _handleKeydown(event: KeyboardEvent): void {\n const keyCode = event.keyCode;\n\n // Pressing enter on the trigger will trigger the click handler later.\n if (keyCode === ENTER || keyCode === SPACE) {\n this._openedBy = 'keyboard';\n }\n }\n\n /** Toggles the popover between the open and closed states. */\n togglePopover(): void {\n return this._popoverOpen ? this.closePopover() : this.openPopover();\n }\n\n /** Opens the popover. */\n openPopover(): void {\n if (this._popoverOpen || this._halt) {\n return;\n }\n\n this._checkPopover();\n\n this._pendingRemoval?.unsubscribe();\n\n const overlayRef = this._createOverlay();\n const overlayConfig = overlayRef.getConfig();\n\n this._setPosition(overlayConfig.positionStrategy as FlexibleConnectedPositionStrategy);\n if (this.popover.triggerEvent === 'click') {\n overlayConfig.hasBackdrop = this.popover.hasBackdrop ?? true;\n }\n overlayRef.attach(this._getPortal());\n\n if (this.popover.lazyContent) {\n this.popover.lazyContent.attach(this.popoverData);\n }\n\n this._closingActionsSubscription = this._popoverClosingActions().subscribe(() =>\n this.closePopover()\n );\n this._initPopover();\n\n if (this.popover instanceof MtxPopover) {\n this.popover._setIsOpen(true);\n }\n }\n\n /** Closes the popover. */\n closePopover(): void {\n this.popover.closed.emit();\n }\n\n /**\n * Focuses the popover trigger.\n * @param origin Source of the popover trigger's focus.\n */\n focus(origin?: FocusOrigin, options?: FocusOptions) {\n if (this._focusMonitor && origin) {\n this._focusMonitor.focusVia(this._elementRef, origin, options);\n } else {\n this._elementRef.nativeElement.focus(options);\n }\n }\n\n /** Removes the popover from the DOM. */\n private _destroyPopover(reason: PopoverCloseReason) {\n const overlayRef = this._overlayRef;\n\n if (!overlayRef || !this.popoverOpen) {\n return;\n }\n\n // Clear the timeout for hover event.\n if (this._mouseoverTimer) {\n clearTimeout(this._mouseoverTimer);\n this._mouseoverTimer = null;\n }\n\n const popover = this.popover;\n this._closingActionsSubscription.unsubscribe();\n this._pendingRemoval?.unsubscribe();\n\n overlayRef.detach();\n\n // Note that we don't wait for the animation to finish if another trigger took\n // over the popover, because the panel will end up empty which looks glitchy.\n if (popover instanceof MtxPopover) {\n // Wait for the exit animation to finish before detaching the content.\n this._pendingRemoval = popover._animationDone\n .pipe(\n filter(event => event === 'void'),\n take(1)\n )\n .subscribe(() => {\n popover.lazyContent?.detach();\n });\n } else {\n popover.lazyContent?.detach();\n }\n\n this._openedBy = undefined;\n this._setIsPopoverOpen(false);\n }\n\n /**\n * This method sets the popover state to open.\n */\n private _initPopover(): void {\n this.popover.direction = this.dir;\n this.popover.setElevation();\n this._setIsPopoverOpen(true);\n }\n\n // set state rather than toggle to support triggers sharing a popover\n private _setIsPopoverOpen(isOpen: boolean): void {\n if (isOpen !== this._popoverOpen) {\n this._popoverOpen = isOpen;\n this._popoverOpen ? this.popoverOpened.emit() : this.popoverClosed.emit();\n\n this._changeDetectorRef.markForCheck();\n }\n }\n\n /**\n * This method checks that a valid instance of MdPopover has been passed into\n * `mtxPopoverTriggerFor`. If not, an exception is thrown.\n */\n private _checkPopover() {\n if (!this.popover) {\n throwMtxPopoverMissingError();\n }\n }\n\n /**\n * This method creates the overlay from the provided popover's template and saves its\n * OverlayRef so that it can be attached to the DOM when openPopover is called.\n */\n private _createOverlay(): OverlayRef {\n if (!this._overlayRef) {\n const config = this._getOverlayConfig();\n this._subscribeToPositions(config.positionStrategy as FlexibleConnectedPositionStrategy);\n this._overlayRef = this._overlay.create(config);\n } else {\n const overlayConfig = this._overlayRef.getConfig();\n const positionStrategy = overlayConfig.positionStrategy as FlexibleConnectedPositionStrategy;\n positionStrategy.setOrigin(this._getTargetElement());\n }\n\n return this._overlayRef;\n }\n\n /**\n * This method builds the configuration object needed to create the overlay, the OverlayConfig.\n * @returns OverlayConfig\n */\n private _getOverlayConfig(): OverlayConfig {\n return new OverlayConfig({\n positionStrategy: this._overlay\n .position()\n .flexibleConnectedTo(this._getTargetElement())\n .withLockedPosition()\n .withGrowAfterOpen()\n .withTransformOriginOn('.mtx-popover-panel'),\n backdropClass: this.popover.backdropClass || 'cdk-overlay-transparent-backdrop',\n panelClass: this.popover.overlayPanelClass,\n scrollStrategy: this._scrollStrategy(),\n direction: this._dir || undefined,\n });\n }\n\n private _getTargetElement(): ElementRef<HTMLElement> {\n if (this.targetElement) {\n return this.targetElement.elementRef;\n }\n\n return this._elementRef;\n }\n\n /**\n * Listens to changes in the position of the overlay and sets the correct classes\n * on the popover based on the new position. This ensures the animation origin is always\n * correct, even if a fallback position is used for the overlay.\n */\n private _subscribeToPositions(position: FlexibleConnectedPositionStrategy): void {\n this._positionSubscription = position.positionChanges.subscribe(change => {\n const posX =\n change.connectionPair.overlayX === 'start'\n ? 'after'\n : change.connectionPair.overlayX === 'end'\n ? 'before'\n : 'center';\n const posY =\n change.connectionPair.overlayY === 'top'\n ? 'below'\n : change.connectionPair.overlayY === 'bottom'\n ? 'above'\n : 'center';\n\n const pos: MtxPopoverPosition =\n this.popover.position[0] === 'above' || this.popover.position[0] === 'below'\n ? [posY as MtxPopoverPositionStart, posX]\n : [posX as MtxPopoverPositionStart, posY];\n\n // required for ChangeDetectionStrategy.OnPush\n this._changeDetectorRef.markForCheck();\n\n this.popover.setCurrentStyles(pos);\n this.popover.setPositionClasses(pos);\n });\n }\n\n /**\n * Sets the appropriate positions on a position strategy\n * so the overlay connects with the trigger correctly.\n * @param positionStrategy Strategy whose position to update.\n */\n private _setPosition(positionStrategy: FlexibleConnectedPositionStrategy) {\n const [originX, origin2ndX, origin3rdX]: HorizontalConnectionPos[] =\n this.popover.position[0] === 'before' || this.popover.position[1] === 'after'\n ? ['start', 'center', 'end']\n : this.popover.position[0] === 'after' || this.popover.position[1] === 'before'\n ? ['end', 'center', 'start']\n : ['center', 'start', 'end'];\n\n const [originY, origin2ndY, origin3rdY]: VerticalConnectionPos[] =\n this.popover.position[0] === 'above' || this.popover.position[1] === 'below'\n ? ['top', 'center', 'bottom']\n : this.popover.position[0] === 'below' || this.popover.position[1] === 'above'\n ? ['bottom', 'center', 'top']\n : ['center', 'top', 'bottom'];\n\n const [overlayX, overlayFallbackX]: HorizontalConnectionPos[] =\n this.popover.position[0] === 'below' || this.popover.position[0] === 'above'\n ? [originX, originX]\n : this.popover.position[0] === 'before'\n ? ['end', 'start']\n : ['start', 'end'];\n\n const [overlayY, overlayFallbackY]: VerticalConnectionPos[] =\n this.popover.position[0] === 'before' || this.popover.position[0] === 'after'\n ? [originY, originY]\n : this.popover.position[0] === 'below'\n ? ['top', 'bottom']\n : ['bottom', 'top'];\n\n const originFallbackX = overlayX;\n const originFallbackY = overlayY;\n\n const offsetX =\n this.popover.xOffset && !isNaN(Number(this.popover.xOffset))\n ? Number(this.dir === 'ltr' ? this.popover.xOffset : -this.popover.xOffset)\n : 0;\n const offsetY =\n this.popover.yOffset && !isNaN(Number(this.popover.yOffset))\n ? Number(this.popover.yOffset)\n : 0;\n\n let positions: ConnectedPosition[] = [{ originX, originY, overlayX, overlayY }];\n\n if (this.popover.position[0] === 'above' || this.popover.position[0] === 'below') {\n positions = [\n { originX, originY, overlayX, overlayY, offsetY },\n { originX: origin2ndX, originY, overlayX: origin2ndX, overlayY, offsetY },\n { originX: origin3rdX, originY, overlayX: origin3rdX, overlayY, offsetY },\n {\n originX,\n originY: originFallbackY,\n overlayX,\n overlayY: overlayFallbackY,\n offsetY: -offsetY,\n },\n {\n originX: origin2ndX,\n originY: originFallbackY,\n overlayX: origin2ndX,\n overlayY: overlayFallbackY,\n offsetY: -offsetY,\n },\n {\n originX: origin3rdX,\n originY: originFallbackY,\n overlayX: origin3rdX,\n overlayY: overlayFallbackY,\n offsetY: -offsetY,\n },\n ];\n }\n\n if (this.popover.position[0] === 'before' || this.popover.position[0] === 'after') {\n positions = [\n { originX, originY, overlayX, overlayY, offsetX },\n { originX, originY: origin2ndY, overlayX, overlayY: origin2ndY, offsetX },\n { originX, originY: origin3rdY, overlayX, overlayY: origin3rdY, offsetX },\n {\n originX: originFallbackX,\n originY,\n overlayX: overlayFallbackX,\n overlayY,\n offsetX: -offsetX,\n },\n {\n originX: originFallbackX,\n originY: origin2ndY,\n overlayX: overlayFallbackX,\n overlayY: origin2ndY,\n offsetX: -offsetX,\n },\n {\n originX: originFallbackX,\n originY: origin3rdY,\n overlayX: overlayFallbackX,\n overlayY: origin3rdY,\n offsetX: -offsetX,\n },\n ];\n }\n\n positionStrategy\n .withPositions(positions)\n .withDefaultOffsetX(offsetX)\n .withDefaultOffsetY(offsetY);\n }\n\n /** Returns a stream that emits whenever an action that should close the popover occurs. */\n private _popoverClosingActions() {\n const backdrop =\n this.popover.triggerEvent === 'click' && this.popover.closeOnBackdropClick === true\n ? this._overlayRef!.backdropClick()\n : observableOf();\n const detachments = this._overlayRef!.detachments();\n return merge(backdrop, detachments);\n }\n\n /** Gets the portal that should be attached to the overlay. */\n private _getPortal(): TemplatePortal {\n // Note that we can avoid this check by keeping the portal on the popover panel.\n // While it would be cleaner, we'd have to introduce another required method on\n // `MtxPopoverPanel`, making it harder to consume.\n if (!this._portal || this._portal.templateRef !== this.popover.templateRef) {\n this._portal = new TemplatePortal(this.popover.templateRef, this._viewContainerRef);\n }\n\n return this._portal;\n }\n}\n","import { A11yModule } from '@angular/cdk/a11y';\nimport { OverlayModule } from '@angular/cdk/overlay';\nimport { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { MtxPopover } from './popover';\nimport { MtxPopoverContent } from './popover-content';\nimport { MtxPopoverTarget } from './popover-target';\nimport { MtxPopoverTrigger } from './popover-trigger';\n\n@NgModule({\n imports: [\n CommonModule,\n OverlayModule,\n A11yModule,\n MtxPopover,\n MtxPopoverTrigger,\n MtxPopoverTarget,\n MtxPopoverContent,\n ],\n exports: [MtxPopover, MtxPopoverTrigger, MtxPopoverTarget, MtxPopoverContent],\n})\nexport class MtxPopoverModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["observableOf"],"mappings":";;;;;;;;;;;;AAeA;;;;AAIG;MACU,mBAAmB,GAAG,IAAI,cAAc,CAAoB,mBAAmB;MAGtE,sBAAsB,CAAA;IAO1C,WAAA,CACU,SAA2B,EAC3B,OAAuB,EACvB,SAAmB,EACnB,iBAAmC,EACjB,SAAc,EAChC,kBAAsC,EAAA;QALtC,IAAA,CAAA,SAAS,GAAT,SAAS;QACT,IAAA,CAAA,OAAO,GAAP,OAAO;QACP,IAAA,CAAA,SAAS,GAAT,SAAS;QACT,IAAA,CAAA,iBAAiB,GAAjB,iBAAiB;QACC,IAAA,CAAA,SAAS,GAAT,SAAS;QAC3B,IAAA,CAAA,kBA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