1 | /**
|
2 | * @license
|
3 | * Copyright Google LLC All Rights Reserved.
|
4 | *
|
5 | * Use of this source code is governed by an MIT-style license that can be
|
6 | * found in the LICENSE file at https://angular.io/license
|
7 | */
|
8 | import { Directive, EventEmitter, inject, InjectionToken, Injector, ViewContainerRef, } from '@angular/core';
|
9 | import { MENU_STACK } from './menu-stack';
|
10 | import { TemplatePortal } from '@angular/cdk/portal';
|
11 | import { merge, Subject } from 'rxjs';
|
12 | import * as i0 from "@angular/core";
|
13 | /** Injection token used for an implementation of MenuStack. */
|
14 | export const MENU_TRIGGER = new InjectionToken('cdk-menu-trigger');
|
15 | /**
|
16 | * Abstract directive that implements shared logic common to all menu triggers.
|
17 | * This class can be extended to create custom menu trigger types.
|
18 | */
|
19 | class CdkMenuTriggerBase {
|
20 | constructor() {
|
21 | /** The DI injector for this component. */
|
22 | this.injector = inject(Injector);
|
23 | /** The view container ref for this component */
|
24 | this.viewContainerRef = inject(ViewContainerRef);
|
25 | /** The menu stack in which this menu resides. */
|
26 | this.menuStack = inject(MENU_STACK);
|
27 | /** Emits when the attached menu is requested to open */
|
28 | this.opened = new EventEmitter();
|
29 | /** Emits when the attached menu is requested to close */
|
30 | this.closed = new EventEmitter();
|
31 | /** A reference to the overlay which manages the triggered menu */
|
32 | this.overlayRef = null;
|
33 | /** Emits when this trigger is destroyed. */
|
34 | this.destroyed = new Subject();
|
35 | /** Emits when the outside pointer events listener on the overlay should be stopped. */
|
36 | this.stopOutsideClicksListener = merge(this.closed, this.destroyed);
|
37 | }
|
38 | ngOnDestroy() {
|
39 | this._destroyOverlay();
|
40 | this.destroyed.next();
|
41 | this.destroyed.complete();
|
42 | }
|
43 | /** Whether the attached menu is open. */
|
44 | isOpen() {
|
45 | return !!this.overlayRef?.hasAttached();
|
46 | }
|
47 | /** Registers a child menu as having been opened by this trigger. */
|
48 | registerChildMenu(child) {
|
49 | this.childMenu = child;
|
50 | }
|
51 | /**
|
52 | * Get the portal to be attached to the overlay which contains the menu. Allows for the menu
|
53 | * content to change dynamically and be reflected in the application.
|
54 | */
|
55 | getMenuContentPortal() {
|
56 | const hasMenuContentChanged = this.menuTemplateRef !== this._menuPortal?.templateRef;
|
57 | if (this.menuTemplateRef && (!this._menuPortal || hasMenuContentChanged)) {
|
58 | this._menuPortal = new TemplatePortal(this.menuTemplateRef, this.viewContainerRef, this.menuData, this._getChildMenuInjector());
|
59 | }
|
60 | return this._menuPortal;
|
61 | }
|
62 | /**
|
63 | * Whether the given element is inside the scope of this trigger's menu stack.
|
64 | * @param element The element to check.
|
65 | * @return Whether the element is inside the scope of this trigger's menu stack.
|
66 | */
|
67 | isElementInsideMenuStack(element) {
|
68 | for (let el = element; el; el = el?.parentElement ?? null) {
|
69 | if (el.getAttribute('data-cdk-menu-stack-id') === this.menuStack.id) {
|
70 | return true;
|
71 | }
|
72 | }
|
73 | return false;
|
74 | }
|
75 | /** Destroy and unset the overlay reference it if exists */
|
76 | _destroyOverlay() {
|
77 | if (this.overlayRef) {
|
78 | this.overlayRef.dispose();
|
79 | this.overlayRef = null;
|
80 | }
|
81 | }
|
82 | /** Gets the injector to use when creating a child menu. */
|
83 | _getChildMenuInjector() {
|
84 | this._childMenuInjector =
|
85 | this._childMenuInjector ||
|
86 | Injector.create({
|
87 | providers: [
|
88 | { provide: MENU_TRIGGER, useValue: this },
|
89 | { provide: MENU_STACK, useValue: this.menuStack },
|
90 | ],
|
91 | parent: this.injector,
|
92 | });
|
93 | return this._childMenuInjector;
|
94 | }
|
95 | static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkMenuTriggerBase, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
96 | static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: CdkMenuTriggerBase, host: { properties: { "attr.aria-controls": "childMenu?.id", "attr.data-cdk-menu-stack-id": "menuStack.id" } }, ngImport: i0 }); }
|
97 | }
|
98 | export { CdkMenuTriggerBase };
|
99 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: CdkMenuTriggerBase, decorators: [{
|
100 | type: Directive,
|
101 | args: [{
|
102 | host: {
|
103 | '[attr.aria-controls]': 'childMenu?.id',
|
104 | '[attr.data-cdk-menu-stack-id]': 'menuStack.id',
|
105 | },
|
106 | }]
|
107 | }] });
|
108 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVudS10cmlnZ2VyLWJhc2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvY2RrL21lbnUvbWVudS10cmlnZ2VyLWJhc2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUNMLFNBQVMsRUFDVCxZQUFZLEVBQ1osTUFBTSxFQUNOLGNBQWMsRUFDZCxRQUFRLEVBR1IsZ0JBQWdCLEdBQ2pCLE1BQU0sZUFBZSxDQUFDO0FBRXZCLE9BQU8sRUFBQyxVQUFVLEVBQVksTUFBTSxjQUFjLENBQUM7QUFFbkQsT0FBTyxFQUFDLGNBQWMsRUFBQyxNQUFNLHFCQUFxQixDQUFDO0FBQ25ELE9BQU8sRUFBQyxLQUFLLEVBQUUsT0FBTyxFQUFDLE1BQU0sTUFBTSxDQUFDOztBQUVwQywrREFBK0Q7QUFDL0QsTUFBTSxDQUFDLE1BQU0sWUFBWSxHQUFHLElBQUksY0FBYyxDQUFxQixrQkFBa0IsQ0FBQyxDQUFDO0FBRXZGOzs7R0FHRztBQUNILE1BTXNCLGtCQUFrQjtJQU54QztRQU9FLDBDQUEwQztRQUNqQyxhQUFRLEdBQUcsTUFBTSxDQUFDLFFBQVEsQ0FBQyxDQUFDO1FBRXJDLGdEQUFnRDtRQUM3QixxQkFBZ0IsR0FBRyxNQUFNLENBQUMsZ0JBQWdCLENBQUMs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