legacy-dialog.mjs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. import { DialogModule } from '@angular/cdk/dialog';
  2. import * as i1$1 from '@angular/cdk/overlay';
  3. import { Overlay, OverlayModule } from '@angular/cdk/overlay';
  4. import * as i4 from '@angular/cdk/portal';
  5. import { PortalModule } from '@angular/cdk/portal';
  6. import * as i0 from '@angular/core';
  7. import { Component, ViewEncapsulation, ChangeDetectionStrategy, Optional, Inject, InjectionToken, Injectable, SkipSelf, Directive, Input, NgModule } from '@angular/core';
  8. import { MatCommonModule } from '@angular/material/core';
  9. import * as i2 from '@angular/common';
  10. import { DOCUMENT } from '@angular/common';
  11. import * as i1 from '@angular/cdk/a11y';
  12. import { MatDialogConfig, _defaultParams, _MatDialogContainerBase, matDialogAnimations, MatDialogRef, _MatDialogBase, _closeDialogVia } from '@angular/material/dialog';
  13. export { MAT_DIALOG_SCROLL_STRATEGY_FACTORY as MAT_LEGACY_DIALOG_SCROLL_STRATEGY_FACTORY, _MatDialogBase as _MatLegacyDialogBase, _MatDialogContainerBase as _MatLegacyDialogContainerBase, _closeDialogVia as _closeLegacyDialogVia, matDialogAnimations as matLegacyDialogAnimations } from '@angular/material/dialog';
  14. import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
  15. /**
  16. * Default parameters for the animation for backwards compatibility.
  17. * @docs-private
  18. * @deprecated Use `defaultParams` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
  19. * @breaking-change 17.0.0
  20. */
  21. const defaultParams = {
  22. params: { enterAnimationDuration: '150ms', exitAnimationDuration: '75ms' },
  23. };
  24. /**
  25. * @deprecated Use `MatDialogConfig` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
  26. * @breaking-change 17.0.0
  27. */
  28. class MatLegacyDialogConfig extends MatDialogConfig {
  29. constructor() {
  30. super(...arguments);
  31. /** Duration of the enter animation. Has to be a valid CSS value (e.g. 100ms). */
  32. this.enterAnimationDuration = _defaultParams.params.enterAnimationDuration;
  33. /** Duration of the exit animation. Has to be a valid CSS value (e.g. 50ms). */
  34. this.exitAnimationDuration = _defaultParams.params.exitAnimationDuration;
  35. }
  36. }
  37. /**
  38. * Internal component that wraps user-provided dialog content.
  39. * Animation is based on https://material.io/guidelines/motion/choreography.html.
  40. * @docs-private
  41. * @deprecated Use `MatDialogContainer` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
  42. * @breaking-change 17.0.0
  43. */
  44. class MatLegacyDialogContainer extends _MatDialogContainerBase {
  45. /** Callback, invoked whenever an animation on the host completes. */
  46. _onAnimationDone({ toState, totalTime }) {
  47. if (toState === 'enter') {
  48. this._openAnimationDone(totalTime);
  49. }
  50. else if (toState === 'exit') {
  51. this._animationStateChanged.next({ state: 'closed', totalTime });
  52. }
  53. }
  54. /** Callback, invoked when an animation on the host starts. */
  55. _onAnimationStart({ toState, totalTime }) {
  56. if (toState === 'enter') {
  57. this._animationStateChanged.next({ state: 'opening', totalTime });
  58. }
  59. else if (toState === 'exit' || toState === 'void') {
  60. this._animationStateChanged.next({ state: 'closing', totalTime });
  61. }
  62. }
  63. /** Starts the dialog exit animation. */
  64. _startExitAnimation() {
  65. this._state = 'exit';
  66. // Mark the container for check so it can react if the
  67. // view container is using OnPush change detection.
  68. this._changeDetectorRef.markForCheck();
  69. }
  70. constructor(elementRef, focusTrapFactory, document, dialogConfig, checker, ngZone, overlayRef, _changeDetectorRef, focusMonitor) {
  71. super(elementRef, focusTrapFactory, document, dialogConfig, checker, ngZone, overlayRef, focusMonitor);
  72. this._changeDetectorRef = _changeDetectorRef;
  73. /** State of the dialog animation. */
  74. this._state = 'enter';
  75. }
  76. _getAnimationState() {
  77. return {
  78. value: this._state,
  79. params: {
  80. 'enterAnimationDuration': this._config.enterAnimationDuration || defaultParams.params.enterAnimationDuration,
  81. 'exitAnimationDuration': this._config.exitAnimationDuration || defaultParams.params.exitAnimationDuration,
  82. },
  83. };
  84. }
  85. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MatLegacyDialogContainer, deps: [{ token: i0.ElementRef }, { token: i1.FocusTrapFactory }, { token: DOCUMENT, optional: true }, { token: MatLegacyDialogConfig }, { token: i1.InteractivityChecker }, { token: i0.NgZone }, { token: i1$1.OverlayRef }, { token: i0.ChangeDetectorRef }, { token: i1.FocusMonitor }], target: i0.ɵɵFactoryTarget.Component }); }
  86. static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.0.0", type: MatLegacyDialogContainer, selector: "mat-dialog-container", host: { attributes: { "tabindex": "-1" }, listeners: { "@dialogContainer.start": "_onAnimationStart($event)", "@dialogContainer.done": "_onAnimationDone($event)" }, properties: { "attr.aria-modal": "_config.ariaModal", "id": "_config.id", "attr.role": "_config.role", "attr.aria-labelledby": "_config.ariaLabel ? null : _ariaLabelledBy", "attr.aria-label": "_config.ariaLabel", "attr.aria-describedby": "_config.ariaDescribedBy || null", "@dialogContainer": "_getAnimationState()" }, classAttribute: "mat-dialog-container" }, usesInheritance: true, ngImport: i0, template: "<ng-template cdkPortalOutlet></ng-template>\n", styles: [".mat-dialog-container{display:block;padding:24px;border-radius:4px;box-sizing:border-box;overflow:auto;outline:0;width:100%;height:100%;min-height:inherit;max-height:inherit}.cdk-high-contrast-active .mat-dialog-container{outline:solid 1px}.mat-dialog-content{display:block;margin:0 -24px;padding:0 24px;max-height:65vh;overflow:auto;-webkit-overflow-scrolling:touch}.mat-dialog-title{margin:0 0 20px;display:block}.mat-dialog-actions{padding:8px 0;display:flex;flex-wrap:wrap;min-height:52px;align-items:center;box-sizing:content-box;margin-bottom:-24px}.mat-dialog-actions.mat-dialog-actions-align-center,.mat-dialog-actions[align=center]{justify-content:center}.mat-dialog-actions.mat-dialog-actions-align-end,.mat-dialog-actions[align=end]{justify-content:flex-end}.mat-dialog-actions .mat-button-base+.mat-button-base,.mat-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mat-dialog-actions .mat-button-base+.mat-button-base,[dir=rtl] .mat-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}"], dependencies: [{ kind: "directive", type: i4.CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }], animations: [matDialogAnimations.dialogContainer], changeDetection: i0.ChangeDetectionStrategy.Default, encapsulation: i0.ViewEncapsulation.None }); }
  87. }
  88. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MatLegacyDialogContainer, decorators: [{
  89. type: Component,
  90. args: [{ selector: 'mat-dialog-container', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.Default, animations: [matDialogAnimations.dialogContainer], host: {
  91. 'class': 'mat-dialog-container',
  92. 'tabindex': '-1',
  93. '[attr.aria-modal]': '_config.ariaModal',
  94. '[id]': '_config.id',
  95. '[attr.role]': '_config.role',
  96. '[attr.aria-labelledby]': '_config.ariaLabel ? null : _ariaLabelledBy',
  97. '[attr.aria-label]': '_config.ariaLabel',
  98. '[attr.aria-describedby]': '_config.ariaDescribedBy || null',
  99. '[@dialogContainer]': `_getAnimationState()`,
  100. '(@dialogContainer.start)': '_onAnimationStart($event)',
  101. '(@dialogContainer.done)': '_onAnimationDone($event)',
  102. }, template: "<ng-template cdkPortalOutlet></ng-template>\n", styles: [".mat-dialog-container{display:block;padding:24px;border-radius:4px;box-sizing:border-box;overflow:auto;outline:0;width:100%;height:100%;min-height:inherit;max-height:inherit}.cdk-high-contrast-active .mat-dialog-container{outline:solid 1px}.mat-dialog-content{display:block;margin:0 -24px;padding:0 24px;max-height:65vh;overflow:auto;-webkit-overflow-scrolling:touch}.mat-dialog-title{margin:0 0 20px;display:block}.mat-dialog-actions{padding:8px 0;display:flex;flex-wrap:wrap;min-height:52px;align-items:center;box-sizing:content-box;margin-bottom:-24px}.mat-dialog-actions.mat-dialog-actions-align-center,.mat-dialog-actions[align=center]{justify-content:center}.mat-dialog-actions.mat-dialog-actions-align-end,.mat-dialog-actions[align=end]{justify-content:flex-end}.mat-dialog-actions .mat-button-base+.mat-button-base,.mat-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mat-dialog-actions .mat-button-base+.mat-button-base,[dir=rtl] .mat-dialog-actions .mat-mdc-button-base+.mat-mdc-button-base{margin-left:0;margin-right:8px}"] }]
  103. }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.FocusTrapFactory }, { type: undefined, decorators: [{
  104. type: Optional
  105. }, {
  106. type: Inject,
  107. args: [DOCUMENT]
  108. }] }, { type: MatLegacyDialogConfig }, { type: i1.InteractivityChecker }, { type: i0.NgZone }, { type: i1$1.OverlayRef }, { type: i0.ChangeDetectorRef }, { type: i1.FocusMonitor }]; } });
  109. /**
  110. * Reference to a dialog opened via the MatDialog service.
  111. * @deprecated Use `MatDialogRef` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
  112. * @breaking-change 17.0.0
  113. */
  114. class MatLegacyDialogRef extends MatDialogRef {
  115. }
  116. /**
  117. * Injection token that can be used to access the data that was passed in to a dialog.
  118. * @deprecated Use `MAT_DIALOG_DATA` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
  119. * @breaking-change 17.0.0
  120. */
  121. const MAT_LEGACY_DIALOG_DATA = new InjectionToken('MatDialogData');
  122. /**
  123. * Injection token that can be used to specify default dialog options.
  124. * @deprecated Use `MAT_DIALOG_DEFAULT_OPTIONS` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
  125. * @breaking-change 17.0.0
  126. */
  127. const MAT_LEGACY_DIALOG_DEFAULT_OPTIONS = new InjectionToken('mat-dialog-default-options');
  128. /**
  129. * Injection token that determines the scroll handling while the dialog is open.
  130. * @deprecated Use `MAT_DIALOG_SCROLL_STRATEGY` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
  131. * @breaking-change 17.0.0
  132. */
  133. const MAT_LEGACY_DIALOG_SCROLL_STRATEGY = new InjectionToken('mat-dialog-scroll-strategy');
  134. /**
  135. * @docs-private
  136. * @deprecated Use `MAT_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
  137. * @breaking-change 17.0.0
  138. */
  139. function MAT_LEGACY_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay) {
  140. return () => overlay.scrollStrategies.block();
  141. }
  142. /**
  143. * @docs-private
  144. * @deprecated Use `MAT_DIALOG_SCROLL_STRATEGY_PROVIDER` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
  145. * @breaking-change 17.0.0
  146. */
  147. const MAT_LEGACY_DIALOG_SCROLL_STRATEGY_PROVIDER = {
  148. provide: MAT_LEGACY_DIALOG_SCROLL_STRATEGY,
  149. deps: [Overlay],
  150. useFactory: MAT_LEGACY_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY,
  151. };
  152. /**
  153. * Service to open Material Design modal dialogs.
  154. * @deprecated Use `MatDialog` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
  155. * @breaking-change 17.0.0
  156. */
  157. class MatLegacyDialog extends _MatDialogBase {
  158. constructor(overlay, injector,
  159. /**
  160. * @deprecated `_location` parameter to be removed.
  161. * @breaking-change 10.0.0
  162. */
  163. _location, defaultOptions, scrollStrategy, parentDialog,
  164. /**
  165. * @deprecated No longer used. To be removed.
  166. * @breaking-change 15.0.0
  167. */
  168. overlayContainer,
  169. /**
  170. * @deprecated No longer used. To be removed.
  171. * @breaking-change 14.0.0
  172. */
  173. animationMode) {
  174. super(overlay, injector, defaultOptions, parentDialog, overlayContainer, scrollStrategy, MatLegacyDialogRef, MatLegacyDialogContainer, MAT_LEGACY_DIALOG_DATA, animationMode);
  175. this.dialogConfigClass = MatLegacyDialogConfig;
  176. }
  177. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MatLegacyDialog, deps: [{ token: i1$1.Overlay }, { token: i0.Injector }, { token: i2.Location, optional: true }, { token: MAT_LEGACY_DIALOG_DEFAULT_OPTIONS, optional: true }, { token: MAT_LEGACY_DIALOG_SCROLL_STRATEGY }, { token: MatLegacyDialog, optional: true, skipSelf: true }, { token: i1$1.OverlayContainer }, { token: ANIMATION_MODULE_TYPE, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
  178. static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MatLegacyDialog }); }
  179. }
  180. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MatLegacyDialog, decorators: [{
  181. type: Injectable
  182. }], ctorParameters: function () { return [{ type: i1$1.Overlay }, { type: i0.Injector }, { type: i2.Location, decorators: [{
  183. type: Optional
  184. }] }, { type: MatLegacyDialogConfig, decorators: [{
  185. type: Optional
  186. }, {
  187. type: Inject,
  188. args: [MAT_LEGACY_DIALOG_DEFAULT_OPTIONS]
  189. }] }, { type: undefined, decorators: [{
  190. type: Inject,
  191. args: [MAT_LEGACY_DIALOG_SCROLL_STRATEGY]
  192. }] }, { type: MatLegacyDialog, decorators: [{
  193. type: Optional
  194. }, {
  195. type: SkipSelf
  196. }] }, { type: i1$1.OverlayContainer }, { type: undefined, decorators: [{
  197. type: Optional
  198. }, {
  199. type: Inject,
  200. args: [ANIMATION_MODULE_TYPE]
  201. }] }]; } });
  202. /** Counter used to generate unique IDs for dialog elements. */
  203. let dialogElementUid = 0;
  204. /**
  205. * Button that will close the current dialog.
  206. * @deprecated Use `MatDialogClose` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
  207. * @breaking-change 17.0.0
  208. */
  209. class MatLegacyDialogClose {
  210. constructor(
  211. /**
  212. * Reference to the containing dialog.
  213. * @deprecated `dialogRef` property to become private.
  214. * @breaking-change 13.0.0
  215. */
  216. // The dialog title directive is always used in combination with a `MatDialogRef`.
  217. // tslint:disable-next-line: lightweight-tokens
  218. dialogRef, _elementRef, _dialog) {
  219. this.dialogRef = dialogRef;
  220. this._elementRef = _elementRef;
  221. this._dialog = _dialog;
  222. /** Default to "button" to prevents accidental form submits. */
  223. this.type = 'button';
  224. }
  225. ngOnInit() {
  226. if (!this.dialogRef) {
  227. // When this directive is included in a dialog via TemplateRef (rather than being
  228. // in a Component), the DialogRef isn't available via injection because embedded
  229. // views cannot be given a custom injector. Instead, we look up the DialogRef by
  230. // ID. This must occur in `onInit`, as the ID binding for the dialog container won't
  231. // be resolved at constructor time.
  232. this.dialogRef = getClosestDialog(this._elementRef, this._dialog.openDialogs);
  233. }
  234. }
  235. ngOnChanges(changes) {
  236. const proxiedChange = changes['_matDialogClose'] || changes['_matDialogCloseResult'];
  237. if (proxiedChange) {
  238. this.dialogResult = proxiedChange.currentValue;
  239. }
  240. }
  241. _onButtonClick(event) {
  242. // Determinate the focus origin using the click event, because using the FocusMonitor will
  243. // result in incorrect origins. Most of the time, close buttons will be auto focused in the
  244. // dialog, and therefore clicking the button won't result in a focus change. This means that
  245. // the FocusMonitor won't detect any origin change, and will always output `program`.
  246. _closeDialogVia(this.dialogRef, event.screenX === 0 && event.screenY === 0 ? 'keyboard' : 'mouse', this.dialogResult);
  247. }
  248. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MatLegacyDialogClose, deps: [{ token: MatLegacyDialogRef, optional: true }, { token: i0.ElementRef }, { token: MatLegacyDialog }], target: i0.ɵɵFactoryTarget.Directive }); }
  249. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: MatLegacyDialogClose, 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 }); }
  250. }
  251. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MatLegacyDialogClose, decorators: [{
  252. type: Directive,
  253. args: [{
  254. selector: '[mat-dialog-close], [matDialogClose]',
  255. exportAs: 'matDialogClose',
  256. host: {
  257. '(click)': '_onButtonClick($event)',
  258. '[attr.aria-label]': 'ariaLabel || null',
  259. '[attr.type]': 'type',
  260. },
  261. }]
  262. }], ctorParameters: function () { return [{ type: MatLegacyDialogRef, decorators: [{
  263. type: Optional
  264. }] }, { type: i0.ElementRef }, { type: MatLegacyDialog }]; }, propDecorators: { ariaLabel: [{
  265. type: Input,
  266. args: ['aria-label']
  267. }], type: [{
  268. type: Input
  269. }], dialogResult: [{
  270. type: Input,
  271. args: ['mat-dialog-close']
  272. }], _matDialogClose: [{
  273. type: Input,
  274. args: ['matDialogClose']
  275. }] } });
  276. /**
  277. * Title of a dialog element. Stays fixed to the top of the dialog when scrolling.
  278. * @deprecated Use `MatDialogTitle` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
  279. * @breaking-change 17.0.0
  280. */
  281. class MatLegacyDialogTitle {
  282. constructor(
  283. // The dialog title directive is always used in combination with a `MatDialogRef`.
  284. // tslint:disable-next-line: lightweight-tokens
  285. _dialogRef, _elementRef, _dialog) {
  286. this._dialogRef = _dialogRef;
  287. this._elementRef = _elementRef;
  288. this._dialog = _dialog;
  289. /** Unique id for the dialog title. If none is supplied, it will be auto-generated. */
  290. this.id = `mat-dialog-title-${dialogElementUid++}`;
  291. }
  292. ngOnInit() {
  293. if (!this._dialogRef) {
  294. this._dialogRef = getClosestDialog(this._elementRef, this._dialog.openDialogs);
  295. }
  296. if (this._dialogRef) {
  297. Promise.resolve().then(() => {
  298. const container = this._dialogRef._containerInstance;
  299. if (container && !container._ariaLabelledBy) {
  300. container._ariaLabelledBy = this.id;
  301. }
  302. });
  303. }
  304. }
  305. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MatLegacyDialogTitle, deps: [{ token: MatLegacyDialogRef, optional: true }, { token: i0.ElementRef }, { token: MatLegacyDialog }], target: i0.ɵɵFactoryTarget.Directive }); }
  306. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: MatLegacyDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: { id: "id" }, host: { properties: { "id": "id" }, classAttribute: "mat-dialog-title" }, exportAs: ["matDialogTitle"], ngImport: i0 }); }
  307. }
  308. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MatLegacyDialogTitle, decorators: [{
  309. type: Directive,
  310. args: [{
  311. selector: '[mat-dialog-title], [matDialogTitle]',
  312. exportAs: 'matDialogTitle',
  313. host: {
  314. 'class': 'mat-dialog-title',
  315. '[id]': 'id',
  316. },
  317. }]
  318. }], ctorParameters: function () { return [{ type: MatLegacyDialogRef, decorators: [{
  319. type: Optional
  320. }] }, { type: i0.ElementRef }, { type: MatLegacyDialog }]; }, propDecorators: { id: [{
  321. type: Input
  322. }] } });
  323. /**
  324. * Scrollable content container of a dialog.
  325. * @deprecated Use `MatDialogContent` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
  326. * @breaking-change 17.0.0
  327. */
  328. class MatLegacyDialogContent {
  329. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MatLegacyDialogContent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
  330. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: MatLegacyDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]", host: { classAttribute: "mat-dialog-content" }, ngImport: i0 }); }
  331. }
  332. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MatLegacyDialogContent, decorators: [{
  333. type: Directive,
  334. args: [{
  335. selector: `[mat-dialog-content], mat-dialog-content, [matDialogContent]`,
  336. host: { 'class': 'mat-dialog-content' },
  337. }]
  338. }] });
  339. /**
  340. * Container for the bottom action buttons in a dialog.
  341. * Stays fixed to the bottom when scrolling.
  342. * @deprecated Use `MatDialogActions` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
  343. * @breaking-change 17.0.0
  344. */
  345. class MatLegacyDialogActions {
  346. constructor() {
  347. /**
  348. * Horizontal alignment of action buttons.
  349. */
  350. this.align = 'start';
  351. }
  352. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MatLegacyDialogActions, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
  353. static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.0.0", type: MatLegacyDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: { align: "align" }, host: { properties: { "class.mat-dialog-actions-align-center": "align === \"center\"", "class.mat-dialog-actions-align-end": "align === \"end\"" }, classAttribute: "mat-dialog-actions" }, ngImport: i0 }); }
  354. }
  355. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MatLegacyDialogActions, decorators: [{
  356. type: Directive,
  357. args: [{
  358. selector: `[mat-dialog-actions], mat-dialog-actions, [matDialogActions]`,
  359. host: {
  360. 'class': 'mat-dialog-actions',
  361. '[class.mat-dialog-actions-align-center]': 'align === "center"',
  362. '[class.mat-dialog-actions-align-end]': 'align === "end"',
  363. },
  364. }]
  365. }], propDecorators: { align: [{
  366. type: Input
  367. }] } });
  368. // TODO(crisbeto): this utility shouldn't be necessary anymore, because the dialog ref is provided
  369. // both to component and template dialogs through DI. We need to keep it around, because there are
  370. // some internal wrappers around `MatDialog` that happened to work by accident, because we had this
  371. // fallback logic in place.
  372. /**
  373. * Finds the closest MatDialogRef to an element by looking at the DOM.
  374. * @param element Element relative to which to look for a dialog.
  375. * @param openDialogs References to the currently-open dialogs.
  376. */
  377. function getClosestDialog(element, openDialogs) {
  378. let parent = element.nativeElement.parentElement;
  379. while (parent && !parent.classList.contains('mat-dialog-container')) {
  380. parent = parent.parentElement;
  381. }
  382. return parent ? openDialogs.find(dialog => dialog.id === parent.id) : null;
  383. }
  384. /**
  385. * @deprecated Use `MatDialogModule` from `@angular/material/dialog` instead. See https://material.angular.io/guide/mdc-migration for information about migrating.
  386. * @breaking-change 17.0.0
  387. */
  388. class MatLegacyDialogModule {
  389. static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MatLegacyDialogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
  390. static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.0", ngImport: i0, type: MatLegacyDialogModule, declarations: [MatLegacyDialogContainer,
  391. MatLegacyDialogClose,
  392. MatLegacyDialogTitle,
  393. MatLegacyDialogActions,
  394. MatLegacyDialogContent], imports: [DialogModule, OverlayModule, PortalModule, MatCommonModule], exports: [MatLegacyDialogContainer,
  395. MatLegacyDialogClose,
  396. MatLegacyDialogTitle,
  397. MatLegacyDialogContent,
  398. MatLegacyDialogActions,
  399. MatCommonModule] }); }
  400. static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MatLegacyDialogModule, providers: [MatLegacyDialog, MAT_LEGACY_DIALOG_SCROLL_STRATEGY_PROVIDER], imports: [DialogModule, OverlayModule, PortalModule, MatCommonModule, MatCommonModule] }); }
  401. }
  402. i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.0", ngImport: i0, type: MatLegacyDialogModule, decorators: [{
  403. type: NgModule,
  404. args: [{
  405. imports: [DialogModule, OverlayModule, PortalModule, MatCommonModule],
  406. exports: [
  407. MatLegacyDialogContainer,
  408. MatLegacyDialogClose,
  409. MatLegacyDialogTitle,
  410. MatLegacyDialogContent,
  411. MatLegacyDialogActions,
  412. MatCommonModule,
  413. ],
  414. declarations: [
  415. MatLegacyDialogContainer,
  416. MatLegacyDialogClose,
  417. MatLegacyDialogTitle,
  418. MatLegacyDialogActions,
  419. MatLegacyDialogContent,
  420. ],
  421. providers: [MatLegacyDialog, MAT_LEGACY_DIALOG_SCROLL_STRATEGY_PROVIDER],
  422. }]
  423. }] });
  424. /**
  425. * Generated bundle index. Do not edit.
  426. */
  427. export { MAT_LEGACY_DIALOG_DATA, MAT_LEGACY_DIALOG_DEFAULT_OPTIONS, MAT_LEGACY_DIALOG_SCROLL_STRATEGY, MAT_LEGACY_DIALOG_SCROLL_STRATEGY_PROVIDER, MAT_LEGACY_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY, MatLegacyDialog, MatLegacyDialogActions, MatLegacyDialogClose, MatLegacyDialogConfig, MatLegacyDialogContainer, MatLegacyDialogContent, MatLegacyDialogModule, MatLegacyDialogRef, MatLegacyDialogTitle };
  428. //# sourceMappingURL=legacy-dialog.mjs.map