forked from ng-bootstrap/ng-bootstrap
/
modal-config.ts
109 lines (97 loc) · 2.42 KB
/
modal-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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import {Injectable, Injector} from '@angular/core';
/**
* Options available when opening new modal windows with `NgbModal.open()` method.
*/
export interface NgbModalOptions {
/**
* `aria-labelledby` attribute value to set on the modal window.
*
* @since 2.2.0
*/
ariaLabelledBy?: string;
/**
* If `true`, the backdrop element will be created for a given modal.
*
* Alternatively, specify `'static'` for a backdrop which doesn't close the modal on click.
*
* Default value is `true`.
*/
backdrop?: boolean | 'static';
/**
* Callback right before the modal will be dismissed.
*
* If this function returns:
* * `false`
* * a promise resolved with `false`
* * a promise that is rejected
*
* then the modal won't be dismissed.
*/
beforeDismiss?: () => boolean | Promise<boolean>;
/**
* If `true`, the modal will be centered vertically.
*
* Default value is `false`.
*
* @since 1.1.0
*/
centered?: boolean;
/**
* A selector specifying the element all new modal windows should be appended to.
*
* If not specified, will be `body`.
*/
container?: string;
/**
* The `Injector` to use for modal content.
*/
injector?: Injector;
/**
* If `true`, the modal will be closed when `Escape` key is pressed
*
* Default value is `true`.
*/
keyboard?: boolean;
/**
* Scrollable modal content (false by default).
*
* @since 5.0.0
*/
scrollable?: boolean;
/**
* Size of a new modal window.
*/
size?: 'sm' | 'lg' | 'xl';
/**
* A custom class to append to the modal window.
*/
windowClass?: string;
/**
* A custom class to append to the modal backdrop.
*
* @since 1.1.0
*/
backdropClass?: string;
}
/**
* A configuration service for the [`NgbModal`](#/components/modal/api#NgbModal) service.
*
* You can inject this service, typically in your root component, and customize the values of its properties in
* order to provide default values for all modals used in the application.
*
* @since 3.1.0
*/
@Injectable({providedIn: 'root'})
export class NgbModalConfig implements Required<NgbModalOptions> {
ariaLabelledBy: string;
backdrop: boolean | 'static' = true;
beforeDismiss: () => boolean | Promise<boolean>;
centered: boolean;
container: string;
injector: Injector;
keyboard = true;
scrollable: boolean;
size: 'sm' | 'lg' | 'xl';
windowClass: string;
backdropClass: string;
}