@angular/material 21.0.0-next.9 → 21.0.0-rc.1

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 (202) hide show
  1. package/core/tokens/_classes.scss +1 -1
  2. package/core/tokens/m2/_md-sys-color.scss +17 -17
  3. package/fesm2022/_animation-chunk.mjs +10 -16
  4. package/fesm2022/_animation-chunk.mjs.map +1 -1
  5. package/fesm2022/_date-formats-chunk.mjs +68 -164
  6. package/fesm2022/_date-formats-chunk.mjs.map +1 -1
  7. package/fesm2022/_date-range-input-harness-chunk.mjs +284 -463
  8. package/fesm2022/_date-range-input-harness-chunk.mjs.map +1 -1
  9. package/fesm2022/_error-options-chunk.mjs +56 -19
  10. package/fesm2022/_error-options-chunk.mjs.map +1 -1
  11. package/fesm2022/_error-state-chunk.mjs +24 -31
  12. package/fesm2022/_error-state-chunk.mjs.map +1 -1
  13. package/fesm2022/_form-field-chunk.mjs +1224 -1017
  14. package/fesm2022/_form-field-chunk.mjs.map +1 -1
  15. package/fesm2022/_icon-button-chunk.mjs +243 -187
  16. package/fesm2022/_icon-button-chunk.mjs.map +1 -1
  17. package/fesm2022/_icon-registry-chunk.mjs +350 -575
  18. package/fesm2022/_icon-registry-chunk.mjs.map +1 -1
  19. package/fesm2022/_input-harness-chunk.mjs +56 -107
  20. package/fesm2022/_input-harness-chunk.mjs.map +1 -1
  21. package/fesm2022/_input-value-accessor-chunk.mjs +0 -6
  22. package/fesm2022/_input-value-accessor-chunk.mjs.map +1 -1
  23. package/fesm2022/_internal-form-field-chunk.mjs +59 -19
  24. package/fesm2022/_internal-form-field-chunk.mjs.map +1 -1
  25. package/fesm2022/_line-chunk.mjs +83 -43
  26. package/fesm2022/_line-chunk.mjs.map +1 -1
  27. package/fesm2022/_option-chunk.mjs +348 -311
  28. package/fesm2022/_option-chunk.mjs.map +1 -1
  29. package/fesm2022/_option-harness-chunk.mjs +23 -39
  30. package/fesm2022/_option-harness-chunk.mjs.map +1 -1
  31. package/fesm2022/_option-module-chunk.mjs +36 -10
  32. package/fesm2022/_option-module-chunk.mjs.map +1 -1
  33. package/fesm2022/_pseudo-checkbox-chunk.mjs +79 -44
  34. package/fesm2022/_pseudo-checkbox-chunk.mjs.map +1 -1
  35. package/fesm2022/_pseudo-checkbox-module-chunk.mjs +36 -10
  36. package/fesm2022/_pseudo-checkbox-module-chunk.mjs.map +1 -1
  37. package/fesm2022/_public-api-chunk.mjs +71 -134
  38. package/fesm2022/_public-api-chunk.mjs.map +1 -1
  39. package/fesm2022/_ripple-chunk.mjs +504 -600
  40. package/fesm2022/_ripple-chunk.mjs.map +1 -1
  41. package/fesm2022/_ripple-loader-chunk.mjs +120 -138
  42. package/fesm2022/_ripple-loader-chunk.mjs.map +1 -1
  43. package/fesm2022/_ripple-module-chunk.mjs +36 -10
  44. package/fesm2022/_ripple-module-chunk.mjs.map +1 -1
  45. package/fesm2022/_structural-styles-chunk.mjs +37 -10
  46. package/fesm2022/_structural-styles-chunk.mjs.map +1 -1
  47. package/fesm2022/_tooltip-chunk.mjs +811 -888
  48. package/fesm2022/_tooltip-chunk.mjs.map +1 -1
  49. package/fesm2022/autocomplete-testing.mjs +62 -86
  50. package/fesm2022/autocomplete-testing.mjs.map +1 -1
  51. package/fesm2022/autocomplete.mjs +965 -1126
  52. package/fesm2022/autocomplete.mjs.map +1 -1
  53. package/fesm2022/badge-testing.mjs +38 -54
  54. package/fesm2022/badge-testing.mjs.map +1 -1
  55. package/fesm2022/badge.mjs +321 -272
  56. package/fesm2022/badge.mjs.map +1 -1
  57. package/fesm2022/bottom-sheet-testing.mjs +10 -24
  58. package/fesm2022/bottom-sheet-testing.mjs.map +1 -1
  59. package/fesm2022/bottom-sheet.mjs +349 -344
  60. package/fesm2022/bottom-sheet.mjs.map +1 -1
  61. package/fesm2022/button-testing.mjs +60 -94
  62. package/fesm2022/button-testing.mjs.map +1 -1
  63. package/fesm2022/button-toggle-testing.mjs +76 -125
  64. package/fesm2022/button-toggle-testing.mjs.map +1 -1
  65. package/fesm2022/button-toggle.mjs +752 -662
  66. package/fesm2022/button-toggle.mjs.map +1 -1
  67. package/fesm2022/button.mjs +263 -158
  68. package/fesm2022/button.mjs.map +1 -1
  69. package/fesm2022/card-testing.mjs +19 -33
  70. package/fesm2022/card-testing.mjs.map +1 -1
  71. package/fesm2022/card.mjs +576 -272
  72. package/fesm2022/card.mjs.map +1 -1
  73. package/fesm2022/checkbox-testing.mjs +71 -123
  74. package/fesm2022/checkbox-testing.mjs.map +1 -1
  75. package/fesm2022/checkbox.mjs +515 -477
  76. package/fesm2022/checkbox.mjs.map +1 -1
  77. package/fesm2022/chips-testing.mjs +201 -344
  78. package/fesm2022/chips-testing.mjs.map +1 -1
  79. package/fesm2022/chips.mjs +2552 -2289
  80. package/fesm2022/chips.mjs.map +1 -1
  81. package/fesm2022/core-testing.mjs +14 -28
  82. package/fesm2022/core-testing.mjs.map +1 -1
  83. package/fesm2022/core.mjs +357 -328
  84. package/fesm2022/core.mjs.map +1 -1
  85. package/fesm2022/datepicker-testing.mjs +15 -25
  86. package/fesm2022/datepicker-testing.mjs.map +1 -1
  87. package/fesm2022/datepicker.mjs +4826 -4563
  88. package/fesm2022/datepicker.mjs.map +1 -1
  89. package/fesm2022/dialog-testing.mjs +93 -129
  90. package/fesm2022/dialog-testing.mjs.map +1 -1
  91. package/fesm2022/dialog.mjs +810 -829
  92. package/fesm2022/dialog.mjs.map +1 -1
  93. package/fesm2022/divider-testing.mjs +10 -11
  94. package/fesm2022/divider-testing.mjs.map +1 -1
  95. package/fesm2022/divider.mjs +119 -43
  96. package/fesm2022/divider.mjs.map +1 -1
  97. package/fesm2022/expansion-testing.mjs +74 -130
  98. package/fesm2022/expansion-testing.mjs.map +1 -1
  99. package/fesm2022/expansion.mjs +703 -515
  100. package/fesm2022/expansion.mjs.map +1 -1
  101. package/fesm2022/form-field-testing-control.mjs +16 -33
  102. package/fesm2022/form-field-testing-control.mjs.map +1 -1
  103. package/fesm2022/form-field-testing.mjs +118 -179
  104. package/fesm2022/form-field-testing.mjs.map +1 -1
  105. package/fesm2022/form-field.mjs +36 -10
  106. package/fesm2022/form-field.mjs.map +1 -1
  107. package/fesm2022/grid-list-testing.mjs +65 -113
  108. package/fesm2022/grid-list-testing.mjs.map +1 -1
  109. package/fesm2022/grid-list.mjs +559 -494
  110. package/fesm2022/grid-list.mjs.map +1 -1
  111. package/fesm2022/icon-testing.mjs +148 -127
  112. package/fesm2022/icon-testing.mjs.map +1 -1
  113. package/fesm2022/icon.mjs +325 -351
  114. package/fesm2022/icon.mjs.map +1 -1
  115. package/fesm2022/input-testing.mjs +59 -99
  116. package/fesm2022/input-testing.mjs.map +1 -1
  117. package/fesm2022/input.mjs +457 -520
  118. package/fesm2022/input.mjs.map +1 -1
  119. package/fesm2022/list-testing.mjs +251 -434
  120. package/fesm2022/list-testing.mjs.map +1 -1
  121. package/fesm2022/list.mjs +1522 -1204
  122. package/fesm2022/list.mjs.map +1 -1
  123. package/fesm2022/material.mjs +0 -5
  124. package/fesm2022/material.mjs.map +1 -1
  125. package/fesm2022/menu-testing.mjs +159 -228
  126. package/fesm2022/menu-testing.mjs.map +1 -1
  127. package/fesm2022/menu.mjs +1338 -1343
  128. package/fesm2022/menu.mjs.map +1 -1
  129. package/fesm2022/paginator-testing.mjs +55 -79
  130. package/fesm2022/paginator-testing.mjs.map +1 -1
  131. package/fesm2022/paginator.mjs +381 -309
  132. package/fesm2022/paginator.mjs.map +1 -1
  133. package/fesm2022/progress-bar-testing.mjs +12 -21
  134. package/fesm2022/progress-bar-testing.mjs.map +1 -1
  135. package/fesm2022/progress-bar.mjs +224 -169
  136. package/fesm2022/progress-bar.mjs.map +1 -1
  137. package/fesm2022/progress-spinner-testing.mjs +13 -23
  138. package/fesm2022/progress-spinner-testing.mjs.map +1 -1
  139. package/fesm2022/progress-spinner.mjs +235 -160
  140. package/fesm2022/progress-spinner.mjs.map +1 -1
  141. package/fesm2022/radio-testing.mjs +133 -208
  142. package/fesm2022/radio-testing.mjs.map +1 -1
  143. package/fesm2022/radio.mjs +712 -679
  144. package/fesm2022/radio.mjs.map +1 -1
  145. package/fesm2022/select-testing.mjs +83 -117
  146. package/fesm2022/select-testing.mjs.map +1 -1
  147. package/fesm2022/select.mjs +1116 -1246
  148. package/fesm2022/select.mjs.map +1 -1
  149. package/fesm2022/sidenav-testing.mjs +54 -120
  150. package/fesm2022/sidenav-testing.mjs.map +1 -1
  151. package/fesm2022/sidenav.mjs +1078 -995
  152. package/fesm2022/sidenav.mjs.map +1 -1
  153. package/fesm2022/slide-toggle-testing.mjs +57 -92
  154. package/fesm2022/slide-toggle-testing.mjs.map +1 -1
  155. package/fesm2022/slide-toggle.mjs +369 -279
  156. package/fesm2022/slide-toggle.mjs.map +1 -1
  157. package/fesm2022/slider-testing.mjs +90 -138
  158. package/fesm2022/slider-testing.mjs.map +1 -1
  159. package/fesm2022/slider.mjs +1651 -1716
  160. package/fesm2022/slider.mjs.map +1 -1
  161. package/fesm2022/snack-bar-testing.mjs +40 -87
  162. package/fesm2022/snack-bar-testing.mjs.map +1 -1
  163. package/fesm2022/snack-bar.mjs +763 -714
  164. package/fesm2022/snack-bar.mjs.map +1 -1
  165. package/fesm2022/sort-testing.mjs +45 -66
  166. package/fesm2022/sort-testing.mjs.map +1 -1
  167. package/fesm2022/sort.mjs +419 -344
  168. package/fesm2022/sort.mjs.map +1 -1
  169. package/fesm2022/stepper-testing.mjs +78 -154
  170. package/fesm2022/stepper-testing.mjs.map +1 -1
  171. package/fesm2022/stepper.mjs +790 -498
  172. package/fesm2022/stepper.mjs.map +1 -1
  173. package/fesm2022/table-testing.mjs +120 -213
  174. package/fesm2022/table-testing.mjs.map +1 -1
  175. package/fesm2022/table.mjs +1026 -684
  176. package/fesm2022/table.mjs.map +1 -1
  177. package/fesm2022/tabs-testing.mjs +125 -197
  178. package/fesm2022/tabs-testing.mjs.map +1 -1
  179. package/fesm2022/tabs.mjs +2351 -2028
  180. package/fesm2022/tabs.mjs.map +1 -1
  181. package/fesm2022/timepicker-testing.mjs +113 -172
  182. package/fesm2022/timepicker-testing.mjs.map +1 -1
  183. package/fesm2022/timepicker.mjs +1019 -826
  184. package/fesm2022/timepicker.mjs.map +1 -1
  185. package/fesm2022/toolbar-testing.mjs +16 -27
  186. package/fesm2022/toolbar-testing.mjs.map +1 -1
  187. package/fesm2022/toolbar.mjs +163 -78
  188. package/fesm2022/toolbar.mjs.map +1 -1
  189. package/fesm2022/tooltip-testing.mjs +41 -52
  190. package/fesm2022/tooltip-testing.mjs.map +1 -1
  191. package/fesm2022/tooltip.mjs +36 -10
  192. package/fesm2022/tooltip.mjs.map +1 -1
  193. package/fesm2022/tree-testing.mjs +86 -162
  194. package/fesm2022/tree-testing.mjs.map +1 -1
  195. package/fesm2022/tree.mjs +638 -466
  196. package/fesm2022/tree.mjs.map +1 -1
  197. package/package.json +2 -2
  198. package/schematics/ng-add/index.js +1 -1
  199. package/types/expansion.d.ts +4 -2
  200. package/types/menu-testing.d.ts +2 -0
  201. package/types/select.d.ts +1 -1
  202. package/types/timepicker.d.ts +1 -0
@@ -8,885 +8,866 @@ import { CdkDialogContainer, Dialog, DialogConfig, DialogModule } from '@angular
8
8
  import { coerceNumberProperty } from '@angular/cdk/coercion';
9
9
  import { CdkPortalOutlet, PortalModule } from '@angular/cdk/portal';
10
10
  import { _animationsDisabled } from './_animation-chunk.mjs';
11
- import { Subject, merge, defer } from 'rxjs';
11
+ import { ReplaySubject, merge, Subject, defer } from 'rxjs';
12
12
  import { filter, take, startWith } from 'rxjs/operators';
13
13
  import { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
14
14
  import { BidiModule } from '@angular/cdk/bidi';
15
15
  import '@angular/cdk/layout';
16
16
 
17
- /**
18
- * Configuration for opening a modal dialog with the MatDialog service.
19
- */
20
17
  class MatDialogConfig {
21
- /**
22
- * Where the attached component should live in Angular's *logical* component tree.
23
- * This affects what is available for injection and the change detection order for the
24
- * component instantiated inside of the dialog. This does not affect where the dialog
25
- * content will be rendered.
26
- */
27
- viewContainerRef;
28
- /**
29
- * Injector used for the instantiation of the component to be attached. If provided,
30
- * takes precedence over the injector indirectly provided by `ViewContainerRef`.
31
- */
32
- injector;
33
- /** ID for the dialog. If omitted, a unique one will be generated. */
34
- id;
35
- /** The ARIA role of the dialog element. */
36
- role = 'dialog';
37
- /** Custom class for the overlay pane. */
38
- panelClass = '';
39
- /** Whether the dialog has a backdrop. */
40
- hasBackdrop = true;
41
- /** Custom class for the backdrop. */
42
- backdropClass = '';
43
- /** Whether the user can use escape or clicking on the backdrop to close the modal. */
44
- disableClose = false;
45
- /** Function used to determine whether the dialog is allowed to close. */
46
- closePredicate;
47
- /** Width of the dialog. */
48
- width = '';
49
- /** Height of the dialog. */
50
- height = '';
51
- /** Min-width of the dialog. If a number is provided, assumes pixel units. */
52
- minWidth;
53
- /** Min-height of the dialog. If a number is provided, assumes pixel units. */
54
- minHeight;
55
- /** Max-width of the dialog. If a number is provided, assumes pixel units. */
56
- maxWidth;
57
- /** Max-height of the dialog. If a number is provided, assumes pixel units. */
58
- maxHeight;
59
- /** Position overrides. */
60
- position;
61
- /** Data being injected into the child component. */
62
- data = null;
63
- /** Layout direction for the dialog's content. */
64
- direction;
65
- /** ID of the element that describes the dialog. */
66
- ariaDescribedBy = null;
67
- /** ID of the element that labels the dialog. */
68
- ariaLabelledBy = null;
69
- /** Aria label to assign to the dialog element. */
70
- ariaLabel = null;
71
- /**
72
- * Whether this is a modal dialog. Used to set the `aria-modal` attribute. Off by default,
73
- * because it can interfere with other overlay-based components (e.g. `mat-select`) and because
74
- * it is redundant since the dialog marks all outside content as `aria-hidden` anyway.
75
- */
76
- ariaModal = false;
77
- /**
78
- * Where the dialog should focus on open.
79
- * @breaking-change 14.0.0 Remove boolean option from autoFocus. Use string or
80
- * AutoFocusTarget instead.
81
- */
82
- autoFocus = 'first-tabbable';
83
- /**
84
- * Whether the dialog should restore focus to the
85
- * previously-focused element, after it's closed.
86
- */
87
- restoreFocus = true;
88
- /** Whether to wait for the opening animation to finish before trapping focus. */
89
- delayFocusTrap = true;
90
- /** Scroll strategy to be used for the dialog. */
91
- scrollStrategy;
92
- /**
93
- * Whether the dialog should close when the user goes backwards/forwards in history.
94
- * Note that this usually doesn't include clicking on links (unless the user is using
95
- * the `HashLocationStrategy`).
96
- */
97
- closeOnNavigation = true;
98
- /**
99
- * Duration of the enter animation in ms.
100
- * Should be a number, string type is deprecated.
101
- * @breaking-change 17.0.0 Remove string signature.
102
- */
103
- enterAnimationDuration;
104
- /**
105
- * Duration of the exit animation in ms.
106
- * Should be a number, string type is deprecated.
107
- * @breaking-change 17.0.0 Remove string signature.
108
- */
109
- exitAnimationDuration;
18
+ viewContainerRef;
19
+ injector;
20
+ id;
21
+ role = 'dialog';
22
+ panelClass = '';
23
+ hasBackdrop = true;
24
+ backdropClass = '';
25
+ disableClose = false;
26
+ closePredicate;
27
+ width = '';
28
+ height = '';
29
+ minWidth;
30
+ minHeight;
31
+ maxWidth;
32
+ maxHeight;
33
+ position;
34
+ data = null;
35
+ direction;
36
+ ariaDescribedBy = null;
37
+ ariaLabelledBy = null;
38
+ ariaLabel = null;
39
+ ariaModal = false;
40
+ autoFocus = 'first-tabbable';
41
+ restoreFocus = true;
42
+ delayFocusTrap = true;
43
+ scrollStrategy;
44
+ closeOnNavigation = true;
45
+ enterAnimationDuration;
46
+ exitAnimationDuration;
110
47
  }
111
48
 
112
- /** Class added when the dialog is open. */
113
49
  const OPEN_CLASS = 'mdc-dialog--open';
114
- /** Class added while the dialog is opening. */
115
50
  const OPENING_CLASS = 'mdc-dialog--opening';
116
- /** Class added while the dialog is closing. */
117
51
  const CLOSING_CLASS = 'mdc-dialog--closing';
118
- /** Duration of the opening animation in milliseconds. */
119
52
  const OPEN_ANIMATION_DURATION = 150;
120
- /** Duration of the closing animation in milliseconds. */
121
53
  const CLOSE_ANIMATION_DURATION = 75;
122
54
  class MatDialogContainer extends CdkDialogContainer {
123
- /** Emits when an animation state changes. */
124
- _animationStateChanged = new EventEmitter();
125
- /** Whether animations are enabled. */
126
- _animationsEnabled = !_animationsDisabled();
127
- /** Number of actions projected in the dialog. */
128
- _actionSectionCount = 0;
129
- /** Host element of the dialog container component. */
130
- _hostElement = this._elementRef.nativeElement;
131
- /** Duration of the dialog open animation. */
132
- _enterAnimationDuration = this._animationsEnabled
133
- ? (parseCssTime(this._config.enterAnimationDuration) ?? OPEN_ANIMATION_DURATION)
134
- : 0;
135
- /** Duration of the dialog close animation. */
136
- _exitAnimationDuration = this._animationsEnabled
137
- ? (parseCssTime(this._config.exitAnimationDuration) ?? CLOSE_ANIMATION_DURATION)
138
- : 0;
139
- /** Current timer for dialog animations. */
140
- _animationTimer = null;
141
- _contentAttached() {
142
- // Delegate to the original dialog-container initialization (i.e. saving the
143
- // previous element, setting up the focus trap and moving focus to the container).
144
- super._contentAttached();
145
- // Note: Usually we would be able to use the MDC dialog foundation here to handle
146
- // the dialog animation for us, but there are a few reasons why we just leverage
147
- // their styles and not use the runtime foundation code:
148
- // 1. Foundation does not allow us to disable animations.
149
- // 2. Foundation contains unnecessary features we don't need and aren't
150
- // tree-shakeable. e.g. background scrim, keyboard event handlers for ESC button.
151
- this._startOpenAnimation();
152
- }
153
- /** Starts the dialog open animation if enabled. */
154
- _startOpenAnimation() {
155
- this._animationStateChanged.emit({ state: 'opening', totalTime: this._enterAnimationDuration });
156
- if (this._animationsEnabled) {
157
- this._hostElement.style.setProperty(TRANSITION_DURATION_PROPERTY, `${this._enterAnimationDuration}ms`);
158
- // We need to give the `setProperty` call from above some time to be applied.
159
- // One would expect that the open class is added once the animation finished, but MDC
160
- // uses the open class in combination with the opening class to start the animation.
161
- this._requestAnimationFrame(() => this._hostElement.classList.add(OPENING_CLASS, OPEN_CLASS));
162
- this._waitForAnimationToComplete(this._enterAnimationDuration, this._finishDialogOpen);
163
- }
164
- else {
165
- this._hostElement.classList.add(OPEN_CLASS);
166
- // Note: We could immediately finish the dialog opening here with noop animations,
167
- // but we defer until next tick so that consumers can subscribe to `afterOpened`.
168
- // Executing this immediately would mean that `afterOpened` emits synchronously
169
- // on `dialog.open` before the consumer had a change to subscribe to `afterOpened`.
170
- Promise.resolve().then(() => this._finishDialogOpen());
171
- }
172
- }
173
- /**
174
- * Starts the exit animation of the dialog if enabled. This method is
175
- * called by the dialog ref.
176
- */
177
- _startExitAnimation() {
178
- this._animationStateChanged.emit({ state: 'closing', totalTime: this._exitAnimationDuration });
179
- this._hostElement.classList.remove(OPEN_CLASS);
180
- if (this._animationsEnabled) {
181
- this._hostElement.style.setProperty(TRANSITION_DURATION_PROPERTY, `${this._exitAnimationDuration}ms`);
182
- // We need to give the `setProperty` call from above some time to be applied.
183
- this._requestAnimationFrame(() => this._hostElement.classList.add(CLOSING_CLASS));
184
- this._waitForAnimationToComplete(this._exitAnimationDuration, this._finishDialogClose);
185
- }
186
- else {
187
- // This subscription to the `OverlayRef#backdropClick` observable in the `DialogRef` is
188
- // set up before any user can subscribe to the backdrop click. The subscription triggers
189
- // the dialog close and this method synchronously. If we'd synchronously emit the `CLOSED`
190
- // animation state event if animations are disabled, the overlay would be disposed
191
- // immediately and all other subscriptions to `DialogRef#backdropClick` would be silently
192
- // skipped. We work around this by waiting with the dialog close until the next tick when
193
- // all subscriptions have been fired as expected. This is not an ideal solution, but
194
- // there doesn't seem to be any other good way. Alternatives that have been considered:
195
- // 1. Deferring `DialogRef.close`. This could be a breaking change due to a new microtask.
196
- // Also this issue is specific to the MDC implementation where the dialog could
197
- // technically be closed synchronously. In the non-MDC one, Angular animations are used
198
- // and closing always takes at least a tick.
199
- // 2. Ensuring that user subscriptions to `backdropClick`, `keydownEvents` in the dialog
200
- // ref are first. This would solve the issue, but has the risk of memory leaks and also
201
- // doesn't solve the case where consumers call `DialogRef.close` in their subscriptions.
202
- // Based on the fact that this is specific to the MDC-based implementation of the dialog
203
- // animations, the defer is applied here.
204
- Promise.resolve().then(() => this._finishDialogClose());
205
- }
206
- }
207
- /**
208
- * Updates the number action sections.
209
- * @param delta Increase/decrease in the number of sections.
210
- */
211
- _updateActionSectionCount(delta) {
212
- this._actionSectionCount += delta;
213
- this._changeDetectorRef.markForCheck();
214
- }
215
- /**
216
- * Completes the dialog open by clearing potential animation classes, trapping
217
- * focus and emitting an opened event.
218
- */
219
- _finishDialogOpen = () => {
220
- this._clearAnimationClasses();
221
- this._openAnimationDone(this._enterAnimationDuration);
222
- };
223
- /**
224
- * Completes the dialog close by clearing potential animation classes, restoring
225
- * focus and emitting a closed event.
226
- */
227
- _finishDialogClose = () => {
228
- this._clearAnimationClasses();
229
- this._animationStateChanged.emit({ state: 'closed', totalTime: this._exitAnimationDuration });
230
- };
231
- /** Clears all dialog animation classes. */
232
- _clearAnimationClasses() {
233
- this._hostElement.classList.remove(OPENING_CLASS, CLOSING_CLASS);
234
- }
235
- _waitForAnimationToComplete(duration, callback) {
236
- if (this._animationTimer !== null) {
237
- clearTimeout(this._animationTimer);
238
- }
239
- // Note that we want this timer to run inside the NgZone, because we want
240
- // the related events like `afterClosed` to be inside the zone as well.
241
- this._animationTimer = setTimeout(callback, duration);
242
- }
243
- /** Runs a callback in `requestAnimationFrame`, if available. */
244
- _requestAnimationFrame(callback) {
245
- this._ngZone.runOutsideAngular(() => {
246
- if (typeof requestAnimationFrame === 'function') {
247
- requestAnimationFrame(callback);
248
- }
249
- else {
250
- callback();
251
- }
252
- });
253
- }
254
- _captureInitialFocus() {
255
- if (!this._config.delayFocusTrap) {
256
- this._trapFocus();
257
- }
258
- }
259
- /**
260
- * Callback for when the open dialog animation has finished. Intended to
261
- * be called by sub-classes that use different animation implementations.
262
- */
263
- _openAnimationDone(totalTime) {
264
- if (this._config.delayFocusTrap) {
265
- this._trapFocus();
266
- }
267
- this._animationStateChanged.next({ state: 'opened', totalTime });
268
- }
269
- ngOnDestroy() {
270
- super.ngOnDestroy();
271
- if (this._animationTimer !== null) {
272
- clearTimeout(this._animationTimer);
273
- }
274
- }
275
- attachComponentPortal(portal) {
276
- // When a component is passed into the dialog, the host element interrupts
277
- // the `display:flex` from affecting the dialog title, content, and
278
- // actions. To fix this, we make the component host `display: contents` by
279
- // marking its host with the `mat-mdc-dialog-component-host` class.
280
- //
281
- // Note that this problem does not exist when a template ref is used since
282
- // the title, contents, and actions are then nested directly under the
283
- // dialog surface.
284
- const ref = super.attachComponentPortal(portal);
285
- ref.location.nativeElement.classList.add('mat-mdc-dialog-component-host');
286
- return ref;
287
- }
288
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialogContainer, deps: null, target: i0.ɵɵFactoryTarget.Component });
289
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.2.0-next.2", type: MatDialogContainer, isStandalone: true, selector: "mat-dialog-container", host: { attributes: { "tabindex": "-1" }, properties: { "attr.aria-modal": "_config.ariaModal", "id": "_config.id", "attr.role": "_config.role", "attr.aria-labelledby": "_config.ariaLabel ? null : _ariaLabelledByQueue[0]", "attr.aria-label": "_config.ariaLabel", "attr.aria-describedby": "_config.ariaDescribedBy || null", "class._mat-animation-noopable": "!_animationsEnabled", "class.mat-mdc-dialog-container-with-actions": "_actionSectionCount > 0" }, classAttribute: "mat-mdc-dialog-container mdc-dialog" }, usesInheritance: true, ngImport: i0, template: "<div class=\"mat-mdc-dialog-inner-container mdc-dialog__container\">\n <div class=\"mat-mdc-dialog-surface mdc-dialog__surface\">\n <ng-template cdkPortalOutlet />\n </div>\n</div>\n", styles: [".mat-mdc-dialog-container{width:100%;height:100%;display:block;box-sizing:border-box;max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;outline:0}.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-max-width, 560px);min-width:var(--mat-dialog-container-min-width, 280px)}@media(max-width: 599px){.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-small-max-width, calc(100vw - 32px))}}.mat-mdc-dialog-inner-container{display:flex;flex-direction:row;align-items:center;justify-content:space-around;box-sizing:border-box;height:100%;opacity:0;transition:opacity linear var(--mat-dialog-transition-duration, 0ms);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit}.mdc-dialog--closing .mat-mdc-dialog-inner-container{transition:opacity 75ms linear;transform:none}.mdc-dialog--open .mat-mdc-dialog-inner-container{opacity:1}._mat-animation-noopable .mat-mdc-dialog-inner-container{transition:none}.mat-mdc-dialog-surface{display:flex;flex-direction:column;flex-grow:0;flex-shrink:0;box-sizing:border-box;width:100%;height:100%;position:relative;overflow-y:auto;outline:0;transform:scale(0.8);transition:transform var(--mat-dialog-transition-duration, 0ms) cubic-bezier(0, 0, 0.2, 1);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;box-shadow:var(--mat-dialog-container-elevation-shadow, none);border-radius:var(--mat-dialog-container-shape, var(--mat-sys-corner-extra-large, 4px));background-color:var(--mat-dialog-container-color, var(--mat-sys-surface, white))}[dir=rtl] .mat-mdc-dialog-surface{text-align:right}.mdc-dialog--open .mat-mdc-dialog-surface,.mdc-dialog--closing .mat-mdc-dialog-surface{transform:none}._mat-animation-noopable .mat-mdc-dialog-surface{transition:none}.mat-mdc-dialog-surface::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:2px solid rgba(0,0,0,0);border-radius:inherit;content:\"\";pointer-events:none}.mat-mdc-dialog-title{display:block;position:relative;flex-shrink:0;box-sizing:border-box;margin:0 0 1px;padding:var(--mat-dialog-headline-padding, 6px 24px 13px)}.mat-mdc-dialog-title::before{display:inline-block;width:0;height:40px;content:\"\";vertical-align:0}[dir=rtl] .mat-mdc-dialog-title{text-align:right}.mat-mdc-dialog-container .mat-mdc-dialog-title{color:var(--mat-dialog-subhead-color, var(--mat-sys-on-surface, rgba(0, 0, 0, 0.87)));font-family:var(--mat-dialog-subhead-font, var(--mat-sys-headline-small-font, inherit));line-height:var(--mat-dialog-subhead-line-height, var(--mat-sys-headline-small-line-height, 1.5rem));font-size:var(--mat-dialog-subhead-size, var(--mat-sys-headline-small-size, 1rem));font-weight:var(--mat-dialog-subhead-weight, var(--mat-sys-headline-small-weight, 400));letter-spacing:var(--mat-dialog-subhead-tracking, var(--mat-sys-headline-small-tracking, 0.03125em))}.mat-mdc-dialog-content{display:block;flex-grow:1;box-sizing:border-box;margin:0;overflow:auto;max-height:65vh}.mat-mdc-dialog-content>:first-child{margin-top:0}.mat-mdc-dialog-content>:last-child{margin-bottom:0}.mat-mdc-dialog-container .mat-mdc-dialog-content{color:var(--mat-dialog-supporting-text-color, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, 0.6)));font-family:var(--mat-dialog-supporting-text-font, var(--mat-sys-body-medium-font, inherit));line-height:var(--mat-dialog-supporting-text-line-height, var(--mat-sys-body-medium-line-height, 1.5rem));font-size:var(--mat-dialog-supporting-text-size, var(--mat-sys-body-medium-size, 1rem));font-weight:var(--mat-dialog-supporting-text-weight, var(--mat-sys-body-medium-weight, 400));letter-spacing:var(--mat-dialog-supporting-text-tracking, var(--mat-sys-body-medium-tracking, 0.03125em))}.mat-mdc-dialog-container .mat-mdc-dialog-content{padding:var(--mat-dialog-content-padding, 20px 24px)}.mat-mdc-dialog-container-with-actions .mat-mdc-dialog-content{padding:var(--mat-dialog-with-actions-content-padding, 20px 24px 0)}.mat-mdc-dialog-container .mat-mdc-dialog-title+.mat-mdc-dialog-content{padding-top:0}.mat-mdc-dialog-actions{display:flex;position:relative;flex-shrink:0;flex-wrap:wrap;align-items:center;box-sizing:border-box;min-height:52px;margin:0;border-top:1px solid rgba(0,0,0,0);padding:var(--mat-dialog-actions-padding, 16px 24px);justify-content:var(--mat-dialog-actions-alignment, flex-end)}@media(forced-colors: active){.mat-mdc-dialog-actions{border-top-color:CanvasText}}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-start,.mat-mdc-dialog-actions[align=start]{justify-content:start}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-center,.mat-mdc-dialog-actions[align=center]{justify-content:center}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-end,.mat-mdc-dialog-actions[align=end]{justify-content:flex-end}.mat-mdc-dialog-actions .mat-button-base+.mat-button-base,.mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mat-mdc-dialog-actions .mat-button-base+.mat-button-base,[dir=rtl] .mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}.mat-mdc-dialog-component-host{display:contents}\n"], dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None });
55
+ _animationStateChanged = new EventEmitter();
56
+ _animationsEnabled = !_animationsDisabled();
57
+ _actionSectionCount = 0;
58
+ _hostElement = this._elementRef.nativeElement;
59
+ _enterAnimationDuration = this._animationsEnabled ? parseCssTime(this._config.enterAnimationDuration) ?? OPEN_ANIMATION_DURATION : 0;
60
+ _exitAnimationDuration = this._animationsEnabled ? parseCssTime(this._config.exitAnimationDuration) ?? CLOSE_ANIMATION_DURATION : 0;
61
+ _animationTimer = null;
62
+ _contentAttached() {
63
+ super._contentAttached();
64
+ this._startOpenAnimation();
65
+ }
66
+ _startOpenAnimation() {
67
+ this._animationStateChanged.emit({
68
+ state: 'opening',
69
+ totalTime: this._enterAnimationDuration
70
+ });
71
+ if (this._animationsEnabled) {
72
+ this._hostElement.style.setProperty(TRANSITION_DURATION_PROPERTY, `${this._enterAnimationDuration}ms`);
73
+ this._requestAnimationFrame(() => this._hostElement.classList.add(OPENING_CLASS, OPEN_CLASS));
74
+ this._waitForAnimationToComplete(this._enterAnimationDuration, this._finishDialogOpen);
75
+ } else {
76
+ this._hostElement.classList.add(OPEN_CLASS);
77
+ Promise.resolve().then(() => this._finishDialogOpen());
78
+ }
79
+ }
80
+ _startExitAnimation() {
81
+ this._animationStateChanged.emit({
82
+ state: 'closing',
83
+ totalTime: this._exitAnimationDuration
84
+ });
85
+ this._hostElement.classList.remove(OPEN_CLASS);
86
+ if (this._animationsEnabled) {
87
+ this._hostElement.style.setProperty(TRANSITION_DURATION_PROPERTY, `${this._exitAnimationDuration}ms`);
88
+ this._requestAnimationFrame(() => this._hostElement.classList.add(CLOSING_CLASS));
89
+ this._waitForAnimationToComplete(this._exitAnimationDuration, this._finishDialogClose);
90
+ } else {
91
+ Promise.resolve().then(() => this._finishDialogClose());
92
+ }
93
+ }
94
+ _updateActionSectionCount(delta) {
95
+ this._actionSectionCount += delta;
96
+ this._changeDetectorRef.markForCheck();
97
+ }
98
+ _finishDialogOpen = () => {
99
+ this._clearAnimationClasses();
100
+ this._openAnimationDone(this._enterAnimationDuration);
101
+ };
102
+ _finishDialogClose = () => {
103
+ this._clearAnimationClasses();
104
+ this._animationStateChanged.emit({
105
+ state: 'closed',
106
+ totalTime: this._exitAnimationDuration
107
+ });
108
+ };
109
+ _clearAnimationClasses() {
110
+ this._hostElement.classList.remove(OPENING_CLASS, CLOSING_CLASS);
111
+ }
112
+ _waitForAnimationToComplete(duration, callback) {
113
+ if (this._animationTimer !== null) {
114
+ clearTimeout(this._animationTimer);
115
+ }
116
+ this._animationTimer = setTimeout(callback, duration);
117
+ }
118
+ _requestAnimationFrame(callback) {
119
+ this._ngZone.runOutsideAngular(() => {
120
+ if (typeof requestAnimationFrame === 'function') {
121
+ requestAnimationFrame(callback);
122
+ } else {
123
+ callback();
124
+ }
125
+ });
126
+ }
127
+ _captureInitialFocus() {
128
+ if (!this._config.delayFocusTrap) {
129
+ this._trapFocus();
130
+ }
131
+ }
132
+ _openAnimationDone(totalTime) {
133
+ if (this._config.delayFocusTrap) {
134
+ this._trapFocus();
135
+ }
136
+ this._animationStateChanged.next({
137
+ state: 'opened',
138
+ totalTime
139
+ });
140
+ }
141
+ ngOnDestroy() {
142
+ super.ngOnDestroy();
143
+ if (this._animationTimer !== null) {
144
+ clearTimeout(this._animationTimer);
145
+ }
146
+ }
147
+ attachComponentPortal(portal) {
148
+ const ref = super.attachComponentPortal(portal);
149
+ ref.location.nativeElement.classList.add('mat-mdc-dialog-component-host');
150
+ return ref;
151
+ }
152
+ static ɵfac = i0.ɵɵngDeclareFactory({
153
+ minVersion: "12.0.0",
154
+ version: "20.2.0-next.2",
155
+ ngImport: i0,
156
+ type: MatDialogContainer,
157
+ deps: null,
158
+ target: i0.ɵɵFactoryTarget.Component
159
+ });
160
+ static ɵcmp = i0.ɵɵngDeclareComponent({
161
+ minVersion: "14.0.0",
162
+ version: "20.2.0-next.2",
163
+ type: MatDialogContainer,
164
+ isStandalone: true,
165
+ selector: "mat-dialog-container",
166
+ host: {
167
+ attributes: {
168
+ "tabindex": "-1"
169
+ },
170
+ properties: {
171
+ "attr.aria-modal": "_config.ariaModal",
172
+ "id": "_config.id",
173
+ "attr.role": "_config.role",
174
+ "attr.aria-labelledby": "_config.ariaLabel ? null : _ariaLabelledByQueue[0]",
175
+ "attr.aria-label": "_config.ariaLabel",
176
+ "attr.aria-describedby": "_config.ariaDescribedBy || null",
177
+ "class._mat-animation-noopable": "!_animationsEnabled",
178
+ "class.mat-mdc-dialog-container-with-actions": "_actionSectionCount > 0"
179
+ },
180
+ classAttribute: "mat-mdc-dialog-container mdc-dialog"
181
+ },
182
+ usesInheritance: true,
183
+ ngImport: i0,
184
+ template: "<div class=\"mat-mdc-dialog-inner-container mdc-dialog__container\">\n <div class=\"mat-mdc-dialog-surface mdc-dialog__surface\">\n <ng-template cdkPortalOutlet />\n </div>\n</div>\n",
185
+ styles: [".mat-mdc-dialog-container{width:100%;height:100%;display:block;box-sizing:border-box;max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;outline:0}.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-max-width, 560px);min-width:var(--mat-dialog-container-min-width, 280px)}@media(max-width: 599px){.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-small-max-width, calc(100vw - 32px))}}.mat-mdc-dialog-inner-container{display:flex;flex-direction:row;align-items:center;justify-content:space-around;box-sizing:border-box;height:100%;opacity:0;transition:opacity linear var(--mat-dialog-transition-duration, 0ms);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit}.mdc-dialog--closing .mat-mdc-dialog-inner-container{transition:opacity 75ms linear;transform:none}.mdc-dialog--open .mat-mdc-dialog-inner-container{opacity:1}._mat-animation-noopable .mat-mdc-dialog-inner-container{transition:none}.mat-mdc-dialog-surface{display:flex;flex-direction:column;flex-grow:0;flex-shrink:0;box-sizing:border-box;width:100%;height:100%;position:relative;overflow-y:auto;outline:0;transform:scale(0.8);transition:transform var(--mat-dialog-transition-duration, 0ms) cubic-bezier(0, 0, 0.2, 1);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;box-shadow:var(--mat-dialog-container-elevation-shadow, none);border-radius:var(--mat-dialog-container-shape, var(--mat-sys-corner-extra-large, 4px));background-color:var(--mat-dialog-container-color, var(--mat-sys-surface, white))}[dir=rtl] .mat-mdc-dialog-surface{text-align:right}.mdc-dialog--open .mat-mdc-dialog-surface,.mdc-dialog--closing .mat-mdc-dialog-surface{transform:none}._mat-animation-noopable .mat-mdc-dialog-surface{transition:none}.mat-mdc-dialog-surface::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:2px solid rgba(0,0,0,0);border-radius:inherit;content:\"\";pointer-events:none}.mat-mdc-dialog-title{display:block;position:relative;flex-shrink:0;box-sizing:border-box;margin:0 0 1px;padding:var(--mat-dialog-headline-padding, 6px 24px 13px)}.mat-mdc-dialog-title::before{display:inline-block;width:0;height:40px;content:\"\";vertical-align:0}[dir=rtl] .mat-mdc-dialog-title{text-align:right}.mat-mdc-dialog-container .mat-mdc-dialog-title{color:var(--mat-dialog-subhead-color, var(--mat-sys-on-surface, rgba(0, 0, 0, 0.87)));font-family:var(--mat-dialog-subhead-font, var(--mat-sys-headline-small-font, inherit));line-height:var(--mat-dialog-subhead-line-height, var(--mat-sys-headline-small-line-height, 1.5rem));font-size:var(--mat-dialog-subhead-size, var(--mat-sys-headline-small-size, 1rem));font-weight:var(--mat-dialog-subhead-weight, var(--mat-sys-headline-small-weight, 400));letter-spacing:var(--mat-dialog-subhead-tracking, var(--mat-sys-headline-small-tracking, 0.03125em))}.mat-mdc-dialog-content{display:block;flex-grow:1;box-sizing:border-box;margin:0;overflow:auto;max-height:65vh}.mat-mdc-dialog-content>:first-child{margin-top:0}.mat-mdc-dialog-content>:last-child{margin-bottom:0}.mat-mdc-dialog-container .mat-mdc-dialog-content{color:var(--mat-dialog-supporting-text-color, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, 0.6)));font-family:var(--mat-dialog-supporting-text-font, var(--mat-sys-body-medium-font, inherit));line-height:var(--mat-dialog-supporting-text-line-height, var(--mat-sys-body-medium-line-height, 1.5rem));font-size:var(--mat-dialog-supporting-text-size, var(--mat-sys-body-medium-size, 1rem));font-weight:var(--mat-dialog-supporting-text-weight, var(--mat-sys-body-medium-weight, 400));letter-spacing:var(--mat-dialog-supporting-text-tracking, var(--mat-sys-body-medium-tracking, 0.03125em))}.mat-mdc-dialog-container .mat-mdc-dialog-content{padding:var(--mat-dialog-content-padding, 20px 24px)}.mat-mdc-dialog-container-with-actions .mat-mdc-dialog-content{padding:var(--mat-dialog-with-actions-content-padding, 20px 24px 0)}.mat-mdc-dialog-container .mat-mdc-dialog-title+.mat-mdc-dialog-content{padding-top:0}.mat-mdc-dialog-actions{display:flex;position:relative;flex-shrink:0;flex-wrap:wrap;align-items:center;box-sizing:border-box;min-height:52px;margin:0;border-top:1px solid rgba(0,0,0,0);padding:var(--mat-dialog-actions-padding, 16px 24px);justify-content:var(--mat-dialog-actions-alignment, flex-end)}@media(forced-colors: active){.mat-mdc-dialog-actions{border-top-color:CanvasText}}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-start,.mat-mdc-dialog-actions[align=start]{justify-content:start}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-center,.mat-mdc-dialog-actions[align=center]{justify-content:center}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-end,.mat-mdc-dialog-actions[align=end]{justify-content:flex-end}.mat-mdc-dialog-actions .mat-button-base+.mat-button-base,.mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mat-mdc-dialog-actions .mat-button-base+.mat-button-base,[dir=rtl] .mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}.mat-mdc-dialog-component-host{display:contents}\n"],
186
+ dependencies: [{
187
+ kind: "directive",
188
+ type: CdkPortalOutlet,
189
+ selector: "[cdkPortalOutlet]",
190
+ inputs: ["cdkPortalOutlet"],
191
+ outputs: ["attached"],
192
+ exportAs: ["cdkPortalOutlet"]
193
+ }],
194
+ changeDetection: i0.ChangeDetectionStrategy.Default,
195
+ encapsulation: i0.ViewEncapsulation.None
196
+ });
290
197
  }
291
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialogContainer, decorators: [{
292
- type: Component,
293
- args: [{ selector: 'mat-dialog-container', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, imports: [CdkPortalOutlet], host: {
294
- 'class': 'mat-mdc-dialog-container mdc-dialog',
295
- 'tabindex': '-1',
296
- '[attr.aria-modal]': '_config.ariaModal',
297
- '[id]': '_config.id',
298
- '[attr.role]': '_config.role',
299
- '[attr.aria-labelledby]': '_config.ariaLabel ? null : _ariaLabelledByQueue[0]',
300
- '[attr.aria-label]': '_config.ariaLabel',
301
- '[attr.aria-describedby]': '_config.ariaDescribedBy || null',
302
- '[class._mat-animation-noopable]': '!_animationsEnabled',
303
- '[class.mat-mdc-dialog-container-with-actions]': '_actionSectionCount > 0',
304
- }, template: "<div class=\"mat-mdc-dialog-inner-container mdc-dialog__container\">\n <div class=\"mat-mdc-dialog-surface mdc-dialog__surface\">\n <ng-template cdkPortalOutlet />\n </div>\n</div>\n", styles: [".mat-mdc-dialog-container{width:100%;height:100%;display:block;box-sizing:border-box;max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;outline:0}.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-max-width, 560px);min-width:var(--mat-dialog-container-min-width, 280px)}@media(max-width: 599px){.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-small-max-width, calc(100vw - 32px))}}.mat-mdc-dialog-inner-container{display:flex;flex-direction:row;align-items:center;justify-content:space-around;box-sizing:border-box;height:100%;opacity:0;transition:opacity linear var(--mat-dialog-transition-duration, 0ms);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit}.mdc-dialog--closing .mat-mdc-dialog-inner-container{transition:opacity 75ms linear;transform:none}.mdc-dialog--open .mat-mdc-dialog-inner-container{opacity:1}._mat-animation-noopable .mat-mdc-dialog-inner-container{transition:none}.mat-mdc-dialog-surface{display:flex;flex-direction:column;flex-grow:0;flex-shrink:0;box-sizing:border-box;width:100%;height:100%;position:relative;overflow-y:auto;outline:0;transform:scale(0.8);transition:transform var(--mat-dialog-transition-duration, 0ms) cubic-bezier(0, 0, 0.2, 1);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;box-shadow:var(--mat-dialog-container-elevation-shadow, none);border-radius:var(--mat-dialog-container-shape, var(--mat-sys-corner-extra-large, 4px));background-color:var(--mat-dialog-container-color, var(--mat-sys-surface, white))}[dir=rtl] .mat-mdc-dialog-surface{text-align:right}.mdc-dialog--open .mat-mdc-dialog-surface,.mdc-dialog--closing .mat-mdc-dialog-surface{transform:none}._mat-animation-noopable .mat-mdc-dialog-surface{transition:none}.mat-mdc-dialog-surface::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:2px solid rgba(0,0,0,0);border-radius:inherit;content:\"\";pointer-events:none}.mat-mdc-dialog-title{display:block;position:relative;flex-shrink:0;box-sizing:border-box;margin:0 0 1px;padding:var(--mat-dialog-headline-padding, 6px 24px 13px)}.mat-mdc-dialog-title::before{display:inline-block;width:0;height:40px;content:\"\";vertical-align:0}[dir=rtl] .mat-mdc-dialog-title{text-align:right}.mat-mdc-dialog-container .mat-mdc-dialog-title{color:var(--mat-dialog-subhead-color, var(--mat-sys-on-surface, rgba(0, 0, 0, 0.87)));font-family:var(--mat-dialog-subhead-font, var(--mat-sys-headline-small-font, inherit));line-height:var(--mat-dialog-subhead-line-height, var(--mat-sys-headline-small-line-height, 1.5rem));font-size:var(--mat-dialog-subhead-size, var(--mat-sys-headline-small-size, 1rem));font-weight:var(--mat-dialog-subhead-weight, var(--mat-sys-headline-small-weight, 400));letter-spacing:var(--mat-dialog-subhead-tracking, var(--mat-sys-headline-small-tracking, 0.03125em))}.mat-mdc-dialog-content{display:block;flex-grow:1;box-sizing:border-box;margin:0;overflow:auto;max-height:65vh}.mat-mdc-dialog-content>:first-child{margin-top:0}.mat-mdc-dialog-content>:last-child{margin-bottom:0}.mat-mdc-dialog-container .mat-mdc-dialog-content{color:var(--mat-dialog-supporting-text-color, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, 0.6)));font-family:var(--mat-dialog-supporting-text-font, var(--mat-sys-body-medium-font, inherit));line-height:var(--mat-dialog-supporting-text-line-height, var(--mat-sys-body-medium-line-height, 1.5rem));font-size:var(--mat-dialog-supporting-text-size, var(--mat-sys-body-medium-size, 1rem));font-weight:var(--mat-dialog-supporting-text-weight, var(--mat-sys-body-medium-weight, 400));letter-spacing:var(--mat-dialog-supporting-text-tracking, var(--mat-sys-body-medium-tracking, 0.03125em))}.mat-mdc-dialog-container .mat-mdc-dialog-content{padding:var(--mat-dialog-content-padding, 20px 24px)}.mat-mdc-dialog-container-with-actions .mat-mdc-dialog-content{padding:var(--mat-dialog-with-actions-content-padding, 20px 24px 0)}.mat-mdc-dialog-container .mat-mdc-dialog-title+.mat-mdc-dialog-content{padding-top:0}.mat-mdc-dialog-actions{display:flex;position:relative;flex-shrink:0;flex-wrap:wrap;align-items:center;box-sizing:border-box;min-height:52px;margin:0;border-top:1px solid rgba(0,0,0,0);padding:var(--mat-dialog-actions-padding, 16px 24px);justify-content:var(--mat-dialog-actions-alignment, flex-end)}@media(forced-colors: active){.mat-mdc-dialog-actions{border-top-color:CanvasText}}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-start,.mat-mdc-dialog-actions[align=start]{justify-content:start}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-center,.mat-mdc-dialog-actions[align=center]{justify-content:center}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-end,.mat-mdc-dialog-actions[align=end]{justify-content:flex-end}.mat-mdc-dialog-actions .mat-button-base+.mat-button-base,.mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mat-mdc-dialog-actions .mat-button-base+.mat-button-base,[dir=rtl] .mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}.mat-mdc-dialog-component-host{display:contents}\n"] }]
305
- }] });
198
+ i0.ɵɵngDeclareClassMetadata({
199
+ minVersion: "12.0.0",
200
+ version: "20.2.0-next.2",
201
+ ngImport: i0,
202
+ type: MatDialogContainer,
203
+ decorators: [{
204
+ type: Component,
205
+ args: [{
206
+ selector: 'mat-dialog-container',
207
+ encapsulation: ViewEncapsulation.None,
208
+ changeDetection: ChangeDetectionStrategy.Default,
209
+ imports: [CdkPortalOutlet],
210
+ host: {
211
+ 'class': 'mat-mdc-dialog-container mdc-dialog',
212
+ 'tabindex': '-1',
213
+ '[attr.aria-modal]': '_config.ariaModal',
214
+ '[id]': '_config.id',
215
+ '[attr.role]': '_config.role',
216
+ '[attr.aria-labelledby]': '_config.ariaLabel ? null : _ariaLabelledByQueue[0]',
217
+ '[attr.aria-label]': '_config.ariaLabel',
218
+ '[attr.aria-describedby]': '_config.ariaDescribedBy || null',
219
+ '[class._mat-animation-noopable]': '!_animationsEnabled',
220
+ '[class.mat-mdc-dialog-container-with-actions]': '_actionSectionCount > 0'
221
+ },
222
+ template: "<div class=\"mat-mdc-dialog-inner-container mdc-dialog__container\">\n <div class=\"mat-mdc-dialog-surface mdc-dialog__surface\">\n <ng-template cdkPortalOutlet />\n </div>\n</div>\n",
223
+ styles: [".mat-mdc-dialog-container{width:100%;height:100%;display:block;box-sizing:border-box;max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;outline:0}.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-max-width, 560px);min-width:var(--mat-dialog-container-min-width, 280px)}@media(max-width: 599px){.cdk-overlay-pane.mat-mdc-dialog-panel{max-width:var(--mat-dialog-container-small-max-width, calc(100vw - 32px))}}.mat-mdc-dialog-inner-container{display:flex;flex-direction:row;align-items:center;justify-content:space-around;box-sizing:border-box;height:100%;opacity:0;transition:opacity linear var(--mat-dialog-transition-duration, 0ms);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit}.mdc-dialog--closing .mat-mdc-dialog-inner-container{transition:opacity 75ms linear;transform:none}.mdc-dialog--open .mat-mdc-dialog-inner-container{opacity:1}._mat-animation-noopable .mat-mdc-dialog-inner-container{transition:none}.mat-mdc-dialog-surface{display:flex;flex-direction:column;flex-grow:0;flex-shrink:0;box-sizing:border-box;width:100%;height:100%;position:relative;overflow-y:auto;outline:0;transform:scale(0.8);transition:transform var(--mat-dialog-transition-duration, 0ms) cubic-bezier(0, 0, 0.2, 1);max-height:inherit;min-height:inherit;min-width:inherit;max-width:inherit;box-shadow:var(--mat-dialog-container-elevation-shadow, none);border-radius:var(--mat-dialog-container-shape, var(--mat-sys-corner-extra-large, 4px));background-color:var(--mat-dialog-container-color, var(--mat-sys-surface, white))}[dir=rtl] .mat-mdc-dialog-surface{text-align:right}.mdc-dialog--open .mat-mdc-dialog-surface,.mdc-dialog--closing .mat-mdc-dialog-surface{transform:none}._mat-animation-noopable .mat-mdc-dialog-surface{transition:none}.mat-mdc-dialog-surface::before{position:absolute;box-sizing:border-box;width:100%;height:100%;top:0;left:0;border:2px solid rgba(0,0,0,0);border-radius:inherit;content:\"\";pointer-events:none}.mat-mdc-dialog-title{display:block;position:relative;flex-shrink:0;box-sizing:border-box;margin:0 0 1px;padding:var(--mat-dialog-headline-padding, 6px 24px 13px)}.mat-mdc-dialog-title::before{display:inline-block;width:0;height:40px;content:\"\";vertical-align:0}[dir=rtl] .mat-mdc-dialog-title{text-align:right}.mat-mdc-dialog-container .mat-mdc-dialog-title{color:var(--mat-dialog-subhead-color, var(--mat-sys-on-surface, rgba(0, 0, 0, 0.87)));font-family:var(--mat-dialog-subhead-font, var(--mat-sys-headline-small-font, inherit));line-height:var(--mat-dialog-subhead-line-height, var(--mat-sys-headline-small-line-height, 1.5rem));font-size:var(--mat-dialog-subhead-size, var(--mat-sys-headline-small-size, 1rem));font-weight:var(--mat-dialog-subhead-weight, var(--mat-sys-headline-small-weight, 400));letter-spacing:var(--mat-dialog-subhead-tracking, var(--mat-sys-headline-small-tracking, 0.03125em))}.mat-mdc-dialog-content{display:block;flex-grow:1;box-sizing:border-box;margin:0;overflow:auto;max-height:65vh}.mat-mdc-dialog-content>:first-child{margin-top:0}.mat-mdc-dialog-content>:last-child{margin-bottom:0}.mat-mdc-dialog-container .mat-mdc-dialog-content{color:var(--mat-dialog-supporting-text-color, var(--mat-sys-on-surface-variant, rgba(0, 0, 0, 0.6)));font-family:var(--mat-dialog-supporting-text-font, var(--mat-sys-body-medium-font, inherit));line-height:var(--mat-dialog-supporting-text-line-height, var(--mat-sys-body-medium-line-height, 1.5rem));font-size:var(--mat-dialog-supporting-text-size, var(--mat-sys-body-medium-size, 1rem));font-weight:var(--mat-dialog-supporting-text-weight, var(--mat-sys-body-medium-weight, 400));letter-spacing:var(--mat-dialog-supporting-text-tracking, var(--mat-sys-body-medium-tracking, 0.03125em))}.mat-mdc-dialog-container .mat-mdc-dialog-content{padding:var(--mat-dialog-content-padding, 20px 24px)}.mat-mdc-dialog-container-with-actions .mat-mdc-dialog-content{padding:var(--mat-dialog-with-actions-content-padding, 20px 24px 0)}.mat-mdc-dialog-container .mat-mdc-dialog-title+.mat-mdc-dialog-content{padding-top:0}.mat-mdc-dialog-actions{display:flex;position:relative;flex-shrink:0;flex-wrap:wrap;align-items:center;box-sizing:border-box;min-height:52px;margin:0;border-top:1px solid rgba(0,0,0,0);padding:var(--mat-dialog-actions-padding, 16px 24px);justify-content:var(--mat-dialog-actions-alignment, flex-end)}@media(forced-colors: active){.mat-mdc-dialog-actions{border-top-color:CanvasText}}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-start,.mat-mdc-dialog-actions[align=start]{justify-content:start}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-center,.mat-mdc-dialog-actions[align=center]{justify-content:center}.mat-mdc-dialog-actions.mat-mdc-dialog-actions-align-end,.mat-mdc-dialog-actions[align=end]{justify-content:flex-end}.mat-mdc-dialog-actions .mat-button-base+.mat-button-base,.mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mat-mdc-dialog-actions .mat-button-base+.mat-button-base,[dir=rtl] .mat-mdc-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}.mat-mdc-dialog-component-host{display:contents}\n"]
224
+ }]
225
+ }]
226
+ });
306
227
  const TRANSITION_DURATION_PROPERTY = '--mat-dialog-transition-duration';
307
- // TODO(mmalerba): Remove this function after animation durations are required
308
- // to be numbers.
309
- /**
310
- * Converts a CSS time string to a number in ms. If the given time is already a
311
- * number, it is assumed to be in ms.
312
- */
313
228
  function parseCssTime(time) {
314
- if (time == null) {
315
- return null;
316
- }
317
- if (typeof time === 'number') {
318
- return time;
319
- }
320
- if (time.endsWith('ms')) {
321
- return coerceNumberProperty(time.substring(0, time.length - 2));
322
- }
323
- if (time.endsWith('s')) {
324
- return coerceNumberProperty(time.substring(0, time.length - 1)) * 1000;
325
- }
326
- if (time === '0') {
327
- return 0;
328
- }
329
- return null; // anything else is invalid.
229
+ if (time == null) {
230
+ return null;
231
+ }
232
+ if (typeof time === 'number') {
233
+ return time;
234
+ }
235
+ if (time.endsWith('ms')) {
236
+ return coerceNumberProperty(time.substring(0, time.length - 2));
237
+ }
238
+ if (time.endsWith('s')) {
239
+ return coerceNumberProperty(time.substring(0, time.length - 1)) * 1000;
240
+ }
241
+ if (time === '0') {
242
+ return 0;
243
+ }
244
+ return null;
330
245
  }
331
246
 
332
247
  var MatDialogState;
333
248
  (function (MatDialogState) {
334
- MatDialogState[MatDialogState["OPEN"] = 0] = "OPEN";
335
- MatDialogState[MatDialogState["CLOSING"] = 1] = "CLOSING";
336
- MatDialogState[MatDialogState["CLOSED"] = 2] = "CLOSED";
249
+ MatDialogState[MatDialogState["OPEN"] = 0] = "OPEN";
250
+ MatDialogState[MatDialogState["CLOSING"] = 1] = "CLOSING";
251
+ MatDialogState[MatDialogState["CLOSED"] = 2] = "CLOSED";
337
252
  })(MatDialogState || (MatDialogState = {}));
338
- /**
339
- * Reference to a dialog opened via the MatDialog service.
340
- */
341
253
  class MatDialogRef {
342
- _ref;
343
- _config;
344
- _containerInstance;
345
- /** The instance of component opened into the dialog. */
346
- componentInstance;
347
- /**
348
- * `ComponentRef` of the component opened into the dialog. Will be
349
- * null when the dialog is opened using a `TemplateRef`.
350
- */
351
- componentRef;
352
- /** Whether the user is allowed to close the dialog. */
353
- disableClose;
354
- /** Unique ID for the dialog. */
355
- id;
356
- /** Subject for notifying the user that the dialog has finished opening. */
357
- _afterOpened = new Subject();
358
- /** Subject for notifying the user that the dialog has started closing. */
359
- _beforeClosed = new Subject();
360
- /** Result to be passed to afterClosed. */
361
- _result;
362
- /** Handle to the timeout that's running as a fallback in case the exit animation doesn't fire. */
363
- _closeFallbackTimeout;
364
- /** Current state of the dialog. */
365
- _state = MatDialogState.OPEN;
366
- // TODO(crisbeto): we shouldn't have to declare this property, because `DialogRef.close`
367
- // already has a second `options` parameter that we can use. The problem is that internal tests
368
- // have assertions like `expect(MatDialogRef.close).toHaveBeenCalledWith(foo)` which will break,
369
- // because it'll be called with two arguments by things like `MatDialogClose`.
370
- /** Interaction that caused the dialog to close. */
371
- _closeInteractionType;
372
- constructor(_ref, _config, _containerInstance) {
373
- this._ref = _ref;
374
- this._config = _config;
375
- this._containerInstance = _containerInstance;
376
- this.disableClose = _config.disableClose;
377
- this.id = _ref.id;
378
- // Used to target panels specifically tied to dialogs.
379
- _ref.addPanelClass('mat-mdc-dialog-panel');
380
- // Emit when opening animation completes
381
- _containerInstance._animationStateChanged
382
- .pipe(filter(event => event.state === 'opened'), take(1))
383
- .subscribe(() => {
384
- this._afterOpened.next();
385
- this._afterOpened.complete();
386
- });
387
- // Dispose overlay when closing animation is complete
388
- _containerInstance._animationStateChanged
389
- .pipe(filter(event => event.state === 'closed'), take(1))
390
- .subscribe(() => {
391
- clearTimeout(this._closeFallbackTimeout);
392
- this._finishDialogClose();
393
- });
394
- _ref.overlayRef.detachments().subscribe(() => {
395
- this._beforeClosed.next(this._result);
396
- this._beforeClosed.complete();
397
- this._finishDialogClose();
398
- });
399
- merge(this.backdropClick(), this.keydownEvents().pipe(filter(event => event.keyCode === ESCAPE && !this.disableClose && !hasModifierKey(event)))).subscribe(event => {
400
- if (!this.disableClose) {
401
- event.preventDefault();
402
- _closeDialogVia(this, event.type === 'keydown' ? 'keyboard' : 'mouse');
403
- }
404
- });
405
- }
406
- /**
407
- * Close the dialog.
408
- * @param dialogResult Optional result to return to the dialog opener.
409
- */
410
- close(dialogResult) {
411
- const closePredicate = this._config.closePredicate;
412
- if (closePredicate && !closePredicate(dialogResult, this._config, this.componentInstance)) {
413
- return;
414
- }
415
- this._result = dialogResult;
416
- // Transition the backdrop in parallel to the dialog.
417
- this._containerInstance._animationStateChanged
418
- .pipe(filter(event => event.state === 'closing'), take(1))
419
- .subscribe(event => {
420
- this._beforeClosed.next(dialogResult);
421
- this._beforeClosed.complete();
422
- this._ref.overlayRef.detachBackdrop();
423
- // The logic that disposes of the overlay depends on the exit animation completing, however
424
- // it isn't guaranteed if the parent view is destroyed while it's running. Add a fallback
425
- // timeout which will clean everything up if the animation hasn't fired within the specified
426
- // amount of time plus 100ms. We don't need to run this outside the NgZone, because for the
427
- // vast majority of cases the timeout will have been cleared before it has the chance to fire.
428
- this._closeFallbackTimeout = setTimeout(() => this._finishDialogClose(), event.totalTime + 100);
429
- });
430
- this._state = MatDialogState.CLOSING;
431
- this._containerInstance._startExitAnimation();
432
- }
433
- /**
434
- * Gets an observable that is notified when the dialog is finished opening.
435
- */
436
- afterOpened() {
437
- return this._afterOpened;
438
- }
439
- /**
440
- * Gets an observable that is notified when the dialog is finished closing.
441
- */
442
- afterClosed() {
443
- return this._ref.closed;
444
- }
445
- /**
446
- * Gets an observable that is notified when the dialog has started closing.
447
- */
448
- beforeClosed() {
449
- return this._beforeClosed;
450
- }
451
- /**
452
- * Gets an observable that emits when the overlay's backdrop has been clicked.
453
- */
454
- backdropClick() {
455
- return this._ref.backdropClick;
456
- }
457
- /**
458
- * Gets an observable that emits when keydown events are targeted on the overlay.
459
- */
460
- keydownEvents() {
461
- return this._ref.keydownEvents;
462
- }
463
- /**
464
- * Updates the dialog's position.
465
- * @param position New dialog position.
466
- */
467
- updatePosition(position) {
468
- let strategy = this._ref.config.positionStrategy;
469
- if (position && (position.left || position.right)) {
470
- position.left ? strategy.left(position.left) : strategy.right(position.right);
471
- }
472
- else {
473
- strategy.centerHorizontally();
474
- }
475
- if (position && (position.top || position.bottom)) {
476
- position.top ? strategy.top(position.top) : strategy.bottom(position.bottom);
477
- }
478
- else {
479
- strategy.centerVertically();
480
- }
481
- this._ref.updatePosition();
482
- return this;
483
- }
484
- /**
485
- * Updates the dialog's width and height.
486
- * @param width New width of the dialog.
487
- * @param height New height of the dialog.
488
- */
489
- updateSize(width = '', height = '') {
490
- this._ref.updateSize(width, height);
491
- return this;
492
- }
493
- /** Add a CSS class or an array of classes to the overlay pane. */
494
- addPanelClass(classes) {
495
- this._ref.addPanelClass(classes);
496
- return this;
497
- }
498
- /** Remove a CSS class or an array of classes from the overlay pane. */
499
- removePanelClass(classes) {
500
- this._ref.removePanelClass(classes);
501
- return this;
502
- }
503
- /** Gets the current state of the dialog's lifecycle. */
504
- getState() {
505
- return this._state;
506
- }
507
- /**
508
- * Finishes the dialog close by updating the state of the dialog
509
- * and disposing the overlay.
510
- */
511
- _finishDialogClose() {
512
- this._state = MatDialogState.CLOSED;
513
- this._ref.close(this._result, { focusOrigin: this._closeInteractionType });
514
- this.componentInstance = null;
515
- }
254
+ _ref;
255
+ _config;
256
+ _containerInstance;
257
+ componentInstance;
258
+ componentRef;
259
+ disableClose;
260
+ id;
261
+ _afterOpened = new ReplaySubject(1);
262
+ _beforeClosed = new ReplaySubject(1);
263
+ _result;
264
+ _closeFallbackTimeout;
265
+ _state = MatDialogState.OPEN;
266
+ _closeInteractionType;
267
+ constructor(_ref, _config, _containerInstance) {
268
+ this._ref = _ref;
269
+ this._config = _config;
270
+ this._containerInstance = _containerInstance;
271
+ this.disableClose = _config.disableClose;
272
+ this.id = _ref.id;
273
+ _ref.addPanelClass('mat-mdc-dialog-panel');
274
+ _containerInstance._animationStateChanged.pipe(filter(event => event.state === 'opened'), take(1)).subscribe(() => {
275
+ this._afterOpened.next();
276
+ this._afterOpened.complete();
277
+ });
278
+ _containerInstance._animationStateChanged.pipe(filter(event => event.state === 'closed'), take(1)).subscribe(() => {
279
+ clearTimeout(this._closeFallbackTimeout);
280
+ this._finishDialogClose();
281
+ });
282
+ _ref.overlayRef.detachments().subscribe(() => {
283
+ this._beforeClosed.next(this._result);
284
+ this._beforeClosed.complete();
285
+ this._finishDialogClose();
286
+ });
287
+ merge(this.backdropClick(), this.keydownEvents().pipe(filter(event => event.keyCode === ESCAPE && !this.disableClose && !hasModifierKey(event)))).subscribe(event => {
288
+ if (!this.disableClose) {
289
+ event.preventDefault();
290
+ _closeDialogVia(this, event.type === 'keydown' ? 'keyboard' : 'mouse');
291
+ }
292
+ });
293
+ }
294
+ close(dialogResult) {
295
+ const closePredicate = this._config.closePredicate;
296
+ if (closePredicate && !closePredicate(dialogResult, this._config, this.componentInstance)) {
297
+ return;
298
+ }
299
+ this._result = dialogResult;
300
+ this._containerInstance._animationStateChanged.pipe(filter(event => event.state === 'closing'), take(1)).subscribe(event => {
301
+ this._beforeClosed.next(dialogResult);
302
+ this._beforeClosed.complete();
303
+ this._ref.overlayRef.detachBackdrop();
304
+ this._closeFallbackTimeout = setTimeout(() => this._finishDialogClose(), event.totalTime + 100);
305
+ });
306
+ this._state = MatDialogState.CLOSING;
307
+ this._containerInstance._startExitAnimation();
308
+ }
309
+ afterOpened() {
310
+ return this._afterOpened;
311
+ }
312
+ afterClosed() {
313
+ return this._ref.closed;
314
+ }
315
+ beforeClosed() {
316
+ return this._beforeClosed;
317
+ }
318
+ backdropClick() {
319
+ return this._ref.backdropClick;
320
+ }
321
+ keydownEvents() {
322
+ return this._ref.keydownEvents;
323
+ }
324
+ updatePosition(position) {
325
+ let strategy = this._ref.config.positionStrategy;
326
+ if (position && (position.left || position.right)) {
327
+ position.left ? strategy.left(position.left) : strategy.right(position.right);
328
+ } else {
329
+ strategy.centerHorizontally();
330
+ }
331
+ if (position && (position.top || position.bottom)) {
332
+ position.top ? strategy.top(position.top) : strategy.bottom(position.bottom);
333
+ } else {
334
+ strategy.centerVertically();
335
+ }
336
+ this._ref.updatePosition();
337
+ return this;
338
+ }
339
+ updateSize(width = '', height = '') {
340
+ this._ref.updateSize(width, height);
341
+ return this;
342
+ }
343
+ addPanelClass(classes) {
344
+ this._ref.addPanelClass(classes);
345
+ return this;
346
+ }
347
+ removePanelClass(classes) {
348
+ this._ref.removePanelClass(classes);
349
+ return this;
350
+ }
351
+ getState() {
352
+ return this._state;
353
+ }
354
+ _finishDialogClose() {
355
+ this._state = MatDialogState.CLOSED;
356
+ this._ref.close(this._result, {
357
+ focusOrigin: this._closeInteractionType
358
+ });
359
+ this.componentInstance = null;
360
+ }
516
361
  }
517
- /**
518
- * Closes the dialog with the specified interaction type. This is currently not part of
519
- * `MatDialogRef` as that would conflict with custom dialog ref mocks provided in tests.
520
- * More details. See: https://github.com/angular/components/pull/9257#issuecomment-651342226.
521
- */
522
- // TODO: Move this back into `MatDialogRef` when we provide an official mock dialog ref.
523
362
  function _closeDialogVia(ref, interactionType, result) {
524
- ref._closeInteractionType = interactionType;
525
- return ref.close(result);
363
+ ref._closeInteractionType = interactionType;
364
+ return ref.close(result);
526
365
  }
527
366
 
528
- /** Injection token that can be used to access the data that was passed in to a dialog. */
529
367
  const MAT_DIALOG_DATA = new InjectionToken('MatMdcDialogData');
530
- /** Injection token that can be used to specify default dialog options. */
531
368
  const MAT_DIALOG_DEFAULT_OPTIONS = new InjectionToken('mat-mdc-dialog-default-options');
532
- /** Injection token that determines the scroll handling while the dialog is open. */
533
369
  const MAT_DIALOG_SCROLL_STRATEGY = new InjectionToken('mat-mdc-dialog-scroll-strategy', {
534
- providedIn: 'root',
535
- factory: () => {
536
- const injector = inject(Injector);
537
- return () => createBlockScrollStrategy(injector);
538
- },
370
+ providedIn: 'root',
371
+ factory: () => {
372
+ const injector = inject(Injector);
373
+ return () => createBlockScrollStrategy(injector);
374
+ }
539
375
  });
540
- /**
541
- * Service to open Material Design modal dialogs.
542
- */
543
376
  class MatDialog {
544
- _defaultOptions = inject(MAT_DIALOG_DEFAULT_OPTIONS, { optional: true });
545
- _scrollStrategy = inject(MAT_DIALOG_SCROLL_STRATEGY);
546
- _parentDialog = inject(MatDialog, { optional: true, skipSelf: true });
547
- _idGenerator = inject(_IdGenerator);
548
- _injector = inject(Injector);
549
- _dialog = inject(Dialog);
550
- _animationsDisabled = _animationsDisabled();
551
- _openDialogsAtThisLevel = [];
552
- _afterAllClosedAtThisLevel = new Subject();
553
- _afterOpenedAtThisLevel = new Subject();
554
- dialogConfigClass = MatDialogConfig;
555
- _dialogRefConstructor;
556
- _dialogContainerType;
557
- _dialogDataToken;
558
- /** Keeps track of the currently-open dialogs. */
559
- get openDialogs() {
560
- return this._parentDialog ? this._parentDialog.openDialogs : this._openDialogsAtThisLevel;
561
- }
562
- /** Stream that emits when a dialog has been opened. */
563
- get afterOpened() {
564
- return this._parentDialog ? this._parentDialog.afterOpened : this._afterOpenedAtThisLevel;
565
- }
566
- _getAfterAllClosed() {
567
- const parent = this._parentDialog;
568
- return parent ? parent._getAfterAllClosed() : this._afterAllClosedAtThisLevel;
569
- }
570
- /**
571
- * Stream that emits when all open dialog have finished closing.
572
- * Will emit on subscribe if there are no open dialogs to begin with.
573
- */
574
- afterAllClosed = defer(() => this.openDialogs.length
575
- ? this._getAfterAllClosed()
576
- : this._getAfterAllClosed().pipe(startWith(undefined)));
577
- constructor() {
578
- this._dialogRefConstructor = MatDialogRef;
579
- this._dialogContainerType = MatDialogContainer;
580
- this._dialogDataToken = MAT_DIALOG_DATA;
581
- }
582
- open(componentOrTemplateRef, config) {
583
- let dialogRef;
584
- config = { ...(this._defaultOptions || new MatDialogConfig()), ...config };
585
- config.id = config.id || this._idGenerator.getId('mat-mdc-dialog-');
586
- config.scrollStrategy = config.scrollStrategy || this._scrollStrategy();
587
- const cdkRef = this._dialog.open(componentOrTemplateRef, {
588
- ...config,
589
- positionStrategy: createGlobalPositionStrategy(this._injector)
590
- .centerHorizontally()
591
- .centerVertically(),
592
- // Disable closing since we need to sync it up to the animation ourselves.
593
- disableClose: true,
594
- // Closing is tied to our animation so the close predicate has to be implemented separately.
595
- closePredicate: undefined,
596
- // Disable closing on destroy, because this service cleans up its open dialogs as well.
597
- // We want to do the cleanup here, rather than the CDK service, because the CDK destroys
598
- // the dialogs immediately whereas we want it to wait for the animations to finish.
599
- closeOnDestroy: false,
600
- // Disable closing on detachments so that we can sync up the animation.
601
- // The Material dialog ref handles this manually.
602
- closeOnOverlayDetachments: false,
603
- disableAnimations: this._animationsDisabled ||
604
- config.enterAnimationDuration?.toLocaleString() === '0' ||
605
- config.exitAnimationDuration?.toString() === '0',
606
- container: {
607
- type: this._dialogContainerType,
608
- providers: () => [
609
- // Provide our config as the CDK config as well since it has the same interface as the
610
- // CDK one, but it contains the actual values passed in by the user for things like
611
- // `disableClose` which we disable for the CDK dialog since we handle it ourselves.
612
- { provide: this.dialogConfigClass, useValue: config },
613
- { provide: DialogConfig, useValue: config },
614
- ],
615
- },
616
- templateContext: () => ({ dialogRef }),
617
- providers: (ref, cdkConfig, dialogContainer) => {
618
- dialogRef = new this._dialogRefConstructor(ref, config, dialogContainer);
619
- dialogRef.updatePosition(config?.position);
620
- return [
621
- { provide: this._dialogContainerType, useValue: dialogContainer },
622
- { provide: this._dialogDataToken, useValue: cdkConfig.data },
623
- { provide: this._dialogRefConstructor, useValue: dialogRef },
624
- ];
625
- },
626
- });
627
- // This can't be assigned in the `providers` callback, because
628
- // the instance hasn't been assigned to the CDK ref yet.
629
- dialogRef.componentRef = cdkRef.componentRef;
630
- dialogRef.componentInstance = cdkRef.componentInstance;
631
- this.openDialogs.push(dialogRef);
632
- this.afterOpened.next(dialogRef);
633
- dialogRef.afterClosed().subscribe(() => {
634
- const index = this.openDialogs.indexOf(dialogRef);
635
- if (index > -1) {
636
- this.openDialogs.splice(index, 1);
637
- if (!this.openDialogs.length) {
638
- this._getAfterAllClosed().next();
639
- }
640
- }
641
- });
642
- return dialogRef;
643
- }
644
- /**
645
- * Closes all of the currently-open dialogs.
646
- */
647
- closeAll() {
648
- this._closeDialogs(this.openDialogs);
649
- }
650
- /**
651
- * Finds an open dialog by its id.
652
- * @param id ID to use when looking up the dialog.
653
- */
654
- getDialogById(id) {
655
- return this.openDialogs.find(dialog => dialog.id === id);
656
- }
657
- ngOnDestroy() {
658
- // Only close the dialogs at this level on destroy
659
- // since the parent service may still be active.
660
- this._closeDialogs(this._openDialogsAtThisLevel);
661
- this._afterAllClosedAtThisLevel.complete();
662
- this._afterOpenedAtThisLevel.complete();
663
- }
664
- _closeDialogs(dialogs) {
665
- let i = dialogs.length;
666
- while (i--) {
667
- dialogs[i].close();
377
+ _defaultOptions = inject(MAT_DIALOG_DEFAULT_OPTIONS, {
378
+ optional: true
379
+ });
380
+ _scrollStrategy = inject(MAT_DIALOG_SCROLL_STRATEGY);
381
+ _parentDialog = inject(MatDialog, {
382
+ optional: true,
383
+ skipSelf: true
384
+ });
385
+ _idGenerator = inject(_IdGenerator);
386
+ _injector = inject(Injector);
387
+ _dialog = inject(Dialog);
388
+ _animationsDisabled = _animationsDisabled();
389
+ _openDialogsAtThisLevel = [];
390
+ _afterAllClosedAtThisLevel = new Subject();
391
+ _afterOpenedAtThisLevel = new Subject();
392
+ dialogConfigClass = MatDialogConfig;
393
+ _dialogRefConstructor;
394
+ _dialogContainerType;
395
+ _dialogDataToken;
396
+ get openDialogs() {
397
+ return this._parentDialog ? this._parentDialog.openDialogs : this._openDialogsAtThisLevel;
398
+ }
399
+ get afterOpened() {
400
+ return this._parentDialog ? this._parentDialog.afterOpened : this._afterOpenedAtThisLevel;
401
+ }
402
+ _getAfterAllClosed() {
403
+ const parent = this._parentDialog;
404
+ return parent ? parent._getAfterAllClosed() : this._afterAllClosedAtThisLevel;
405
+ }
406
+ afterAllClosed = defer(() => this.openDialogs.length ? this._getAfterAllClosed() : this._getAfterAllClosed().pipe(startWith(undefined)));
407
+ constructor() {
408
+ this._dialogRefConstructor = MatDialogRef;
409
+ this._dialogContainerType = MatDialogContainer;
410
+ this._dialogDataToken = MAT_DIALOG_DATA;
411
+ }
412
+ open(componentOrTemplateRef, config) {
413
+ let dialogRef;
414
+ config = {
415
+ ...(this._defaultOptions || new MatDialogConfig()),
416
+ ...config
417
+ };
418
+ config.id = config.id || this._idGenerator.getId('mat-mdc-dialog-');
419
+ config.scrollStrategy = config.scrollStrategy || this._scrollStrategy();
420
+ const cdkRef = this._dialog.open(componentOrTemplateRef, {
421
+ ...config,
422
+ positionStrategy: createGlobalPositionStrategy(this._injector).centerHorizontally().centerVertically(),
423
+ disableClose: true,
424
+ closePredicate: undefined,
425
+ closeOnDestroy: false,
426
+ closeOnOverlayDetachments: false,
427
+ disableAnimations: this._animationsDisabled || config.enterAnimationDuration?.toLocaleString() === '0' || config.exitAnimationDuration?.toString() === '0',
428
+ container: {
429
+ type: this._dialogContainerType,
430
+ providers: () => [{
431
+ provide: this.dialogConfigClass,
432
+ useValue: config
433
+ }, {
434
+ provide: DialogConfig,
435
+ useValue: config
436
+ }]
437
+ },
438
+ templateContext: () => ({
439
+ dialogRef
440
+ }),
441
+ providers: (ref, cdkConfig, dialogContainer) => {
442
+ dialogRef = new this._dialogRefConstructor(ref, config, dialogContainer);
443
+ dialogRef.updatePosition(config?.position);
444
+ return [{
445
+ provide: this._dialogContainerType,
446
+ useValue: dialogContainer
447
+ }, {
448
+ provide: this._dialogDataToken,
449
+ useValue: cdkConfig.data
450
+ }, {
451
+ provide: this._dialogRefConstructor,
452
+ useValue: dialogRef
453
+ }];
454
+ }
455
+ });
456
+ dialogRef.componentRef = cdkRef.componentRef;
457
+ dialogRef.componentInstance = cdkRef.componentInstance;
458
+ this.openDialogs.push(dialogRef);
459
+ this.afterOpened.next(dialogRef);
460
+ dialogRef.afterClosed().subscribe(() => {
461
+ const index = this.openDialogs.indexOf(dialogRef);
462
+ if (index > -1) {
463
+ this.openDialogs.splice(index, 1);
464
+ if (!this.openDialogs.length) {
465
+ this._getAfterAllClosed().next();
668
466
  }
669
- }
670
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialog, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
671
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialog, providedIn: 'root' });
467
+ }
468
+ });
469
+ return dialogRef;
470
+ }
471
+ closeAll() {
472
+ this._closeDialogs(this.openDialogs);
473
+ }
474
+ getDialogById(id) {
475
+ return this.openDialogs.find(dialog => dialog.id === id);
476
+ }
477
+ ngOnDestroy() {
478
+ this._closeDialogs(this._openDialogsAtThisLevel);
479
+ this._afterAllClosedAtThisLevel.complete();
480
+ this._afterOpenedAtThisLevel.complete();
481
+ }
482
+ _closeDialogs(dialogs) {
483
+ let i = dialogs.length;
484
+ while (i--) {
485
+ dialogs[i].close();
486
+ }
487
+ }
488
+ static ɵfac = i0.ɵɵngDeclareFactory({
489
+ minVersion: "12.0.0",
490
+ version: "20.2.0-next.2",
491
+ ngImport: i0,
492
+ type: MatDialog,
493
+ deps: [],
494
+ target: i0.ɵɵFactoryTarget.Injectable
495
+ });
496
+ static ɵprov = i0.ɵɵngDeclareInjectable({
497
+ minVersion: "12.0.0",
498
+ version: "20.2.0-next.2",
499
+ ngImport: i0,
500
+ type: MatDialog,
501
+ providedIn: 'root'
502
+ });
672
503
  }
673
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialog, decorators: [{
674
- type: Injectable,
675
- args: [{ providedIn: 'root' }]
676
- }], ctorParameters: () => [] });
504
+ i0.ɵɵngDeclareClassMetadata({
505
+ minVersion: "12.0.0",
506
+ version: "20.2.0-next.2",
507
+ ngImport: i0,
508
+ type: MatDialog,
509
+ decorators: [{
510
+ type: Injectable,
511
+ args: [{
512
+ providedIn: 'root'
513
+ }]
514
+ }],
515
+ ctorParameters: () => []
516
+ });
677
517
 
678
- /**
679
- * Button that will close the current dialog.
680
- */
681
518
  class MatDialogClose {
682
- dialogRef = inject(MatDialogRef, { optional: true });
683
- _elementRef = inject(ElementRef);
684
- _dialog = inject(MatDialog);
685
- /** Screen-reader label for the button. */
686
- ariaLabel;
687
- /** Default to "button" to prevents accidental form submits. */
688
- type = 'button';
689
- /** Dialog close input. */
690
- dialogResult;
691
- _matDialogClose;
692
- constructor() { }
693
- ngOnInit() {
694
- if (!this.dialogRef) {
695
- // When this directive is included in a dialog via TemplateRef (rather than being
696
- // in a Component), the DialogRef isn't available via injection because embedded
697
- // views cannot be given a custom injector. Instead, we look up the DialogRef by
698
- // ID. This must occur in `onInit`, as the ID binding for the dialog container won't
699
- // be resolved at constructor time.
700
- this.dialogRef = getClosestDialog(this._elementRef, this._dialog.openDialogs);
701
- }
702
- }
703
- ngOnChanges(changes) {
704
- const proxiedChange = changes['_matDialogClose'] || changes['_matDialogCloseResult'];
705
- if (proxiedChange) {
706
- this.dialogResult = proxiedChange.currentValue;
707
- }
708
- }
709
- _onButtonClick(event) {
710
- // Determinate the focus origin using the click event, because using the FocusMonitor will
711
- // result in incorrect origins. Most of the time, close buttons will be auto focused in the
712
- // dialog, and therefore clicking the button won't result in a focus change. This means that
713
- // the FocusMonitor won't detect any origin change, and will always output `program`.
714
- _closeDialogVia(this.dialogRef, event.screenX === 0 && event.screenY === 0 ? 'keyboard' : 'mouse', this.dialogResult);
715
- }
716
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialogClose, deps: [], target: i0.ɵɵFactoryTarget.Directive });
717
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: MatDialogClose, isStandalone: true, selector: "[mat-dialog-close], [matDialogClose]", inputs: { ariaLabel: ["aria-label", "ariaLabel"], type: "type", dialogResult: ["mat-dialog-close", "dialogResult"], _matDialogClose: ["matDialogClose", "_matDialogClose"] }, host: { listeners: { "click": "_onButtonClick($event)" }, properties: { "attr.aria-label": "ariaLabel || null", "attr.type": "type" } }, exportAs: ["matDialogClose"], usesOnChanges: true, ngImport: i0 });
519
+ dialogRef = inject(MatDialogRef, {
520
+ optional: true
521
+ });
522
+ _elementRef = inject(ElementRef);
523
+ _dialog = inject(MatDialog);
524
+ ariaLabel;
525
+ type = 'button';
526
+ dialogResult;
527
+ _matDialogClose;
528
+ constructor() {}
529
+ ngOnInit() {
530
+ if (!this.dialogRef) {
531
+ this.dialogRef = getClosestDialog(this._elementRef, this._dialog.openDialogs);
532
+ }
533
+ }
534
+ ngOnChanges(changes) {
535
+ const proxiedChange = changes['_matDialogClose'] || changes['_matDialogCloseResult'];
536
+ if (proxiedChange) {
537
+ this.dialogResult = proxiedChange.currentValue;
538
+ }
539
+ }
540
+ _onButtonClick(event) {
541
+ _closeDialogVia(this.dialogRef, event.screenX === 0 && event.screenY === 0 ? 'keyboard' : 'mouse', this.dialogResult);
542
+ }
543
+ static ɵfac = i0.ɵɵngDeclareFactory({
544
+ minVersion: "12.0.0",
545
+ version: "20.2.0-next.2",
546
+ ngImport: i0,
547
+ type: MatDialogClose,
548
+ deps: [],
549
+ target: i0.ɵɵFactoryTarget.Directive
550
+ });
551
+ static ɵdir = i0.ɵɵngDeclareDirective({
552
+ minVersion: "14.0.0",
553
+ version: "20.2.0-next.2",
554
+ type: MatDialogClose,
555
+ isStandalone: true,
556
+ selector: "[mat-dialog-close], [matDialogClose]",
557
+ inputs: {
558
+ ariaLabel: ["aria-label", "ariaLabel"],
559
+ type: "type",
560
+ dialogResult: ["mat-dialog-close", "dialogResult"],
561
+ _matDialogClose: ["matDialogClose", "_matDialogClose"]
562
+ },
563
+ host: {
564
+ listeners: {
565
+ "click": "_onButtonClick($event)"
566
+ },
567
+ properties: {
568
+ "attr.aria-label": "ariaLabel || null",
569
+ "attr.type": "type"
570
+ }
571
+ },
572
+ exportAs: ["matDialogClose"],
573
+ usesOnChanges: true,
574
+ ngImport: i0
575
+ });
718
576
  }
719
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialogClose, decorators: [{
720
- type: Directive,
721
- args: [{
722
- selector: '[mat-dialog-close], [matDialogClose]',
723
- exportAs: 'matDialogClose',
724
- host: {
725
- '(click)': '_onButtonClick($event)',
726
- '[attr.aria-label]': 'ariaLabel || null',
727
- '[attr.type]': 'type',
728
- },
729
- }]
730
- }], ctorParameters: () => [], propDecorators: { ariaLabel: [{
731
- type: Input,
732
- args: ['aria-label']
733
- }], type: [{
734
- type: Input
735
- }], dialogResult: [{
736
- type: Input,
737
- args: ['mat-dialog-close']
738
- }], _matDialogClose: [{
739
- type: Input,
740
- args: ['matDialogClose']
741
- }] } });
577
+ i0.ɵɵngDeclareClassMetadata({
578
+ minVersion: "12.0.0",
579
+ version: "20.2.0-next.2",
580
+ ngImport: i0,
581
+ type: MatDialogClose,
582
+ decorators: [{
583
+ type: Directive,
584
+ args: [{
585
+ selector: '[mat-dialog-close], [matDialogClose]',
586
+ exportAs: 'matDialogClose',
587
+ host: {
588
+ '(click)': '_onButtonClick($event)',
589
+ '[attr.aria-label]': 'ariaLabel || null',
590
+ '[attr.type]': 'type'
591
+ }
592
+ }]
593
+ }],
594
+ ctorParameters: () => [],
595
+ propDecorators: {
596
+ ariaLabel: [{
597
+ type: Input,
598
+ args: ['aria-label']
599
+ }],
600
+ type: [{
601
+ type: Input
602
+ }],
603
+ dialogResult: [{
604
+ type: Input,
605
+ args: ['mat-dialog-close']
606
+ }],
607
+ _matDialogClose: [{
608
+ type: Input,
609
+ args: ['matDialogClose']
610
+ }]
611
+ }
612
+ });
742
613
  class MatDialogLayoutSection {
743
- _dialogRef = inject(MatDialogRef, { optional: true });
744
- _elementRef = inject(ElementRef);
745
- _dialog = inject(MatDialog);
746
- constructor() { }
747
- ngOnInit() {
748
- if (!this._dialogRef) {
749
- this._dialogRef = getClosestDialog(this._elementRef, this._dialog.openDialogs);
750
- }
751
- if (this._dialogRef) {
752
- Promise.resolve().then(() => {
753
- this._onAdd();
754
- });
755
- }
756
- }
757
- ngOnDestroy() {
758
- // Note: we null check because there are some internal
759
- // tests that are mocking out `MatDialogRef` incorrectly.
760
- const instance = this._dialogRef?._containerInstance;
761
- if (instance) {
762
- Promise.resolve().then(() => {
763
- this._onRemove();
764
- });
765
- }
766
- }
767
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialogLayoutSection, deps: [], target: i0.ɵɵFactoryTarget.Directive });
768
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: MatDialogLayoutSection, isStandalone: true, ngImport: i0 });
614
+ _dialogRef = inject(MatDialogRef, {
615
+ optional: true
616
+ });
617
+ _elementRef = inject(ElementRef);
618
+ _dialog = inject(MatDialog);
619
+ constructor() {}
620
+ ngOnInit() {
621
+ if (!this._dialogRef) {
622
+ this._dialogRef = getClosestDialog(this._elementRef, this._dialog.openDialogs);
623
+ }
624
+ if (this._dialogRef) {
625
+ Promise.resolve().then(() => {
626
+ this._onAdd();
627
+ });
628
+ }
629
+ }
630
+ ngOnDestroy() {
631
+ const instance = this._dialogRef?._containerInstance;
632
+ if (instance) {
633
+ Promise.resolve().then(() => {
634
+ this._onRemove();
635
+ });
636
+ }
637
+ }
638
+ static ɵfac = i0.ɵɵngDeclareFactory({
639
+ minVersion: "12.0.0",
640
+ version: "20.2.0-next.2",
641
+ ngImport: i0,
642
+ type: MatDialogLayoutSection,
643
+ deps: [],
644
+ target: i0.ɵɵFactoryTarget.Directive
645
+ });
646
+ static ɵdir = i0.ɵɵngDeclareDirective({
647
+ minVersion: "14.0.0",
648
+ version: "20.2.0-next.2",
649
+ type: MatDialogLayoutSection,
650
+ isStandalone: true,
651
+ ngImport: i0
652
+ });
769
653
  }
770
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialogLayoutSection, decorators: [{
771
- type: Directive
772
- }], ctorParameters: () => [] });
773
- /**
774
- * Title of a dialog element. Stays fixed to the top of the dialog when scrolling.
775
- */
654
+ i0.ɵɵngDeclareClassMetadata({
655
+ minVersion: "12.0.0",
656
+ version: "20.2.0-next.2",
657
+ ngImport: i0,
658
+ type: MatDialogLayoutSection,
659
+ decorators: [{
660
+ type: Directive
661
+ }],
662
+ ctorParameters: () => []
663
+ });
776
664
  class MatDialogTitle extends MatDialogLayoutSection {
777
- id = inject(_IdGenerator).getId('mat-mdc-dialog-title-');
778
- _onAdd() {
779
- // Note: we null check the queue, because there are some internal
780
- // tests that are mocking out `MatDialogRef` incorrectly.
781
- this._dialogRef._containerInstance?._addAriaLabelledBy?.(this.id);
782
- }
783
- _onRemove() {
784
- this._dialogRef?._containerInstance?._removeAriaLabelledBy?.(this.id);
785
- }
786
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialogTitle, deps: null, target: i0.ɵɵFactoryTarget.Directive });
787
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: MatDialogTitle, isStandalone: true, selector: "[mat-dialog-title], [matDialogTitle]", inputs: { id: "id" }, host: { properties: { "id": "id" }, classAttribute: "mat-mdc-dialog-title mdc-dialog__title" }, exportAs: ["matDialogTitle"], usesInheritance: true, ngImport: i0 });
665
+ id = inject(_IdGenerator).getId('mat-mdc-dialog-title-');
666
+ _onAdd() {
667
+ this._dialogRef._containerInstance?._addAriaLabelledBy?.(this.id);
668
+ }
669
+ _onRemove() {
670
+ this._dialogRef?._containerInstance?._removeAriaLabelledBy?.(this.id);
671
+ }
672
+ static ɵfac = i0.ɵɵngDeclareFactory({
673
+ minVersion: "12.0.0",
674
+ version: "20.2.0-next.2",
675
+ ngImport: i0,
676
+ type: MatDialogTitle,
677
+ deps: null,
678
+ target: i0.ɵɵFactoryTarget.Directive
679
+ });
680
+ static ɵdir = i0.ɵɵngDeclareDirective({
681
+ minVersion: "14.0.0",
682
+ version: "20.2.0-next.2",
683
+ type: MatDialogTitle,
684
+ isStandalone: true,
685
+ selector: "[mat-dialog-title], [matDialogTitle]",
686
+ inputs: {
687
+ id: "id"
688
+ },
689
+ host: {
690
+ properties: {
691
+ "id": "id"
692
+ },
693
+ classAttribute: "mat-mdc-dialog-title mdc-dialog__title"
694
+ },
695
+ exportAs: ["matDialogTitle"],
696
+ usesInheritance: true,
697
+ ngImport: i0
698
+ });
788
699
  }
789
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialogTitle, decorators: [{
790
- type: Directive,
791
- args: [{
792
- selector: '[mat-dialog-title], [matDialogTitle]',
793
- exportAs: 'matDialogTitle',
794
- host: {
795
- 'class': 'mat-mdc-dialog-title mdc-dialog__title',
796
- '[id]': 'id',
797
- },
798
- }]
799
- }], propDecorators: { id: [{
800
- type: Input
801
- }] } });
802
- /**
803
- * Scrollable content container of a dialog.
804
- */
700
+ i0.ɵɵngDeclareClassMetadata({
701
+ minVersion: "12.0.0",
702
+ version: "20.2.0-next.2",
703
+ ngImport: i0,
704
+ type: MatDialogTitle,
705
+ decorators: [{
706
+ type: Directive,
707
+ args: [{
708
+ selector: '[mat-dialog-title], [matDialogTitle]',
709
+ exportAs: 'matDialogTitle',
710
+ host: {
711
+ 'class': 'mat-mdc-dialog-title mdc-dialog__title',
712
+ '[id]': 'id'
713
+ }
714
+ }]
715
+ }],
716
+ propDecorators: {
717
+ id: [{
718
+ type: Input
719
+ }]
720
+ }
721
+ });
805
722
  class MatDialogContent {
806
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialogContent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
807
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: MatDialogContent, isStandalone: true, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]", host: { classAttribute: "mat-mdc-dialog-content mdc-dialog__content" }, hostDirectives: [{ directive: i1.CdkScrollable }], ngImport: i0 });
723
+ static ɵfac = i0.ɵɵngDeclareFactory({
724
+ minVersion: "12.0.0",
725
+ version: "20.2.0-next.2",
726
+ ngImport: i0,
727
+ type: MatDialogContent,
728
+ deps: [],
729
+ target: i0.ɵɵFactoryTarget.Directive
730
+ });
731
+ static ɵdir = i0.ɵɵngDeclareDirective({
732
+ minVersion: "14.0.0",
733
+ version: "20.2.0-next.2",
734
+ type: MatDialogContent,
735
+ isStandalone: true,
736
+ selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]",
737
+ host: {
738
+ classAttribute: "mat-mdc-dialog-content mdc-dialog__content"
739
+ },
740
+ hostDirectives: [{
741
+ directive: i1.CdkScrollable
742
+ }],
743
+ ngImport: i0
744
+ });
808
745
  }
809
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialogContent, decorators: [{
810
- type: Directive,
811
- args: [{
812
- selector: `[mat-dialog-content], mat-dialog-content, [matDialogContent]`,
813
- host: { 'class': 'mat-mdc-dialog-content mdc-dialog__content' },
814
- hostDirectives: [CdkScrollable],
815
- }]
816
- }] });
817
- /**
818
- * Container for the bottom action buttons in a dialog.
819
- * Stays fixed to the bottom when scrolling.
820
- */
746
+ i0.ɵɵngDeclareClassMetadata({
747
+ minVersion: "12.0.0",
748
+ version: "20.2.0-next.2",
749
+ ngImport: i0,
750
+ type: MatDialogContent,
751
+ decorators: [{
752
+ type: Directive,
753
+ args: [{
754
+ selector: `[mat-dialog-content], mat-dialog-content, [matDialogContent]`,
755
+ host: {
756
+ 'class': 'mat-mdc-dialog-content mdc-dialog__content'
757
+ },
758
+ hostDirectives: [CdkScrollable]
759
+ }]
760
+ }]
761
+ });
821
762
  class MatDialogActions extends MatDialogLayoutSection {
822
- /**
823
- * Horizontal alignment of action buttons.
824
- */
825
- align;
826
- _onAdd() {
827
- this._dialogRef._containerInstance?._updateActionSectionCount?.(1);
828
- }
829
- _onRemove() {
830
- this._dialogRef._containerInstance?._updateActionSectionCount?.(-1);
831
- }
832
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialogActions, deps: null, target: i0.ɵɵFactoryTarget.Directive });
833
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.2.0-next.2", type: MatDialogActions, isStandalone: true, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: { align: "align" }, host: { properties: { "class.mat-mdc-dialog-actions-align-start": "align === \"start\"", "class.mat-mdc-dialog-actions-align-center": "align === \"center\"", "class.mat-mdc-dialog-actions-align-end": "align === \"end\"" }, classAttribute: "mat-mdc-dialog-actions mdc-dialog__actions" }, usesInheritance: true, ngImport: i0 });
763
+ align;
764
+ _onAdd() {
765
+ this._dialogRef._containerInstance?._updateActionSectionCount?.(1);
766
+ }
767
+ _onRemove() {
768
+ this._dialogRef._containerInstance?._updateActionSectionCount?.(-1);
769
+ }
770
+ static ɵfac = i0.ɵɵngDeclareFactory({
771
+ minVersion: "12.0.0",
772
+ version: "20.2.0-next.2",
773
+ ngImport: i0,
774
+ type: MatDialogActions,
775
+ deps: null,
776
+ target: i0.ɵɵFactoryTarget.Directive
777
+ });
778
+ static ɵdir = i0.ɵɵngDeclareDirective({
779
+ minVersion: "14.0.0",
780
+ version: "20.2.0-next.2",
781
+ type: MatDialogActions,
782
+ isStandalone: true,
783
+ selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]",
784
+ inputs: {
785
+ align: "align"
786
+ },
787
+ host: {
788
+ properties: {
789
+ "class.mat-mdc-dialog-actions-align-start": "align === \"start\"",
790
+ "class.mat-mdc-dialog-actions-align-center": "align === \"center\"",
791
+ "class.mat-mdc-dialog-actions-align-end": "align === \"end\""
792
+ },
793
+ classAttribute: "mat-mdc-dialog-actions mdc-dialog__actions"
794
+ },
795
+ usesInheritance: true,
796
+ ngImport: i0
797
+ });
834
798
  }
835
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialogActions, decorators: [{
836
- type: Directive,
837
- args: [{
838
- selector: `[mat-dialog-actions], mat-dialog-actions, [matDialogActions]`,
839
- host: {
840
- 'class': 'mat-mdc-dialog-actions mdc-dialog__actions',
841
- '[class.mat-mdc-dialog-actions-align-start]': 'align === "start"',
842
- '[class.mat-mdc-dialog-actions-align-center]': 'align === "center"',
843
- '[class.mat-mdc-dialog-actions-align-end]': 'align === "end"',
844
- },
845
- }]
846
- }], propDecorators: { align: [{
847
- type: Input
848
- }] } });
849
- /**
850
- * Finds the closest MatDialogRef to an element by looking at the DOM.
851
- * @param element Element relative to which to look for a dialog.
852
- * @param openDialogs References to the currently-open dialogs.
853
- */
799
+ i0.ɵɵngDeclareClassMetadata({
800
+ minVersion: "12.0.0",
801
+ version: "20.2.0-next.2",
802
+ ngImport: i0,
803
+ type: MatDialogActions,
804
+ decorators: [{
805
+ type: Directive,
806
+ args: [{
807
+ selector: `[mat-dialog-actions], mat-dialog-actions, [matDialogActions]`,
808
+ host: {
809
+ 'class': 'mat-mdc-dialog-actions mdc-dialog__actions',
810
+ '[class.mat-mdc-dialog-actions-align-start]': 'align === "start"',
811
+ '[class.mat-mdc-dialog-actions-align-center]': 'align === "center"',
812
+ '[class.mat-mdc-dialog-actions-align-end]': 'align === "end"'
813
+ }
814
+ }]
815
+ }],
816
+ propDecorators: {
817
+ align: [{
818
+ type: Input
819
+ }]
820
+ }
821
+ });
854
822
  function getClosestDialog(element, openDialogs) {
855
- let parent = element.nativeElement.parentElement;
856
- while (parent && !parent.classList.contains('mat-mdc-dialog-container')) {
857
- parent = parent.parentElement;
858
- }
859
- return parent ? openDialogs.find(dialog => dialog.id === parent.id) : null;
823
+ let parent = element.nativeElement.parentElement;
824
+ while (parent && !parent.classList.contains('mat-mdc-dialog-container')) {
825
+ parent = parent.parentElement;
826
+ }
827
+ return parent ? openDialogs.find(dialog => dialog.id === parent.id) : null;
860
828
  }
861
829
 
862
- const DIRECTIVES = [
863
- MatDialogContainer,
864
- MatDialogClose,
865
- MatDialogTitle,
866
- MatDialogActions,
867
- MatDialogContent,
868
- ];
830
+ const DIRECTIVES = [MatDialogContainer, MatDialogClose, MatDialogTitle, MatDialogActions, MatDialogContent];
869
831
  class MatDialogModule {
870
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
871
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialogModule, imports: [DialogModule, OverlayModule, PortalModule, MatDialogContainer,
872
- MatDialogClose,
873
- MatDialogTitle,
874
- MatDialogActions,
875
- MatDialogContent], exports: [BidiModule, MatDialogContainer,
876
- MatDialogClose,
877
- MatDialogTitle,
878
- MatDialogActions,
879
- MatDialogContent] });
880
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialogModule, providers: [MatDialog], imports: [DialogModule, OverlayModule, PortalModule, BidiModule] });
832
+ static ɵfac = i0.ɵɵngDeclareFactory({
833
+ minVersion: "12.0.0",
834
+ version: "20.2.0-next.2",
835
+ ngImport: i0,
836
+ type: MatDialogModule,
837
+ deps: [],
838
+ target: i0.ɵɵFactoryTarget.NgModule
839
+ });
840
+ static ɵmod = i0.ɵɵngDeclareNgModule({
841
+ minVersion: "14.0.0",
842
+ version: "20.2.0-next.2",
843
+ ngImport: i0,
844
+ type: MatDialogModule,
845
+ imports: [DialogModule, OverlayModule, PortalModule, MatDialogContainer, MatDialogClose, MatDialogTitle, MatDialogActions, MatDialogContent],
846
+ exports: [BidiModule, MatDialogContainer, MatDialogClose, MatDialogTitle, MatDialogActions, MatDialogContent]
847
+ });
848
+ static ɵinj = i0.ɵɵngDeclareInjector({
849
+ minVersion: "12.0.0",
850
+ version: "20.2.0-next.2",
851
+ ngImport: i0,
852
+ type: MatDialogModule,
853
+ providers: [MatDialog],
854
+ imports: [DialogModule, OverlayModule, PortalModule, BidiModule]
855
+ });
881
856
  }
882
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: MatDialogModule, decorators: [{
883
- type: NgModule,
884
- args: [{
885
- imports: [DialogModule, OverlayModule, PortalModule, ...DIRECTIVES],
886
- exports: [BidiModule, ...DIRECTIVES],
887
- providers: [MatDialog],
888
- }]
889
- }] });
857
+ i0.ɵɵngDeclareClassMetadata({
858
+ minVersion: "12.0.0",
859
+ version: "20.2.0-next.2",
860
+ ngImport: i0,
861
+ type: MatDialogModule,
862
+ decorators: [{
863
+ type: NgModule,
864
+ args: [{
865
+ imports: [DialogModule, OverlayModule, PortalModule, ...DIRECTIVES],
866
+ exports: [BidiModule, ...DIRECTIVES],
867
+ providers: [MatDialog]
868
+ }]
869
+ }]
870
+ });
890
871
 
891
872
  export { MAT_DIALOG_DATA, MAT_DIALOG_DEFAULT_OPTIONS, MAT_DIALOG_SCROLL_STRATEGY, MatDialog, MatDialogActions, MatDialogClose, MatDialogConfig, MatDialogContainer, MatDialogContent, MatDialogModule, MatDialogRef, MatDialogState, MatDialogTitle, _closeDialogVia };
892
873
  //# sourceMappingURL=dialog.mjs.map