-
Notifications
You must be signed in to change notification settings - Fork 6.7k
/
dialog-config.ts
73 lines (55 loc) · 1.96 KB
/
dialog-config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {ViewContainerRef} from '@angular/core';
import {Direction} from '../core';
/** Valid ARIA roles for a dialog element. */
export type DialogRole = 'dialog' | 'alertdialog';
/** Possible overrides for a dialog's position. */
export interface DialogPosition {
top?: string;
bottom?: string;
left?: string;
right?: string;
}
/**
* Configuration for opening a modal dialog with the MdDialog service.
*/
export class MdDialogConfig {
/**
* Where the attached component should live in Angular's *logical* component tree.
* This affects what is available for injection and the change detection order for the
* component instantiated inside of the dialog. This does not affect where the dialog
* content will be rendered.
*/
viewContainerRef?: ViewContainerRef;
/** ID for the dialog. If omitted, a unique one will be generated. */
id?: string;
/** The ARIA role of the dialog element. */
role?: DialogRole = 'dialog';
/** Custom class for the overlay pane. */
panelClass?: string = '';
/** Whether the dialog has a backdrop. */
hasBackdrop?: boolean = true;
/** Custom class for the backdrop, */
backdropClass?: string = '';
/** Whether the user can use escape or clicking outside to close a modal. */
disableClose?: boolean = false;
/** Width of the dialog. */
width?: string = '';
/** Height of the dialog. */
height?: string = '';
/** Position overrides. */
position?: DialogPosition;
/** Data being injected into the child component. */
data?: any = null;
/** Layout direction for the dialog's content. */
direction?: Direction = 'ltr';
/** ID of the element that describes the dialog. */
ariaDescribedBy?: string | null = null;
// TODO(jelbourn): add configuration for lifecycle hooks, ARIA labelling.
}