dialog-config.d.ts 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 { ViewContainerRef } from '@angular/core';
  9. import { Direction } from '@angular/cdk/bidi';
  10. import { ScrollStrategy } from '@angular/cdk/overlay';
  11. /** Valid ARIA roles for a dialog element. */
  12. export declare type DialogRole = 'dialog' | 'alertdialog';
  13. /** Possible overrides for a dialog's position. */
  14. export interface DialogPosition {
  15. /** Override for the dialog's top position. */
  16. top?: string;
  17. /** Override for the dialog's bottom position. */
  18. bottom?: string;
  19. /** Override for the dialog's left position. */
  20. left?: string;
  21. /** Override for the dialog's right position. */
  22. right?: string;
  23. }
  24. /**
  25. * Configuration for opening a modal dialog with the MatDialog service.
  26. */
  27. export declare class MatDialogConfig<D = any> {
  28. /**
  29. * Where the attached component should live in Angular's *logical* component tree.
  30. * This affects what is available for injection and the change detection order for the
  31. * component instantiated inside of the dialog. This does not affect where the dialog
  32. * content will be rendered.
  33. */
  34. viewContainerRef?: ViewContainerRef;
  35. /** ID for the dialog. If omitted, a unique one will be generated. */
  36. id?: string;
  37. /** The ARIA role of the dialog element. */
  38. role?: DialogRole;
  39. /** Custom class for the overlay pane. */
  40. panelClass?: string | string[];
  41. /** Whether the dialog has a backdrop. */
  42. hasBackdrop?: boolean;
  43. /** Custom class for the backdrop, */
  44. backdropClass?: string;
  45. /** Whether the user can use escape or clicking on the backdrop to close the modal. */
  46. disableClose?: boolean;
  47. /** Width of the dialog. */
  48. width?: string;
  49. /** Height of the dialog. */
  50. height?: string;
  51. /** Min-width of the dialog. If a number is provided, pixel units are assumed. */
  52. minWidth?: number | string;
  53. /** Min-height of the dialog. If a number is provided, pixel units are assumed. */
  54. minHeight?: number | string;
  55. /** Max-width of the dialog. If a number is provided, pixel units are assumed. Defaults to 80vw */
  56. maxWidth?: number | string;
  57. /** Max-height of the dialog. If a number is provided, pixel units are assumed. */
  58. maxHeight?: number | string;
  59. /** Position overrides. */
  60. position?: DialogPosition;
  61. /** Data being injected into the child component. */
  62. data?: D | null;
  63. /** Layout direction for the dialog's content. */
  64. direction?: Direction;
  65. /** ID of the element that describes the dialog. */
  66. ariaDescribedBy?: string | null;
  67. /** ID of the element that labels the dialog. */
  68. ariaLabelledBy?: string | null;
  69. /** Aria label to assign to the dialog element */
  70. ariaLabel?: string | null;
  71. /** Whether the dialog should focus the first focusable element on open. */
  72. autoFocus?: boolean;
  73. /**
  74. * Whether the dialog should restore focus to the
  75. * previously-focused element, after it's closed.
  76. */
  77. restoreFocus?: boolean;
  78. /** Scroll strategy to be used for the dialog. */
  79. scrollStrategy?: ScrollStrategy;
  80. /**
  81. * Whether the dialog should close when the user goes backwards/forwards in history.
  82. * Note that this usually doesn't include clicking on links (unless the user is using
  83. * the `HashLocationStrategy`).
  84. */
  85. closeOnNavigation?: boolean;
  86. }