@angular/cdk-experimental 14.0.0-next.0 → 14.0.0-next.11

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 (143) hide show
  1. package/combobox/combobox-module.d.ts +3 -4
  2. package/combobox/combobox-popup.d.ts +6 -8
  3. package/combobox/combobox.d.ts +15 -18
  4. package/combobox/public-api.d.ts +0 -1
  5. package/dialog/dialog-config.d.ts +74 -40
  6. package/dialog/dialog-container.d.ts +47 -51
  7. package/dialog/dialog-injectors.d.ts +6 -12
  8. package/dialog/dialog-ref.d.ts +45 -38
  9. package/dialog/dialog.d.ts +59 -56
  10. package/esm2020/column-resize/column-resize-directives/column-resize-flex.mjs +4 -4
  11. package/esm2020/column-resize/column-resize-directives/column-resize.mjs +4 -4
  12. package/esm2020/column-resize/column-resize-directives/default-enabled-column-resize-flex.mjs +4 -4
  13. package/esm2020/column-resize/column-resize-directives/default-enabled-column-resize.mjs +4 -4
  14. package/esm2020/column-resize/column-resize-module.mjs +9 -9
  15. package/esm2020/column-resize/column-resize-notifier.mjs +7 -7
  16. package/esm2020/column-resize/column-resize.mjs +6 -6
  17. package/esm2020/column-resize/column-size-store.mjs +4 -4
  18. package/esm2020/column-resize/event-dispatcher.mjs +4 -4
  19. package/esm2020/column-resize/overlay-handle.mjs +4 -4
  20. package/esm2020/column-resize/resizable.mjs +4 -4
  21. package/esm2020/column-resize/resize-strategy.mjs +10 -10
  22. package/esm2020/combobox/combobox-module.mjs +6 -7
  23. package/esm2020/combobox/combobox-popup.mjs +12 -23
  24. package/esm2020/combobox/combobox.mjs +50 -34
  25. package/esm2020/combobox/public-api.mjs +1 -2
  26. package/esm2020/dialog/dialog-config.mjs +33 -22
  27. package/esm2020/dialog/dialog-container.mjs +114 -142
  28. package/esm2020/dialog/dialog-injectors.mjs +6 -10
  29. package/esm2020/dialog/dialog-module.mjs +7 -21
  30. package/esm2020/dialog/dialog-ref.mjs +49 -88
  31. package/esm2020/dialog/dialog.mjs +188 -155
  32. package/esm2020/listbox/listbox-module.mjs +5 -5
  33. package/esm2020/listbox/listbox.mjs +26 -44
  34. package/esm2020/menu/context-menu-trigger.mjs +227 -0
  35. package/esm2020/menu/menu-aim.mjs +24 -19
  36. package/esm2020/menu/menu-bar.mjs +72 -165
  37. package/esm2020/menu/menu-base.mjs +203 -0
  38. package/esm2020/menu/menu-errors.mjs +1 -9
  39. package/esm2020/menu/menu-group.mjs +7 -45
  40. package/esm2020/menu/menu-interface.mjs +1 -1
  41. package/esm2020/menu/menu-item-checkbox.mjs +11 -11
  42. package/esm2020/menu/menu-item-radio.mjs +50 -26
  43. package/esm2020/menu/menu-item-selectable.mjs +18 -33
  44. package/esm2020/menu/menu-item.mjs +133 -88
  45. package/esm2020/menu/menu-module.mjs +12 -14
  46. package/esm2020/menu/menu-stack.mjs +69 -19
  47. package/esm2020/menu/menu-trigger-base.mjs +114 -0
  48. package/esm2020/menu/menu-trigger.mjs +302 -0
  49. package/esm2020/menu/menu.mjs +75 -208
  50. package/esm2020/menu/pointer-focus-tracker.mjs +11 -9
  51. package/esm2020/menu/public-api.mjs +10 -7
  52. package/esm2020/popover-edit/edit-event-dispatcher.mjs +4 -4
  53. package/esm2020/popover-edit/edit-ref.mjs +4 -4
  54. package/esm2020/popover-edit/edit-services.mjs +4 -4
  55. package/esm2020/popover-edit/focus-dispatcher.mjs +4 -4
  56. package/esm2020/popover-edit/focus-escape-notifier.mjs +4 -4
  57. package/esm2020/popover-edit/lens-directives.mjs +10 -10
  58. package/esm2020/popover-edit/polyfill.mjs +3 -21
  59. package/esm2020/popover-edit/popover-edit-module.mjs +5 -5
  60. package/esm2020/popover-edit/popover-edit-position-strategy-factory.mjs +7 -7
  61. package/esm2020/popover-edit/public-api.mjs +2 -2
  62. package/esm2020/popover-edit/table-directives.mjs +16 -16
  63. package/esm2020/scrolling/auto-size-virtual-scroll.mjs +4 -4
  64. package/esm2020/scrolling/scrolling-module.mjs +5 -5
  65. package/esm2020/selection/row-selection.mjs +4 -4
  66. package/esm2020/selection/select-all.mjs +4 -4
  67. package/esm2020/selection/selection-column.mjs +4 -4
  68. package/esm2020/selection/selection-module.mjs +5 -5
  69. package/esm2020/selection/selection-toggle.mjs +4 -4
  70. package/esm2020/selection/selection.mjs +4 -4
  71. package/esm2020/table-scroll-container/table-scroll-container-module.mjs +5 -5
  72. package/esm2020/table-scroll-container/table-scroll-container.mjs +4 -4
  73. package/esm2020/version.mjs +1 -1
  74. package/fesm2015/cdk-experimental.mjs +1 -1
  75. package/fesm2015/cdk-experimental.mjs.map +1 -1
  76. package/fesm2015/column-resize.mjs +52 -52
  77. package/fesm2015/column-resize.mjs.map +1 -1
  78. package/fesm2015/combobox.mjs +63 -106
  79. package/fesm2015/combobox.mjs.map +1 -1
  80. package/fesm2015/dialog.mjs +385 -434
  81. package/fesm2015/dialog.mjs.map +1 -1
  82. package/fesm2015/listbox.mjs +31 -47
  83. package/fesm2015/listbox.mjs.map +1 -1
  84. package/fesm2015/menu.mjs +1118 -1142
  85. package/fesm2015/menu.mjs.map +1 -1
  86. package/fesm2015/popover-edit.mjs +53 -70
  87. package/fesm2015/popover-edit.mjs.map +1 -1
  88. package/fesm2015/scrolling.mjs +7 -7
  89. package/fesm2015/scrolling.mjs.map +1 -1
  90. package/fesm2015/selection.mjs +19 -19
  91. package/fesm2015/selection.mjs.map +1 -1
  92. package/fesm2015/table-scroll-container.mjs +7 -7
  93. package/fesm2015/table-scroll-container.mjs.map +1 -1
  94. package/fesm2020/cdk-experimental.mjs +1 -1
  95. package/fesm2020/cdk-experimental.mjs.map +1 -1
  96. package/fesm2020/column-resize.mjs +52 -52
  97. package/fesm2020/column-resize.mjs.map +1 -1
  98. package/fesm2020/combobox.mjs +62 -103
  99. package/fesm2020/combobox.mjs.map +1 -1
  100. package/fesm2020/dialog.mjs +386 -426
  101. package/fesm2020/dialog.mjs.map +1 -1
  102. package/fesm2020/listbox.mjs +29 -46
  103. package/fesm2020/listbox.mjs.map +1 -1
  104. package/fesm2020/menu.mjs +1045 -1061
  105. package/fesm2020/menu.mjs.map +1 -1
  106. package/fesm2020/popover-edit.mjs +52 -70
  107. package/fesm2020/popover-edit.mjs.map +1 -1
  108. package/fesm2020/scrolling.mjs +7 -7
  109. package/fesm2020/scrolling.mjs.map +1 -1
  110. package/fesm2020/selection.mjs +19 -19
  111. package/fesm2020/selection.mjs.map +1 -1
  112. package/fesm2020/table-scroll-container.mjs +7 -7
  113. package/fesm2020/table-scroll-container.mjs.map +1 -1
  114. package/listbox/listbox.d.ts +16 -13
  115. package/menu/context-menu-trigger.d.ts +98 -0
  116. package/menu/menu-aim.d.ts +20 -9
  117. package/menu/menu-bar.d.ts +24 -60
  118. package/menu/menu-base.d.ts +104 -0
  119. package/menu/menu-errors.d.ts +0 -5
  120. package/menu/menu-group.d.ts +3 -28
  121. package/menu/menu-interface.d.ts +7 -5
  122. package/menu/menu-item-checkbox.d.ts +8 -2
  123. package/menu/menu-item-radio.d.ts +32 -8
  124. package/menu/menu-item-selectable.d.ts +4 -14
  125. package/menu/menu-item.d.ts +64 -24
  126. package/menu/menu-module.d.ts +10 -10
  127. package/menu/menu-stack.d.ts +64 -20
  128. package/menu/menu-trigger-base.d.ts +77 -0
  129. package/menu/menu-trigger.d.ts +104 -0
  130. package/menu/menu.d.ts +34 -87
  131. package/menu/pointer-focus-tracker.d.ts +7 -4
  132. package/menu/public-api.d.ts +9 -6
  133. package/package.json +3 -3
  134. package/popover-edit/polyfill.d.ts +1 -3
  135. package/popover-edit/public-api.d.ts +1 -1
  136. package/combobox/combobox-panel.d.ts +0 -27
  137. package/esm2020/combobox/combobox-panel.mjs +0 -48
  138. package/esm2020/menu/context-menu.mjs +0 -287
  139. package/esm2020/menu/menu-item-trigger.mjs +0 -361
  140. package/esm2020/menu/menu-panel.mjs +0 -37
  141. package/menu/context-menu.d.ts +0 -122
  142. package/menu/menu-item-trigger.d.ts +0 -119
  143. package/menu/menu-panel.d.ts +0 -30
@@ -1,10 +1,9 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import * as i1 from "./combobox";
3
- import * as i2 from "./combobox-panel";
4
- import * as i3 from "./combobox-popup";
5
- import * as i4 from "@angular/cdk/overlay";
3
+ import * as i2 from "./combobox-popup";
4
+ import * as i3 from "@angular/cdk/overlay";
6
5
  export declare class CdkComboboxModule {
7
6
  static ɵfac: i0.ɵɵFactoryDeclaration<CdkComboboxModule, never>;
8
- static ɵmod: i0.ɵɵNgModuleDeclaration<CdkComboboxModule, [typeof i1.CdkCombobox, typeof i2.CdkComboboxPanel, typeof i3.CdkComboboxPopup], [typeof i4.OverlayModule], [typeof i1.CdkCombobox, typeof i2.CdkComboboxPanel, typeof i3.CdkComboboxPopup]>;
7
+ static ɵmod: i0.ɵɵNgModuleDeclaration<CdkComboboxModule, [typeof i1.CdkCombobox, typeof i2.CdkComboboxPopup], [typeof i3.OverlayModule], [typeof i1.CdkCombobox, typeof i2.CdkComboboxPopup]>;
9
8
  static ɵinj: i0.ɵɵInjectorDeclaration<CdkComboboxModule>;
10
9
  }
@@ -5,13 +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 { ElementRef, InjectionToken, OnInit } from '@angular/core';
9
- import { AriaHasPopupValue, CdkComboboxPanel } from './combobox-panel';
8
+ import { ElementRef, OnInit } from '@angular/core';
9
+ import { AriaHasPopupValue, CdkCombobox } from './combobox';
10
10
  import * as i0 from "@angular/core";
11
- export declare const PANEL: InjectionToken<CdkComboboxPanel<unknown>>;
12
11
  export declare class CdkComboboxPopup<T = unknown> implements OnInit {
13
12
  private readonly _elementRef;
14
- readonly _parentPanel?: CdkComboboxPanel<T> | undefined;
13
+ private readonly _combobox;
15
14
  get role(): AriaHasPopupValue;
16
15
  set role(value: AriaHasPopupValue);
17
16
  private _role;
@@ -19,11 +18,10 @@ export declare class CdkComboboxPopup<T = unknown> implements OnInit {
19
18
  set firstFocus(id: HTMLElement);
20
19
  private _firstFocusElement;
21
20
  id: string;
22
- private readonly _explicitPanel;
23
- constructor(_elementRef: ElementRef<HTMLElement>, _parentPanel?: CdkComboboxPanel<T> | undefined);
21
+ constructor(_elementRef: ElementRef<HTMLElement>, _combobox: CdkCombobox);
24
22
  ngOnInit(): void;
25
23
  registerWithPanel(): void;
26
24
  focusFirstElement(): void;
27
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkComboboxPopup<any>, [null, { optional: true; }]>;
28
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkComboboxPopup<any>, "[cdkComboboxPopup]", ["cdkComboboxPopup"], { "role": "role"; "firstFocus": "firstFocus"; "id": "id"; "_explicitPanel": "parentPanel"; }, {}, never>;
25
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkComboboxPopup<any>, never>;
26
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkComboboxPopup<any>, "[cdkComboboxPopup]", ["cdkComboboxPopup"], { "role": "role"; "firstFocus": "firstFocus"; "id": "id"; }, {}, never>;
29
27
  }
@@ -1,26 +1,20 @@
1
- import { AfterContentInit, ElementRef, EventEmitter, OnDestroy, ViewContainerRef } from '@angular/core';
2
- import { CdkComboboxPanel, AriaHasPopupValue } from './combobox-panel';
1
+ import { ElementRef, EventEmitter, InjectionToken, Injector, OnDestroy, TemplateRef, ViewContainerRef } from '@angular/core';
3
2
  import { Overlay } from '@angular/cdk/overlay';
4
3
  import { Directionality } from '@angular/cdk/bidi';
5
4
  import { BooleanInput } from '@angular/cdk/coercion';
6
5
  import * as i0 from "@angular/core";
7
- /**
8
- * @license
9
- * Copyright Google LLC All Rights Reserved.
10
- *
11
- * Use of this source code is governed by an MIT-style license that can be
12
- * found in the LICENSE file at https://angular.io/license
13
- */
6
+ export declare type AriaHasPopupValue = 'false' | 'true' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog';
14
7
  export declare type OpenAction = 'focus' | 'click' | 'downKey' | 'toggle';
15
8
  export declare type OpenActionInput = OpenAction | OpenAction[] | string | null | undefined;
16
- export declare class CdkCombobox<T = unknown> implements OnDestroy, AfterContentInit {
9
+ export declare const CDK_COMBOBOX: InjectionToken<CdkCombobox<unknown>>;
10
+ export declare class CdkCombobox<T = unknown> implements OnDestroy {
17
11
  private readonly _elementRef;
18
12
  private readonly _overlay;
19
13
  protected readonly _viewContainerRef: ViewContainerRef;
14
+ private readonly _injector;
15
+ private readonly _doc;
20
16
  private readonly _directionality?;
21
- get panel(): CdkComboboxPanel<T> | undefined;
22
- set panel(panel: CdkComboboxPanel<T> | undefined);
23
- private _panel;
17
+ _panelTemplateRef: TemplateRef<unknown>;
24
18
  value: T | T[];
25
19
  get disabled(): boolean;
26
20
  set disabled(value: BooleanInput);
@@ -36,11 +30,10 @@ export declare class CdkCombobox<T = unknown> implements OnDestroy, AfterContent
36
30
  readonly closed: EventEmitter<void>;
37
31
  readonly panelValueChanged: EventEmitter<T[]>;
38
32
  private _overlayRef;
39
- private _panelContent;
33
+ private _panelPortal;
40
34
  contentId: string;
41
35
  contentType: AriaHasPopupValue;
42
- constructor(_elementRef: ElementRef<HTMLElement>, _overlay: Overlay, _viewContainerRef: ViewContainerRef, _directionality?: Directionality | undefined);
43
- ngAfterContentInit(): void;
36
+ constructor(_elementRef: ElementRef<HTMLElement>, _overlay: Overlay, _viewContainerRef: ViewContainerRef, _injector: Injector, _doc: any, _directionality?: Directionality | undefined);
44
37
  ngOnDestroy(): void;
45
38
  _keydown(event: KeyboardEvent): void;
46
39
  /** Handles click or focus interactions. */
@@ -59,13 +52,17 @@ export declare class CdkCombobox<T = unknown> implements OnDestroy, AfterContent
59
52
  hasPanel(): boolean;
60
53
  _getTabIndex(): string | null;
61
54
  private _setComboboxValue;
55
+ updateAndClose(value: T | T[]): void;
62
56
  private _setTextContent;
63
57
  private _isTextTrigger;
64
58
  private _getOverlayConfig;
65
59
  private _getOverlayPositionStrategy;
66
60
  private _getOverlayPositions;
61
+ private _getPanelInjector;
67
62
  private _getPanelContent;
68
63
  private _coerceOpenActionProperty;
69
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkCombobox<any>, [null, null, null, { optional: true; }]>;
70
- static ɵdir: i0.ɵɵDirectiveDeclaration<CdkCombobox<any>, "[cdkCombobox]", ["cdkCombobox"], { "panel": "cdkComboboxTriggerFor"; "value": "value"; "disabled": "disabled"; "openActions": "openActions"; "autoSetText": "autoSetText"; }, { "opened": "comboboxPanelOpened"; "closed": "comboboxPanelClosed"; "panelValueChanged": "panelValueChanged"; }, never>;
64
+ /** Registers the content's id and the content type with the panel. */
65
+ _registerContent(contentId: string, contentType: AriaHasPopupValue): void;
66
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkCombobox<any>, [null, null, null, null, null, { optional: true; }]>;
67
+ static ɵdir: i0.ɵɵDirectiveDeclaration<CdkCombobox<any>, "[cdkCombobox]", ["cdkCombobox"], { "_panelTemplateRef": "cdkComboboxTriggerFor"; "value": "value"; "disabled": "disabled"; "openActions": "openActions"; "autoSetText": "autoSetText"; }, { "opened": "comboboxPanelOpened"; "closed": "comboboxPanelClosed"; "panelValueChanged": "panelValueChanged"; }, never>;
71
68
  }
@@ -7,5 +7,4 @@
7
7
  */
8
8
  export * from './combobox-module';
9
9
  export * from './combobox';
10
- export * from './combobox-panel';
11
10
  export * from './combobox-popup';
@@ -5,24 +5,16 @@
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 { ViewContainerRef } from '@angular/core';
8
+ import { ViewContainerRef, ComponentFactoryResolver, Injector, StaticProvider, Type } from '@angular/core';
9
9
  import { Direction } from '@angular/cdk/bidi';
10
- import { ComponentType } from '@angular/cdk/overlay';
11
- import { CdkDialogContainer } from './dialog-container';
10
+ import { PositionStrategy, ScrollStrategy } from '@angular/cdk/overlay';
11
+ import { BasePortalOutlet } from '@angular/cdk/portal';
12
12
  /** Options for where to set focus to automatically on dialog open */
13
13
  export declare type AutoFocusTarget = 'dialog' | 'first-tabbable' | 'first-heading';
14
- /** Valid ARIA roles for a dialog element. */
14
+ /** Valid ARIA roles for a dialog. */
15
15
  export declare type DialogRole = 'dialog' | 'alertdialog';
16
- /** Possible overrides for a dialog's position. */
17
- export interface DialogPosition {
18
- top?: string;
19
- bottom?: string;
20
- left?: string;
21
- right?: string;
22
- }
23
- export declare class DialogConfig<D = any> {
24
- /** Component to use as the container for the dialog. */
25
- containerComponent?: ComponentType<CdkDialogContainer>;
16
+ /** Configuration for opening a modal dialog. */
17
+ export declare class DialogConfig<D = unknown, R = unknown, C extends BasePortalOutlet = BasePortalOutlet> {
26
18
  /**
27
19
  * Where the attached component should live in Angular's *logical* component tree.
28
20
  * This affects what is available for injection and the change detection order for the
@@ -30,48 +22,90 @@ export declare class DialogConfig<D = any> {
30
22
  * content will be rendered.
31
23
  */
32
24
  viewContainerRef?: ViewContainerRef;
33
- /** The id of the dialog. */
25
+ /**
26
+ * Injector used for the instantiation of the component to be attached. If provided,
27
+ * takes precedence over the injector indirectly provided by `ViewContainerRef`.
28
+ */
29
+ injector?: Injector;
30
+ /** ID for the dialog. If omitted, a unique one will be generated. */
34
31
  id?: string;
35
- /** The ARIA role of the dialog. */
32
+ /** The ARIA role of the dialog element. */
36
33
  role?: DialogRole;
37
- /** Custom class(es) for the overlay panel. */
34
+ /** Optional CSS class or classes applied to the overlay panel. */
38
35
  panelClass?: string | string[];
39
- /** Whether the dialog has a background. */
36
+ /** Whether the dialog has a backdrop. */
40
37
  hasBackdrop?: boolean;
41
- /** Custom class(es) for the backdrop. */
42
- backdropClass?: string | undefined;
43
- /** Whether the dialog can be closed by user interaction. */
38
+ /** Optional CSS class or classes applied to the overlay backdrop. */
39
+ backdropClass?: string | string[];
40
+ /** Whether the dialog closes with the escape key or pointer events outside the panel element. */
44
41
  disableClose?: boolean;
45
- /** The width of the dialog. */
42
+ /** Width of the dialog. */
46
43
  width?: string;
47
- /** The height of the dialog. */
44
+ /** Height of the dialog. */
48
45
  height?: string;
49
- /** The minimum width of the dialog. */
50
- minWidth?: string | number;
51
- /** The minimum height of the dialog. */
52
- minHeight?: string | number;
53
- /** The maximum width of the dialog. */
54
- maxWidth?: string | number;
55
- /** The maximum height of the dialog. */
56
- maxHeight?: string | number;
57
- /** The position of the dialog. */
58
- position?: DialogPosition;
59
- /** Data to be injected into the dialog content. */
46
+ /** Min-width of the dialog. If a number is provided, assumes pixel units. */
47
+ minWidth?: number | string;
48
+ /** Min-height of the dialog. If a number is provided, assumes pixel units. */
49
+ minHeight?: number | string;
50
+ /** Max-width of the dialog. If a number is provided, assumes pixel units. Defaults to 80vw. */
51
+ maxWidth?: number | string;
52
+ /** Max-height of the dialog. If a number is provided, assumes pixel units. */
53
+ maxHeight?: number | string;
54
+ /** Strategy to use when positioning the dialog. Defaults to centering it on the page. */
55
+ positionStrategy?: PositionStrategy;
56
+ /** Data being injected into the child component. */
60
57
  data?: D | null;
61
- /** The layout direction for the dialog content. */
58
+ /** Layout direction for the dialog's content. */
62
59
  direction?: Direction;
63
60
  /** ID of the element that describes the dialog. */
64
61
  ariaDescribedBy?: string | null;
65
- /** Aria label to assign to the dialog element */
62
+ /** ID of the element that labels the dialog. */
63
+ ariaLabelledBy?: string | null;
64
+ /** Dialog label applied via `aria-label` */
66
65
  ariaLabel?: string | null;
66
+ /** Whether this a modal dialog. Used to set the `aria-modal` attribute. */
67
+ ariaModal?: boolean;
67
68
  /**
68
69
  * Where the dialog should focus on open.
69
70
  * @breaking-change 14.0.0 Remove boolean option from autoFocus. Use string or
70
71
  * AutoFocusTarget instead.
71
72
  */
72
73
  autoFocus?: AutoFocusTarget | string | boolean;
73
- /** Duration of the enter animation. Has to be a valid CSS value (e.g. 100ms). */
74
- enterAnimationDuration?: string;
75
- /** Duration of the exit animation. Has to be a valid CSS value (e.g. 50ms). */
76
- exitAnimationDuration?: string;
74
+ /**
75
+ * Whether the dialog should restore focus to the
76
+ * previously-focused element upon closing.
77
+ */
78
+ restoreFocus?: boolean;
79
+ /**
80
+ * Scroll strategy to be used for the dialog. This determines how
81
+ * the dialog responds to scrolling underneath the panel element.
82
+ */
83
+ scrollStrategy?: ScrollStrategy;
84
+ /**
85
+ * Whether the dialog should close when the user navigates backwards or forwards through browser
86
+ * history. This does not apply to navigation via anchor element unless using URL-hash based
87
+ * routing (`HashLocationStrategy` in the Angular router).
88
+ */
89
+ closeOnNavigation?: boolean;
90
+ /** Alternate `ComponentFactoryResolver` to use when resolving the associated component. */
91
+ componentFactoryResolver?: ComponentFactoryResolver;
92
+ /**
93
+ * Providers that will be exposed to the contents of the dialog. Can also
94
+ * be provided as a function in order to generate the providers lazily.
95
+ */
96
+ providers?: StaticProvider[] | ((dialogRef: R, config: DialogConfig<D, R, C>, container: C) => StaticProvider[]);
97
+ /**
98
+ * Component into which the dialog content will be rendered. Defaults to `CdkDialogContainer`.
99
+ * A configuration object can be passed in to customize the providers that will be exposed
100
+ * to the dialog container.
101
+ */
102
+ container?: Type<C> | {
103
+ type: Type<C>;
104
+ providers: (config: DialogConfig<D, R, C>) => StaticProvider[];
105
+ };
106
+ /**
107
+ * Context that will be passed to template-based dialogs.
108
+ * A function can be passed in to resolve the context lazily.
109
+ */
110
+ templateContext?: Record<string, any> | (() => Record<string, any>);
77
111
  }
@@ -5,11 +5,10 @@
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 { AnimationEvent } from '@angular/animations';
9
- import { FocusTrapFactory, InteractivityChecker } from '@angular/cdk/a11y';
8
+ import { FocusMonitor, FocusOrigin, FocusTrapFactory, InteractivityChecker } from '@angular/cdk/a11y';
9
+ import { OverlayRef } from '@angular/cdk/overlay';
10
10
  import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, DomPortal, TemplatePortal } from '@angular/cdk/portal';
11
- import { ChangeDetectorRef, ComponentRef, ElementRef, EmbeddedViewRef, NgZone, OnDestroy } from '@angular/core';
12
- import { Subject } from 'rxjs';
11
+ import { AfterViewInit, ComponentRef, ElementRef, EmbeddedViewRef, NgZone, OnDestroy } from '@angular/core';
13
12
  import { DialogConfig } from './dialog-config';
14
13
  import * as i0 from "@angular/core";
15
14
  export declare function throwDialogContentAlreadyAttachedError(): void;
@@ -17,39 +16,36 @@ export declare function throwDialogContentAlreadyAttachedError(): void;
17
16
  * Internal component that wraps user-provided dialog content.
18
17
  * @docs-private
19
18
  */
20
- export declare class CdkDialogContainer extends BasePortalOutlet implements OnDestroy {
21
- private _elementRef;
22
- private _focusTrapFactory;
23
- private _changeDetectorRef;
24
- private readonly _interactivityChecker;
25
- private readonly _ngZone;
26
- /** The dialog configuration. */
27
- _config: DialogConfig;
28
- private readonly _document;
29
- /** State of the dialog animation. */
30
- _state: 'void' | 'enter' | 'exit';
31
- /** Element that was focused before the dialog was opened. Save this to restore upon close. */
32
- private _elementFocusedBeforeDialogWasOpened;
19
+ export declare class CdkDialogContainer<C extends DialogConfig = DialogConfig> extends BasePortalOutlet implements AfterViewInit, OnDestroy {
20
+ protected _elementRef: ElementRef;
21
+ protected _focusTrapFactory: FocusTrapFactory;
22
+ readonly _config: C;
23
+ private _interactivityChecker;
24
+ private _ngZone;
25
+ private _overlayRef;
26
+ private _focusMonitor?;
27
+ protected _document: Document;
28
+ /** The portal outlet inside of this container into which the dialog content will be loaded. */
29
+ _portalOutlet: CdkPortalOutlet;
33
30
  /** The class that traps and manages focus within the dialog. */
34
31
  private _focusTrap;
35
- /** The portal host inside of this container into which the dialog content will be loaded. */
36
- _portalHost: CdkPortalOutlet;
37
- /** A subject emitting before the dialog enters the view. */
38
- readonly _beforeEnter: Subject<void>;
39
- /** A subject emitting after the dialog enters the view. */
40
- readonly _afterEnter: Subject<void>;
41
- /** A subject emitting before the dialog exits the view. */
42
- readonly _beforeExit: Subject<void>;
43
- /** A subject emitting after the dialog exits the view. */
44
- readonly _afterExit: Subject<void>;
45
- /** Stream of animation `done` events. */
46
- readonly _animationDone: Subject<AnimationEvent>;
47
- constructor(_elementRef: ElementRef<HTMLElement>, _focusTrapFactory: FocusTrapFactory, _changeDetectorRef: ChangeDetectorRef, _interactivityChecker: InteractivityChecker, _ngZone: NgZone, _document: any,
48
- /** The dialog configuration. */
49
- _config: DialogConfig);
50
- /** Initializes the dialog container with the attached content. */
51
- _initializeWithAttachedContent(): void;
52
- /** Destroy focus trap to place focus back to the element focused before the dialog opened. */
32
+ /** Element that was focused before the dialog was opened. Save this to restore upon close. */
33
+ private _elementFocusedBeforeDialogWasOpened;
34
+ /**
35
+ * Type of interaction that led to the dialog being closed. This is used to determine
36
+ * whether the focus style will be applied when returning focus to its original location
37
+ * after the dialog is closed.
38
+ */
39
+ _closeInteractionType: FocusOrigin | null;
40
+ /** ID of the element that should be considered as the dialog's label. */
41
+ _ariaLabelledBy: string | null;
42
+ constructor(_elementRef: ElementRef, _focusTrapFactory: FocusTrapFactory, _document: any, _config: C, _interactivityChecker: InteractivityChecker, _ngZone: NgZone, _overlayRef: OverlayRef, _focusMonitor?: FocusMonitor | undefined);
43
+ ngAfterViewInit(): void;
44
+ /**
45
+ * Can be used by child classes to customize the initial focus
46
+ * capturing behavior (e.g. if it's tied to an animation).
47
+ */
48
+ protected _captureInitialFocus(): void;
53
49
  ngOnDestroy(): void;
54
50
  /**
55
51
  * Attach a ComponentPortal as content to this dialog container.
@@ -60,7 +56,7 @@ export declare class CdkDialogContainer extends BasePortalOutlet implements OnDe
60
56
  * Attach a TemplatePortal as content to this dialog container.
61
57
  * @param portal Portal to be attached as the dialog content.
62
58
  */
63
- attachTemplatePortal<C>(portal: TemplatePortal<C>): EmbeddedViewRef<C>;
59
+ attachTemplatePortal<T>(portal: TemplatePortal<T>): EmbeddedViewRef<T>;
64
60
  /**
65
61
  * Attaches a DOM portal to the dialog container.
66
62
  * @param portal Portal to be attached.
@@ -68,14 +64,6 @@ export declare class CdkDialogContainer extends BasePortalOutlet implements OnDe
68
64
  * @breaking-change 10.0.0
69
65
  */
70
66
  attachDomPortal: (portal: DomPortal) => void;
71
- /** Emit lifecycle events based on animation `start` callback. */
72
- _onAnimationStart(event: AnimationEvent): void;
73
- /** Starts the dialog exit animation. */
74
- _startExiting(): void;
75
- /** Saves a reference to the element that was focused before the dialog was opened. */
76
- private _savePreviouslyFocusedElement;
77
- /** Focuses the dialog container. */
78
- private _focusDialogContainer;
79
67
  /**
80
68
  * Focuses the provided element. If the element is not focusable, it will add a tabIndex
81
69
  * attribute to forcefully focus it. The attribute is removed after focus is moved.
@@ -88,12 +76,20 @@ export declare class CdkDialogContainer extends BasePortalOutlet implements OnDe
88
76
  */
89
77
  private _focusByCssSelector;
90
78
  /**
91
- * Autofocus the element specified by the autoFocus field. When autoFocus is not 'dialog', if
92
- * for some reason the element cannot be focused, the dialog container will be focused.
79
+ * Moves the focus inside the focus trap. When autoFocus is not set to 'dialog', if focus
80
+ * cannot be moved then focus will go to the dialog container.
93
81
  */
94
- private _autoFocus;
95
- /** Returns the focus to the element focused before the dialog was open. */
96
- private _returnFocusAfterDialog;
97
- static ɵfac: i0.ɵɵFactoryDeclaration<CdkDialogContainer, [null, null, null, null, null, { optional: true; }, null]>;
98
- static ɵcmp: i0.ɵɵComponentDeclaration<CdkDialogContainer, "cdk-dialog-container", never, {}, {}, never, never>;
82
+ protected _trapFocus(): void;
83
+ /** Restores focus to the element that was focused before the dialog opened. */
84
+ private _restoreFocus;
85
+ /** Focuses the dialog container. */
86
+ private _focusDialogContainer;
87
+ /** Returns whether focus is inside the dialog. */
88
+ private _containsFocus;
89
+ /** Sets up the focus trap. */
90
+ private _initializeFocusTrap;
91
+ /** Sets up the listener that handles clicks on the dialog backdrop. */
92
+ private _handleBackdropClicks;
93
+ static ɵfac: i0.ɵɵFactoryDeclaration<CdkDialogContainer<any>, [null, null, { optional: true; }, null, null, null, null, null]>;
94
+ static ɵcmp: i0.ɵɵComponentDeclaration<CdkDialogContainer<any>, "cdk-dialog-container", never, {}, {}, never, never>;
99
95
  }
@@ -6,25 +6,19 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import { InjectionToken } from '@angular/core';
9
- import { ComponentType, Overlay, ScrollStrategy } from '@angular/cdk/overlay';
10
- import { DialogRef } from './dialog-ref';
11
- import { CdkDialogContainer } from './dialog-container';
9
+ import { Overlay, ScrollStrategy } from '@angular/cdk/overlay';
12
10
  import { DialogConfig } from './dialog-config';
13
11
  /** Injection token for the Dialog's ScrollStrategy. */
14
12
  export declare const DIALOG_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>;
15
13
  /** Injection token for the Dialog's Data. */
16
14
  export declare const DIALOG_DATA: InjectionToken<any>;
17
- /** Injection token for the DialogRef constructor. */
18
- export declare const DIALOG_REF: InjectionToken<DialogRef<any, any>>;
19
- /** Injection token for the DialogConfig. */
20
- export declare const DIALOG_CONFIG: InjectionToken<DialogConfig<any>>;
21
- /** Injection token for the Dialog's DialogContainer component. */
22
- export declare const DIALOG_CONTAINER: InjectionToken<ComponentType<CdkDialogContainer>>;
15
+ /** Injection token that can be used to provide default options for the dialog module. */
16
+ export declare const DEFAULT_DIALOG_CONFIG: InjectionToken<DialogConfig<unknown, unknown, import("@angular/cdk/portal").BasePortalOutlet>>;
23
17
  /** @docs-private */
24
- export declare function MAT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay): () => ScrollStrategy;
18
+ export declare function DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay): () => ScrollStrategy;
25
19
  /** @docs-private */
26
- export declare const MAT_DIALOG_SCROLL_STRATEGY_PROVIDER: {
20
+ export declare const DIALOG_SCROLL_STRATEGY_PROVIDER: {
27
21
  provide: InjectionToken<() => ScrollStrategy>;
28
22
  deps: (typeof Overlay)[];
29
- useFactory: typeof MAT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY;
23
+ useFactory: typeof DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY;
30
24
  };
@@ -5,53 +5,60 @@
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 { OverlayRef, OverlaySizeConfig } from '@angular/cdk/overlay';
8
+ import { OverlayRef } from '@angular/cdk/overlay';
9
9
  import { Observable } from 'rxjs';
10
- import { DialogPosition } from './dialog-config';
11
- import { CdkDialogContainer } from './dialog-container';
10
+ import { DialogConfig } from './dialog-config';
11
+ import { FocusOrigin } from '@angular/cdk/a11y';
12
+ import { BasePortalOutlet } from '@angular/cdk/portal';
13
+ /** Additional options that can be passed in when closing a dialog. */
14
+ export interface DialogCloseOptions {
15
+ /** Focus original to use when restoring focus. */
16
+ focusOrigin?: FocusOrigin;
17
+ }
12
18
  /**
13
19
  * Reference to a dialog opened via the Dialog service.
14
20
  */
15
- export declare class DialogRef<T, R = any> {
16
- _overlayRef: OverlayRef;
17
- protected _containerInstance: CdkDialogContainer;
18
- readonly id: string;
19
- /** The instance of the component in the dialog. */
20
- componentInstance: T;
21
+ export declare class DialogRef<R = unknown, C = unknown> {
22
+ readonly overlayRef: OverlayRef;
23
+ readonly config: DialogConfig<any, DialogRef<R, C>, BasePortalOutlet>;
24
+ /**
25
+ * Instance of component opened into the dialog. Will be
26
+ * null when the dialog is opened using a `TemplateRef`.
27
+ */
28
+ componentInstance: C | null;
29
+ /** Instance of the container that is rendering out the dialog content. */
30
+ containerInstance: BasePortalOutlet & {
31
+ _closeInteractionType?: FocusOrigin;
32
+ };
21
33
  /** Whether the user is allowed to close the dialog. */
22
34
  disableClose: boolean | undefined;
23
- /** Result to be passed to afterClosed. */
24
- private _result;
25
- constructor(_overlayRef: OverlayRef, _containerInstance: CdkDialogContainer, id?: string);
26
- /** Gets an observable that emits when the overlay's backdrop has been clicked. */
27
- backdropClick(): Observable<MouseEvent>;
35
+ /** Emits when the dialog has been closed. */
36
+ readonly closed: Observable<R | undefined>;
37
+ /** Emits when the backdrop of the dialog is clicked. */
38
+ readonly backdropClick: Observable<MouseEvent>;
39
+ /** Emits when on keyboard events within the dialog. */
40
+ readonly keydownEvents: Observable<KeyboardEvent>;
41
+ /** Emits on pointer events that happen outside of the dialog. */
42
+ readonly outsidePointerEvents: Observable<MouseEvent>;
43
+ /** Unique ID for the dialog. */
44
+ readonly id: string;
45
+ constructor(overlayRef: OverlayRef, config: DialogConfig<any, DialogRef<R, C>, BasePortalOutlet>);
28
46
  /**
29
47
  * Close the dialog.
30
- * @param dialogResult Optional result to return to the dialog opener.
31
- */
32
- close(dialogResult?: R): void;
33
- /**
34
- * Updates the dialog's position.
35
- * @param position New dialog position.
36
- */
37
- updatePosition(position?: DialogPosition): this;
38
- /**
39
- * Gets an observable that emits when keydown events are targeted on the overlay.
48
+ * @param result Optional result to return to the dialog opener.
49
+ * @param options Additional options to customize the closing behavior.
40
50
  */
41
- keydownEvents(): Observable<KeyboardEvent>;
51
+ close(result?: R, options?: DialogCloseOptions): void;
52
+ /** Updates the dialog's position. */
53
+ updatePosition(): this;
42
54
  /**
43
- * Updates the dialog's width and height, defined, min and max.
44
- * @param size New size for the overlay.
55
+ * Updates the dialog's width and height.
56
+ * @param width New width of the dialog.
57
+ * @param height New height of the dialog.
45
58
  */
46
- updateSize(size: OverlaySizeConfig): this;
47
- /** Fetches the position strategy object from the overlay ref. */
48
- private _getPositionStrategy;
49
- /** Gets an observable that emits when dialog begins opening. */
50
- beforeOpened(): Observable<void>;
51
- /** Gets an observable that emits when dialog is finished opening. */
52
- afterOpened(): Observable<void>;
53
- /** Gets an observable that emits when dialog begins closing. */
54
- beforeClosed(): Observable<R | undefined>;
55
- /** Gets an observable that emits when dialog is finished closing. */
56
- afterClosed(): Observable<R | undefined>;
59
+ updateSize(width?: string, height?: string): this;
60
+ /** Add a CSS class or an array of classes to the overlay pane. */
61
+ addPanelClass(classes: string | string[]): this;
62
+ /** Remove a CSS class or an array of classes from the overlay pane. */
63
+ removePanelClass(classes: string | string[]): this;
57
64
  }