@angular/cdk-experimental 14.0.0-next.4 → 14.0.0-next.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/esm2020/column-resize/column-resize-directives/column-resize-flex.mjs +4 -4
  2. package/esm2020/column-resize/column-resize-directives/column-resize.mjs +4 -4
  3. package/esm2020/column-resize/column-resize-directives/default-enabled-column-resize-flex.mjs +4 -4
  4. package/esm2020/column-resize/column-resize-directives/default-enabled-column-resize.mjs +4 -4
  5. package/esm2020/column-resize/column-resize-module.mjs +9 -9
  6. package/esm2020/column-resize/column-resize-notifier.mjs +7 -7
  7. package/esm2020/column-resize/column-resize.mjs +4 -4
  8. package/esm2020/column-resize/column-size-store.mjs +4 -4
  9. package/esm2020/column-resize/event-dispatcher.mjs +4 -4
  10. package/esm2020/column-resize/overlay-handle.mjs +4 -4
  11. package/esm2020/column-resize/resizable.mjs +4 -4
  12. package/esm2020/column-resize/resize-strategy.mjs +10 -10
  13. package/esm2020/combobox/combobox-module.mjs +5 -5
  14. package/esm2020/combobox/combobox-panel.mjs +4 -4
  15. package/esm2020/combobox/combobox-popup.mjs +4 -4
  16. package/esm2020/combobox/combobox.mjs +4 -4
  17. package/esm2020/dialog/dialog-container.mjs +21 -9
  18. package/esm2020/dialog/dialog-module.mjs +5 -5
  19. package/esm2020/dialog/dialog.mjs +4 -4
  20. package/esm2020/listbox/listbox-module.mjs +5 -5
  21. package/esm2020/listbox/listbox.mjs +7 -7
  22. package/esm2020/menu/context-menu.mjs +36 -56
  23. package/esm2020/menu/menu-aim.mjs +7 -7
  24. package/esm2020/menu/menu-bar.mjs +16 -13
  25. package/esm2020/menu/menu-errors.mjs +1 -9
  26. package/esm2020/menu/menu-group.mjs +4 -4
  27. package/esm2020/menu/menu-item-checkbox.mjs +4 -4
  28. package/esm2020/menu/menu-item-radio.mjs +15 -8
  29. package/esm2020/menu/menu-item-selectable.mjs +4 -4
  30. package/esm2020/menu/menu-item-trigger.mjs +55 -73
  31. package/esm2020/menu/menu-item.mjs +26 -25
  32. package/esm2020/menu/menu-module.mjs +5 -9
  33. package/esm2020/menu/menu-stack.mjs +10 -6
  34. package/esm2020/menu/menu-trigger.mjs +43 -0
  35. package/esm2020/menu/menu.mjs +32 -45
  36. package/esm2020/menu/public-api.mjs +3 -3
  37. package/esm2020/popover-edit/edit-event-dispatcher.mjs +4 -4
  38. package/esm2020/popover-edit/edit-ref.mjs +4 -4
  39. package/esm2020/popover-edit/edit-services.mjs +4 -4
  40. package/esm2020/popover-edit/focus-dispatcher.mjs +4 -4
  41. package/esm2020/popover-edit/focus-escape-notifier.mjs +4 -4
  42. package/esm2020/popover-edit/lens-directives.mjs +10 -10
  43. package/esm2020/popover-edit/popover-edit-module.mjs +5 -5
  44. package/esm2020/popover-edit/popover-edit-position-strategy-factory.mjs +7 -7
  45. package/esm2020/popover-edit/table-directives.mjs +16 -16
  46. package/esm2020/scrolling/auto-size-virtual-scroll.mjs +4 -4
  47. package/esm2020/scrolling/scrolling-module.mjs +5 -5
  48. package/esm2020/selection/row-selection.mjs +4 -4
  49. package/esm2020/selection/select-all.mjs +4 -4
  50. package/esm2020/selection/selection-column.mjs +4 -4
  51. package/esm2020/selection/selection-module.mjs +5 -5
  52. package/esm2020/selection/selection-toggle.mjs +4 -4
  53. package/esm2020/selection/selection.mjs +4 -4
  54. package/esm2020/table-scroll-container/table-scroll-container-module.mjs +5 -5
  55. package/esm2020/table-scroll-container/table-scroll-container.mjs +4 -4
  56. package/esm2020/version.mjs +1 -1
  57. package/fesm2015/cdk-experimental.mjs +1 -1
  58. package/fesm2015/cdk-experimental.mjs.map +1 -1
  59. package/fesm2015/column-resize.mjs +50 -50
  60. package/fesm2015/column-resize.mjs.map +1 -1
  61. package/fesm2015/combobox.mjs +13 -13
  62. package/fesm2015/combobox.mjs.map +1 -1
  63. package/fesm2015/dialog.mjs +27 -15
  64. package/fesm2015/dialog.mjs.map +1 -1
  65. package/fesm2015/listbox.mjs +10 -10
  66. package/fesm2015/listbox.mjs.map +1 -1
  67. package/fesm2015/menu.mjs +313 -369
  68. package/fesm2015/menu.mjs.map +1 -1
  69. package/fesm2015/popover-edit.mjs +49 -49
  70. package/fesm2015/popover-edit.mjs.map +1 -1
  71. package/fesm2015/scrolling.mjs +7 -7
  72. package/fesm2015/scrolling.mjs.map +1 -1
  73. package/fesm2015/selection.mjs +19 -19
  74. package/fesm2015/selection.mjs.map +1 -1
  75. package/fesm2015/table-scroll-container.mjs +7 -7
  76. package/fesm2015/table-scroll-container.mjs.map +1 -1
  77. package/fesm2020/cdk-experimental.mjs +1 -1
  78. package/fesm2020/cdk-experimental.mjs.map +1 -1
  79. package/fesm2020/column-resize.mjs +50 -50
  80. package/fesm2020/column-resize.mjs.map +1 -1
  81. package/fesm2020/combobox.mjs +13 -13
  82. package/fesm2020/combobox.mjs.map +1 -1
  83. package/fesm2020/dialog.mjs +27 -15
  84. package/fesm2020/dialog.mjs.map +1 -1
  85. package/fesm2020/listbox.mjs +10 -10
  86. package/fesm2020/listbox.mjs.map +1 -1
  87. package/fesm2020/menu.mjs +218 -269
  88. package/fesm2020/menu.mjs.map +1 -1
  89. package/fesm2020/popover-edit.mjs +49 -49
  90. package/fesm2020/popover-edit.mjs.map +1 -1
  91. package/fesm2020/scrolling.mjs +7 -7
  92. package/fesm2020/scrolling.mjs.map +1 -1
  93. package/fesm2020/selection.mjs +19 -19
  94. package/fesm2020/selection.mjs.map +1 -1
  95. package/fesm2020/table-scroll-container.mjs +7 -7
  96. package/fesm2020/table-scroll-container.mjs.map +1 -1
  97. package/menu/context-menu.d.ts +9 -15
  98. package/menu/menu-bar.d.ts +2 -2
  99. package/menu/menu-errors.d.ts +0 -5
  100. package/menu/menu-item-radio.d.ts +4 -3
  101. package/menu/menu-item-trigger.d.ts +8 -17
  102. package/menu/menu-item.d.ts +5 -5
  103. package/menu/menu-module.d.ts +9 -10
  104. package/menu/menu-stack.d.ts +7 -6
  105. package/menu/menu-trigger.d.ts +24 -0
  106. package/menu/menu.d.ts +7 -23
  107. package/menu/public-api.d.ts +2 -2
  108. package/package.json +3 -3
  109. package/esm2020/menu/menu-panel.mjs +0 -37
  110. package/menu/menu-panel.d.ts +0 -30
@@ -5,11 +5,12 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- import { EventEmitter, InjectionToken, OnDestroy, ViewContainerRef } from '@angular/core';
8
+ import { EventEmitter, InjectionToken, Injector, OnDestroy, ViewContainerRef } from '@angular/core';
9
9
  import { Directionality } from '@angular/cdk/bidi';
10
10
  import { Overlay } from '@angular/cdk/overlay';
11
11
  import { BooleanInput } from '@angular/cdk/coercion';
12
- import { CdkMenuPanel } from './menu-panel';
12
+ import { MenuStack } from './menu-stack';
13
+ import { MenuTrigger } from './menu-trigger';
13
14
  import * as i0 from "@angular/core";
14
15
  /** Tracks the last open context menu trigger across the entire application. */
15
16
  export declare class ContextMenuTracker {
@@ -42,17 +43,14 @@ export declare type ContextMenuCoordinates = {
42
43
  * right-clicks within that element. It is aware of nested Context Menus and the lowest level
43
44
  * non-disabled context menu will trigger.
44
45
  */
45
- export declare class CdkContextMenuTrigger implements OnDestroy {
46
+ export declare class CdkContextMenuTrigger extends MenuTrigger implements OnDestroy {
46
47
  protected readonly _viewContainerRef: ViewContainerRef;
47
48
  private readonly _overlay;
48
49
  private readonly _contextMenuTracker;
49
50
  private readonly _options;
50
51
  private readonly _directionality?;
51
52
  /** Template reference variable to the menu to open on right click. */
52
- get menuPanel(): CdkMenuPanel;
53
- set menuPanel(panel: CdkMenuPanel);
54
- /** Reference to the MenuPanel this trigger toggles. */
55
- private _menuPanel;
53
+ private _menuTemplateRef;
56
54
  /** Emits when the attached menu is requested to open. */
57
55
  readonly opened: EventEmitter<void>;
58
56
  /** Emits when the attached menu is requested to close. */
@@ -64,14 +62,12 @@ export declare class CdkContextMenuTrigger implements OnDestroy {
64
62
  /** A reference to the overlay which manages the triggered menu. */
65
63
  private _overlayRef;
66
64
  /** The content of the menu panel opened by this trigger. */
67
- private _panelContent;
65
+ private _menuPortal;
68
66
  /** Emits when the element is destroyed. */
69
67
  private readonly _destroyed;
70
- /** The menu stack for this trigger and its associated menus. */
71
- private readonly _menuStack;
72
68
  /** Emits when the outside pointer events listener on the overlay should be stopped. */
73
69
  private readonly _stopOutsideClicksListener;
74
- constructor(_viewContainerRef: ViewContainerRef, _overlay: Overlay, _contextMenuTracker: ContextMenuTracker, _options: ContextMenuOptions, _directionality?: Directionality | undefined);
70
+ constructor(injector: Injector, _viewContainerRef: ViewContainerRef, _overlay: Overlay, _contextMenuTracker: ContextMenuTracker, menuStack: MenuStack, _options: ContextMenuOptions, _directionality?: Directionality | undefined);
75
71
  /**
76
72
  * Open the attached menu at the specified location.
77
73
  * @param coordinates where to open the context menu
@@ -116,8 +112,6 @@ export declare class CdkContextMenuTrigger implements OnDestroy {
116
112
  ngOnDestroy(): void;
117
113
  /** Destroy and unset the overlay reference it if exists. */
118
114
  private _destroyOverlay;
119
- /** Set the menu panels menu stack back to null. */
120
- private _resetPanelMenuStack;
121
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkContextMenuTrigger, [null, null, null, null, { optional: true; }]>;
122
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkContextMenuTrigger, "[cdkContextMenuTriggerFor]", ["cdkContextMenuTriggerFor"], { "menuPanel": "cdkContextMenuTriggerFor"; "disabled": "cdkContextMenuDisabled"; }, { "opened": "cdkContextMenuOpened"; "closed": "cdkContextMenuClosed"; }, never>;
115
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkContextMenuTrigger, [null, null, null, null, null, null, { optional: true; }]>;
116
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkContextMenuTrigger, "[cdkContextMenuTriggerFor]", ["cdkContextMenuTriggerFor"], { "_menuTemplateRef": "cdkContextMenuTriggerFor"; "disabled": "cdkContextMenuDisabled"; }, { "opened": "cdkContextMenuOpened"; "closed": "cdkContextMenuClosed"; }, never>;
123
117
  }
@@ -20,9 +20,9 @@ import * as i0 from "@angular/core";
20
20
  *
21
21
  */
22
22
  export declare class CdkMenuBar extends CdkMenuGroup implements Menu, AfterContentInit, OnDestroy {
23
- readonly _menuStack: MenuStack;
24
23
  private readonly _ngZone;
25
24
  readonly _elementRef: ElementRef<HTMLElement>;
25
+ readonly _menuStack: MenuStack;
26
26
  private readonly _menuAim?;
27
27
  private readonly _dir?;
28
28
  /**
@@ -40,7 +40,7 @@ export declare class CdkMenuBar extends CdkMenuGroup implements Menu, AfterConte
40
40
  private readonly _allItems;
41
41
  /** The Menu Item which triggered the open submenu. */
42
42
  private _openItem?;
43
- constructor(_menuStack: MenuStack, _ngZone: NgZone, _elementRef: ElementRef<HTMLElement>, _menuAim?: MenuAim | undefined, _dir?: Directionality | undefined);
43
+ constructor(_ngZone: NgZone, _elementRef: ElementRef<HTMLElement>, _menuStack: MenuStack, _menuAim?: MenuAim | undefined, _dir?: Directionality | undefined);
44
44
  ngAfterContentInit(): void;
45
45
  /** Place focus on the first MenuItem in the menu and set the focus origin. */
46
46
  focusFirstItem(focusOrigin?: FocusOrigin): void;
@@ -5,11 +5,6 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- /**
9
- * Throws an exception when a menu panel already has a menu stack.
10
- * @docs-private
11
- */
12
- export declare function throwExistingMenuStackError(): void;
13
8
  /**
14
9
  * Throws an exception when an instance of the PointerFocusTracker is not provided.
15
10
  * @docs-private
@@ -6,12 +6,13 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import { UniqueSelectionDispatcher } from '@angular/cdk/collections';
9
- import { OnDestroy, ElementRef, NgZone } from '@angular/core';
9
+ import { ElementRef, NgZone, OnDestroy } from '@angular/core';
10
10
  import { Directionality } from '@angular/cdk/bidi';
11
11
  import { CdkMenuItemSelectable } from './menu-item-selectable';
12
12
  import { CdkMenuItemTrigger } from './menu-item-trigger';
13
13
  import { Menu } from './menu-interface';
14
14
  import { MenuAim } from './menu-aim';
15
+ import { MenuStack } from './menu-stack';
15
16
  import * as i0 from "@angular/core";
16
17
  /**
17
18
  * A directive providing behavior for the "menuitemradio" ARIA role, which behaves similarly to
@@ -22,7 +23,7 @@ export declare class CdkMenuItemRadio extends CdkMenuItemSelectable implements O
22
23
  private readonly _selectionDispatcher;
23
24
  /** Function to unregister the selection dispatcher */
24
25
  private _removeDispatcherListener;
25
- constructor(_selectionDispatcher: UniqueSelectionDispatcher, element: ElementRef<HTMLElement>, ngZone: NgZone, parentMenu?: Menu, menuAim?: MenuAim, dir?: Directionality,
26
+ constructor(_selectionDispatcher: UniqueSelectionDispatcher, element: ElementRef<HTMLElement>, ngZone: NgZone, menuStack?: MenuStack, parentMenu?: Menu, menuAim?: MenuAim, dir?: Directionality,
26
27
  /** Reference to the CdkMenuItemTrigger directive if one is added to the same element */
27
28
  menuTrigger?: CdkMenuItemTrigger);
28
29
  /** Configure the unique selection dispatcher listener in order to toggle the checked state */
@@ -30,6 +31,6 @@ export declare class CdkMenuItemRadio extends CdkMenuItemSelectable implements O
30
31
  /** Toggles the checked state of the radio-button. */
31
32
  trigger(): void;
32
33
  ngOnDestroy(): void;
33
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuItemRadio, [null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; self: true; }]>;
34
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuItemRadio, [null, null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; self: true; }]>;
34
35
  static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuItemRadio, "[cdkMenuItemRadio]", ["cdkMenuItemRadio"], {}, {}, never>;
35
36
  }
@@ -5,13 +5,13 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- import { EventEmitter, ElementRef, ViewContainerRef, OnDestroy, NgZone } from '@angular/core';
8
+ import { ElementRef, EventEmitter, Injector, NgZone, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';
9
9
  import { Directionality } from '@angular/cdk/bidi';
10
10
  import { Overlay } from '@angular/cdk/overlay';
11
- import { CdkMenuPanel } from './menu-panel';
12
11
  import { Menu } from './menu-interface';
13
12
  import { MenuStack } from './menu-stack';
14
13
  import { MenuAim } from './menu-aim';
14
+ import { MenuTrigger } from './menu-trigger';
15
15
  import * as i0 from "@angular/core";
16
16
  /**
17
17
  * Whether the target element is a menu item to be ignored by the overlay background click handler.
@@ -26,7 +26,7 @@ export declare function isClickInsideMenuOverlay(target: Element): boolean;
26
26
  * The directive must be placed along with the `cdkMenuItem` directive in order to enable full
27
27
  * functionality.
28
28
  */
29
- export declare class CdkMenuItemTrigger implements OnDestroy {
29
+ export declare class CdkMenuItemTrigger extends MenuTrigger implements OnDestroy {
30
30
  private readonly _elementRef;
31
31
  protected readonly _viewContainerRef: ViewContainerRef;
32
32
  private readonly _overlay;
@@ -35,25 +35,20 @@ export declare class CdkMenuItemTrigger implements OnDestroy {
35
35
  private readonly _menuAim?;
36
36
  private readonly _directionality?;
37
37
  /** Template reference variable to the menu this trigger opens */
38
- get menuPanel(): CdkMenuPanel | undefined;
39
- set menuPanel(panel: CdkMenuPanel | undefined);
40
- /** Reference to the MenuPanel this trigger toggles. */
41
- private _menuPanel?;
38
+ _menuTemplateRef?: TemplateRef<unknown>;
42
39
  /** Emits when the attached menu is requested to open */
43
40
  readonly opened: EventEmitter<void>;
44
41
  /** Emits when the attached menu is requested to close */
45
42
  readonly closed: EventEmitter<void>;
46
- /** The menu stack for this trigger and its sub-menus. */
47
- _menuStack: MenuStack;
48
43
  /** A reference to the overlay which manages the triggered menu */
49
44
  private _overlayRef;
50
45
  /** The content of the menu panel opened by this trigger. */
51
- private _panelContent;
46
+ private _menuPortal;
52
47
  /** Emits when this trigger is destroyed. */
53
48
  private readonly _destroyed;
54
49
  /** Emits when the outside pointer events listener on the overlay should be stopped. */
55
50
  private readonly _stopOutsideClicksListener;
56
- constructor(_elementRef: ElementRef<HTMLElement>, _viewContainerRef: ViewContainerRef, _overlay: Overlay, _ngZone: NgZone, _parentMenu?: Menu | undefined, _menuAim?: MenuAim | undefined, _directionality?: Directionality | undefined);
51
+ constructor(injector: Injector, _elementRef: ElementRef<HTMLElement>, _viewContainerRef: ViewContainerRef, _overlay: Overlay, _ngZone: NgZone, menuStack: MenuStack, _parentMenu?: Menu | undefined, _menuAim?: MenuAim | undefined, _directionality?: Directionality | undefined);
57
52
  /** Open/close the attached menu if the trigger has been configured with one */
58
53
  toggle(): void;
59
54
  /** Open the attached menu. */
@@ -102,11 +97,7 @@ export declare class CdkMenuItemTrigger implements OnDestroy {
102
97
  * this triggers when requested.
103
98
  */
104
99
  private _registerCloseHandler;
105
- /** Get the menu stack for this trigger - either from the parent or this trigger. */
106
- private _getMenuStack;
107
100
  ngOnDestroy(): void;
108
- /** Set the menu panels menu stack back to null. */
109
- private _resetPanelMenuStack;
110
101
  /**
111
102
  * Subscribe to the overlays outside pointer events stream and handle closing out the stack if a
112
103
  * click occurs outside the menus.
@@ -114,6 +105,6 @@ export declare class CdkMenuItemTrigger implements OnDestroy {
114
105
  private _subscribeToOutsideClicks;
115
106
  /** Destroy and unset the overlay reference it if exists */
116
107
  private _destroyOverlay;
117
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuItemTrigger, [null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }]>;
118
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuItemTrigger, "[cdkMenuTriggerFor]", ["cdkMenuTriggerFor"], { "menuPanel": "cdkMenuTriggerFor"; }, { "opened": "cdkMenuOpened"; "closed": "cdkMenuClosed"; }, never>;
108
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuItemTrigger, [null, null, null, null, null, null, { optional: true; }, { optional: true; }, { optional: true; }]>;
109
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuItemTrigger, "[cdkMenuTriggerFor]", ["cdkMenuTriggerFor"], { "_menuTemplateRef": "cdkMenuTriggerFor"; }, { "opened": "cdkMenuOpened"; "closed": "cdkMenuClosed"; }, never>;
119
110
  }
@@ -11,8 +11,9 @@ import { FocusableOption } from '@angular/cdk/a11y';
11
11
  import { Directionality } from '@angular/cdk/bidi';
12
12
  import { CdkMenuItemTrigger } from './menu-item-trigger';
13
13
  import { Menu } from './menu-interface';
14
+ import { MenuStack } from './menu-stack';
14
15
  import { FocusableElement } from './pointer-focus-tracker';
15
- import { Toggler, MenuAim } from './menu-aim';
16
+ import { MenuAim, Toggler } from './menu-aim';
16
17
  import * as i0 from "@angular/core";
17
18
  /**
18
19
  * Directive which provides the ability for an element to be focused and navigated to using the
@@ -22,6 +23,7 @@ import * as i0 from "@angular/core";
22
23
  export declare class CdkMenuItem implements FocusableOption, FocusableElement, Toggler, OnDestroy {
23
24
  readonly _elementRef: ElementRef<HTMLElement>;
24
25
  private readonly _ngZone;
26
+ private readonly _menuStack?;
25
27
  private readonly _parentMenu?;
26
28
  private readonly _menuAim?;
27
29
  private readonly _dir?;
@@ -43,7 +45,7 @@ export declare class CdkMenuItem implements FocusableOption, FocusableElement, T
43
45
  _tabindex: 0 | -1;
44
46
  /** Emits when the menu item is destroyed. */
45
47
  private readonly _destroyed;
46
- constructor(_elementRef: ElementRef<HTMLElement>, _ngZone: NgZone, _parentMenu?: Menu | undefined, _menuAim?: MenuAim | undefined, _dir?: Directionality | undefined,
48
+ constructor(_elementRef: ElementRef<HTMLElement>, _ngZone: NgZone, _menuStack?: MenuStack | undefined, _parentMenu?: Menu | undefined, _menuAim?: MenuAim | undefined, _dir?: Directionality | undefined,
47
49
  /** Reference to the CdkMenuItemTrigger directive if one is added to the same element */
48
50
  _menuTrigger?: CdkMenuItemTrigger | undefined);
49
51
  /** Place focus on the element. */
@@ -92,9 +94,7 @@ export declare class CdkMenuItem implements FocusableOption, FocusableElement, T
92
94
  * otherwise or if no parent.
93
95
  */
94
96
  private _isParentVertical;
95
- /** Get the MenuStack from the parent menu. */
96
- private _getMenuStack;
97
97
  ngOnDestroy(): void;
98
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuItem, [null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; self: true; }]>;
98
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuItem, [null, null, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; }, { optional: true; self: true; }]>;
99
99
  static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuItem, "[cdkMenuItem]", ["cdkMenuItem"], { "disabled": "disabled"; }, { "triggered": "cdkMenuItemTriggered"; }, never>;
100
100
  }
@@ -1,17 +1,16 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import * as i1 from "./menu-bar";
3
3
  import * as i2 from "./menu";
4
- import * as i3 from "./menu-panel";
5
- import * as i4 from "./menu-item";
6
- import * as i5 from "./menu-item-radio";
7
- import * as i6 from "./menu-item-checkbox";
8
- import * as i7 from "./menu-item-trigger";
9
- import * as i8 from "./menu-group";
10
- import * as i9 from "./context-menu";
11
- import * as i10 from "./menu-aim";
12
- import * as i11 from "@angular/cdk/overlay";
4
+ import * as i3 from "./menu-item";
5
+ import * as i4 from "./menu-item-radio";
6
+ import * as i5 from "./menu-item-checkbox";
7
+ import * as i6 from "./menu-item-trigger";
8
+ import * as i7 from "./menu-group";
9
+ import * as i8 from "./context-menu";
10
+ import * as i9 from "./menu-aim";
11
+ import * as i10 from "@angular/cdk/overlay";
13
12
  export declare class CdkMenuModule {
14
13
  static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuModule, never>;
15
- static ɵmod: i0.ɵɵNgModuleDeclaration<CdkMenuModule, [typeof i1.CdkMenuBar, typeof i2.CdkMenu, typeof i3.CdkMenuPanel, typeof i4.CdkMenuItem, typeof i5.CdkMenuItemRadio, typeof i6.CdkMenuItemCheckbox, typeof i7.CdkMenuItemTrigger, typeof i8.CdkMenuGroup, typeof i9.CdkContextMenuTrigger, typeof i10.CdkTargetMenuAim], [typeof i11.OverlayModule], [typeof i1.CdkMenuBar, typeof i2.CdkMenu, typeof i3.CdkMenuPanel, typeof i4.CdkMenuItem, typeof i5.CdkMenuItemRadio, typeof i6.CdkMenuItemCheckbox, typeof i7.CdkMenuItemTrigger, typeof i8.CdkMenuGroup, typeof i9.CdkContextMenuTrigger, typeof i10.CdkTargetMenuAim]>;
14
+ static ɵmod: i0.ɵɵNgModuleDeclaration<CdkMenuModule, [typeof i1.CdkMenuBar, typeof i2.CdkMenu, typeof i3.CdkMenuItem, typeof i4.CdkMenuItemRadio, typeof i5.CdkMenuItemCheckbox, typeof i6.CdkMenuItemTrigger, typeof i7.CdkMenuGroup, typeof i8.CdkContextMenuTrigger, typeof i9.CdkTargetMenuAim], [typeof i10.OverlayModule], [typeof i1.CdkMenuBar, typeof i2.CdkMenu, typeof i3.CdkMenuItem, typeof i4.CdkMenuItemRadio, typeof i5.CdkMenuItemCheckbox, typeof i6.CdkMenuItemTrigger, typeof i7.CdkMenuGroup, typeof i8.CdkContextMenuTrigger, typeof i9.CdkTargetMenuAim]>;
16
15
  static ɵinj: i0.ɵɵInjectorDeclaration<CdkMenuModule>;
17
16
  }
@@ -5,7 +5,9 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
+ import { InjectionToken } from '@angular/core';
8
9
  import { Observable } from 'rxjs';
10
+ import * as i0 from "@angular/core";
9
11
  /** Events to emit as specified by the caller once the MenuStack is empty. */
10
12
  export declare const enum FocusNext {
11
13
  nextItem = 0,
@@ -17,8 +19,10 @@ export declare const enum FocusNext {
17
19
  */
18
20
  export interface MenuStackItem {
19
21
  /** A reference to the previous Menus MenuStack instance. */
20
- _menuStack: MenuStack | null;
22
+ _menuStack?: MenuStack;
21
23
  }
24
+ /** Injection token used for an implementation of MenuStack. */
25
+ export declare const MENU_STACK: InjectionToken<MenuStack>;
22
26
  /**
23
27
  * MenuStack allows subscribers to listen for close events (when a MenuStackItem is popped off
24
28
  * of the stack) in order to perform closing actions. Upon the MenuStack being empty it emits
@@ -70,9 +74,6 @@ export declare class MenuStack {
70
74
  length(): number;
71
75
  /** Get the top most element on the stack. */
72
76
  peek(): MenuStackItem | undefined;
73
- }
74
- /** NoopMenuStack is a placeholder MenuStack used for inline menus. */
75
- export declare class NoopMenuStack extends MenuStack {
76
- /** Noop push - does not add elements to the MenuStack. */
77
- push(_: MenuStackItem): void;
77
+ static ɵfac: i0.ɵɵFactoryDeclaration<MenuStack, never>;
78
+ static ɵprov: i0.ɵɵInjectableDeclaration<MenuStack>;
78
79
  }
@@ -0,0 +1,24 @@
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 { InjectionToken, Injector } from '@angular/core';
9
+ import { Menu } from './menu-interface';
10
+ import { MenuStack } from './menu-stack';
11
+ import * as i0 from "@angular/core";
12
+ /** Injection token used for an implementation of MenuStack. */
13
+ export declare const MENU_TRIGGER: InjectionToken<MenuTrigger>;
14
+ export declare class MenuTrigger {
15
+ protected injector: Injector;
16
+ protected menuStack: MenuStack;
17
+ private _childMenuInjector?;
18
+ protected childMenu?: Menu;
19
+ constructor(injector: Injector, menuStack: MenuStack);
20
+ protected getChildMenuInjector(): Injector;
21
+ registerChildMenu(child: Menu): void;
22
+ static ɵfac: i0.ɵɵFactoryDeclaration<MenuTrigger, never>;
23
+ static ɵprov: i0.ɵɵInjectableDeclaration<MenuTrigger>;
24
+ }
package/menu/menu.d.ts CHANGED
@@ -5,14 +5,14 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- import { EventEmitter, AfterContentInit, OnDestroy, OnInit, NgZone, ElementRef } from '@angular/core';
8
+ import { AfterContentInit, ElementRef, EventEmitter, NgZone, OnDestroy, OnInit } from '@angular/core';
9
9
  import { FocusOrigin } from '@angular/cdk/a11y';
10
10
  import { Directionality } from '@angular/cdk/bidi';
11
11
  import { CdkMenuGroup } from './menu-group';
12
- import { CdkMenuPanel } from './menu-panel';
13
12
  import { Menu } from './menu-interface';
14
13
  import { MenuStack } from './menu-stack';
15
14
  import { MenuAim } from './menu-aim';
15
+ import { MenuTrigger } from './menu-trigger';
16
16
  import * as i0 from "@angular/core";
17
17
  /**
18
18
  * Directive which configures the element as a Menu which should contain child elements marked as
@@ -24,9 +24,10 @@ import * as i0 from "@angular/core";
24
24
  export declare class CdkMenu extends CdkMenuGroup implements Menu, AfterContentInit, OnInit, OnDestroy {
25
25
  private readonly _ngZone;
26
26
  readonly _elementRef: ElementRef<HTMLElement>;
27
+ readonly _menuStack?: MenuStack | undefined;
28
+ private _parentTrigger?;
27
29
  private readonly _menuAim?;
28
30
  private readonly _dir?;
29
- private readonly _menuPanel?;
30
31
  /**
31
32
  * Sets the aria-orientation attribute and determines where menus will be opened.
32
33
  * Does not affect styling/layout.
@@ -34,8 +35,6 @@ export declare class CdkMenu extends CdkMenuGroup implements Menu, AfterContentI
34
35
  orientation: 'horizontal' | 'vertical';
35
36
  /** Event emitted when the menu is closed. */
36
37
  readonly closed: EventEmitter<void | 'click' | 'tab' | 'escape'>;
37
- /** Track the Menus making up the open menu stack. */
38
- _menuStack: MenuStack;
39
38
  /** Handles keyboard events for the menu. */
40
39
  private _keyManager;
41
40
  /** Manages items under mouse focus. */
@@ -46,15 +45,7 @@ export declare class CdkMenu extends CdkMenuGroup implements Menu, AfterContentI
46
45
  private readonly _allItems;
47
46
  /** The Menu Item which triggered the open submenu. */
48
47
  private _openItem?;
49
- /**
50
- * A reference to the enclosing parent menu panel.
51
- *
52
- * Required to be set when using ViewEngine since ViewEngine does support injecting a reference to
53
- * the parent directive if the parent directive is placed on an `ng-template`. If using Ivy, the
54
- * injected value will be used over this one.
55
- */
56
- private readonly _explicitPanel?;
57
- constructor(_ngZone: NgZone, _elementRef: ElementRef<HTMLElement>, _menuAim?: MenuAim | undefined, _dir?: Directionality | undefined, _menuPanel?: CdkMenuPanel | undefined);
48
+ constructor(_ngZone: NgZone, _elementRef: ElementRef<HTMLElement>, _menuStack?: MenuStack | undefined, _parentTrigger?: MenuTrigger | undefined, _menuAim?: MenuAim | undefined, _dir?: Directionality | undefined);
58
49
  ngOnInit(): void;
59
50
  ngAfterContentInit(): void;
60
51
  /** Place focus on the first MenuItem in the menu and set the focus origin. */
@@ -63,13 +54,6 @@ export declare class CdkMenu extends CdkMenuGroup implements Menu, AfterContentI
63
54
  focusLastItem(focusOrigin?: FocusOrigin): void;
64
55
  /** Handle keyboard events for the Menu. */
65
56
  _handleKeyEvent(event: KeyboardEvent): void;
66
- /** Register this menu with its enclosing parent menu panel */
67
- private _registerWithParentPanel;
68
- /**
69
- * Get the enclosing CdkMenuPanel defaulting to the injected reference over the developer
70
- * provided reference.
71
- */
72
- private _getMenuPanel;
73
57
  /**
74
58
  * Complete the change emitter if there are any nested MenuGroups or register to complete the
75
59
  * change emitter if a MenuGroup is rendered at some point
@@ -108,6 +92,6 @@ export declare class CdkMenu extends CdkMenuGroup implements Menu, AfterContentI
108
92
  ngOnDestroy(): void;
109
93
  /** Emit and complete the closed event emitter */
110
94
  private _emitClosedEvent;
111
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenu, [null, null, { optional: true; self: true; }, { optional: true; }, { optional: true; }]>;
112
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenu, "[cdkMenu]", ["cdkMenu"], { "orientation": "cdkMenuOrientation"; "_explicitPanel": "cdkMenuPanel"; }, { "closed": "closed"; }, ["_nestedGroups", "_allItems"]>;
95
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenu, [null, null, { optional: true; }, { optional: true; }, { optional: true; self: true; }, { optional: true; }]>;
96
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenu, "[cdkMenu]", ["cdkMenu"], { "orientation": "cdkMenuOrientation"; }, { "closed": "closed"; }, ["_nestedGroups", "_allItems"]>;
113
97
  }
@@ -12,9 +12,9 @@ export * from './menu-item';
12
12
  export * from './menu-item-checkbox';
13
13
  export * from './menu-item-radio';
14
14
  export * from './menu-item-trigger';
15
- export * from './menu-panel';
16
15
  export * from './menu-group';
17
16
  export * from './context-menu';
18
- export { MenuStack, MenuStackItem } from './menu-stack';
17
+ export * from './menu-trigger';
18
+ export { MenuStack, MenuStackItem, MENU_STACK } from './menu-stack';
19
19
  export { CDK_MENU } from './menu-interface';
20
20
  export { TargetMenuAim, MenuAim, MENU_AIM, CdkTargetMenuAim } from './menu-aim';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/cdk-experimental",
3
- "version": "14.0.0-next.4",
3
+ "version": "14.0.0-next.7",
4
4
  "description": "Experimental components for Angular CDK",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,8 +12,8 @@
12
12
  },
13
13
  "homepage": "https://github.com/angular/components#readme",
14
14
  "peerDependencies": {
15
- "@angular/cdk": "14.0.0-next.4",
16
- "@angular/core": "^13.0.0 || ^14.0.0"
15
+ "@angular/cdk": "14.0.0-next.7",
16
+ "@angular/core": "^14.0.0-0 || ^15.0.0"
17
17
  },
18
18
  "dependencies": {
19
19
  "tslib": "^2.3.0"
@@ -1,37 +0,0 @@
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, TemplateRef } from '@angular/core';
9
- import * as i0 from "@angular/core";
10
- /**
11
- * Directive applied to an ng-template which wraps a CdkMenu and provides a reference to the
12
- * child element it wraps which allows for opening of the CdkMenu in an overlay.
13
- */
14
- export class CdkMenuPanel {
15
- constructor(_templateRef) {
16
- this._templateRef = _templateRef;
17
- }
18
- /**
19
- * Set the Menu component on the menu panel. Since we cannot use ContentChild to fetch the
20
- * child Menu component, the child Menu must register its self with the parent MenuPanel.
21
- */
22
- _registerMenu(child) {
23
- this._menu = child;
24
- // The ideal solution would be to affect the CdkMenuPanel injector from the CdkMenuTrigger and
25
- // inject the menu stack reference into the child menu and menu items, however this isn't
26
- // possible at this time.
27
- this._menu._menuStack = this._menuStack;
28
- this._menuStack?.push(child);
29
- }
30
- }
31
- CdkMenuPanel.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuPanel, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
32
- CdkMenuPanel.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.2.0", type: CdkMenuPanel, selector: "ng-template[cdkMenuPanel]", exportAs: ["cdkMenuPanel"], ngImport: i0 });
33
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.0", ngImport: i0, type: CdkMenuPanel, decorators: [{
34
- type: Directive,
35
- args: [{ selector: 'ng-template[cdkMenuPanel]', exportAs: 'cdkMenuPanel' }]
36
- }], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
37
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVudS1wYW5lbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9jZGstZXhwZXJpbWVudGFsL21lbnUvbWVudS1wYW5lbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxPQUFPLEVBQUMsU0FBUyxFQUFFLFdBQVcsRUFBQyxNQUFNLGVBQWUsQ0FBQzs7QUFJckQ7OztHQUdHO0FBRUgsTUFBTSxPQUFPLFlBQVk7SUFPdkIsWUFBcUIsWUFBa0M7UUFBbEMsaUJBQVksR0FBWixZQUFZLENBQXNCO0lBQUcsQ0FBQztJQUUzRDs7O09BR0c7SUFDSCxhQUFhLENBQ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IGlzbid0XG4gICAgLy8gcG9zc2libGUgYXQgdGhpcyB0aW1lLlxuICAgIHRoaXMuX21lbnUuX21lbnVTdGFjayA9IHRoaXMuX21lbnVTdGFjaztcbiAgICB0aGlzLl9tZW51U3RhY2s/LnB1c2goY2hpbGQpO1xuICB9XG59XG4iXX0=
@@ -1,30 +0,0 @@
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 { TemplateRef } from '@angular/core';
9
- import { Menu } from './menu-interface';
10
- import { MenuStack } from './menu-stack';
11
- import * as i0 from "@angular/core";
12
- /**
13
- * Directive applied to an ng-template which wraps a CdkMenu and provides a reference to the
14
- * child element it wraps which allows for opening of the CdkMenu in an overlay.
15
- */
16
- export declare class CdkMenuPanel {
17
- readonly _templateRef: TemplateRef<unknown>;
18
- /** Reference to the child menu component */
19
- _menu?: Menu;
20
- /** Keep track of open Menus. */
21
- _menuStack: MenuStack | null;
22
- constructor(_templateRef: TemplateRef<unknown>);
23
- /**
24
- * Set the Menu component on the menu panel. Since we cannot use ContentChild to fetch the
25
- * child Menu component, the child Menu must register its self with the parent MenuPanel.
26
- */
27
- _registerMenu(child: Menu): void;
28
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkMenuPanel, never>;
29
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkMenuPanel, "ng-template[cdkMenuPanel]", ["cdkMenuPanel"], {}, {}, never>;
30
- }