dialog-ref.d.ts 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /**
  2. * @license
  3. * Copyright Google LLC All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.io/license
  7. */
  8. import { OverlayRef } from '@angular/cdk/overlay';
  9. import { Location } from '@angular/common';
  10. import { Observable } from 'rxjs';
  11. import { DialogPosition } from './dialog-config';
  12. import { MatDialogContainer } from './dialog-container';
  13. /**
  14. * Reference to a dialog opened via the MatDialog service.
  15. */
  16. export declare class MatDialogRef<T, R = any> {
  17. private _overlayRef;
  18. _containerInstance: MatDialogContainer;
  19. readonly id: string;
  20. /** The instance of component opened into the dialog. */
  21. componentInstance: T;
  22. /** Whether the user is allowed to close the dialog. */
  23. disableClose: boolean | undefined;
  24. /** Subject for notifying the user that the dialog has finished opening. */
  25. private readonly _afterOpened;
  26. /** Subject for notifying the user that the dialog has finished closing. */
  27. private readonly _afterClosed;
  28. /** Subject for notifying the user that the dialog has started closing. */
  29. private readonly _beforeClosed;
  30. /** Result to be passed to afterClosed. */
  31. private _result;
  32. /** Handle to the timeout that's running as a fallback in case the exit animation doesn't fire. */
  33. private _closeFallbackTimeout;
  34. constructor(_overlayRef: OverlayRef, _containerInstance: MatDialogContainer, _location?: Location, id?: string);
  35. /**
  36. * Close the dialog.
  37. * @param dialogResult Optional result to return to the dialog opener.
  38. */
  39. close(dialogResult?: R): void;
  40. /**
  41. * Gets an observable that is notified when the dialog is finished opening.
  42. */
  43. afterOpened(): Observable<void>;
  44. /**
  45. * Gets an observable that is notified when the dialog is finished closing.
  46. */
  47. afterClosed(): Observable<R | undefined>;
  48. /**
  49. * Gets an observable that is notified when the dialog has started closing.
  50. */
  51. beforeClosed(): Observable<R | undefined>;
  52. /**
  53. * Gets an observable that emits when the overlay's backdrop has been clicked.
  54. */
  55. backdropClick(): Observable<MouseEvent>;
  56. /**
  57. * Gets an observable that emits when keydown events are targeted on the overlay.
  58. */
  59. keydownEvents(): Observable<KeyboardEvent>;
  60. /**
  61. * Updates the dialog's position.
  62. * @param position New dialog position.
  63. */
  64. updatePosition(position?: DialogPosition): this;
  65. /**
  66. * Updates the dialog's width and height.
  67. * @param width New width of the dialog.
  68. * @param height New height of the dialog.
  69. */
  70. updateSize(width?: string, height?: string): this;
  71. /** Add a CSS class or an array of classes to the overlay pane. */
  72. addPanelClass(classes: string | string[]): this;
  73. /** Remove a CSS class or an array of classes from the overlay pane. */
  74. removePanelClass(classes: string | string[]): this;
  75. /**
  76. * Gets an observable that is notified when the dialog is finished opening.
  77. * @deprecated Use `afterOpened` instead.
  78. * @breaking-change 8.0.0
  79. */
  80. afterOpen(): Observable<void>;
  81. /**
  82. * Gets an observable that is notified when the dialog has started closing.
  83. * @deprecated Use `beforeClosed` instead.
  84. * @breaking-change 8.0.0
  85. */
  86. beforeClose(): Observable<R | undefined>;
  87. /** Fetches the position strategy object from the overlay ref. */
  88. private _getPositionStrategy;
  89. }