module-BnDTus5c.mjs 53 KB

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