UNPKG

3.48 kBTypeScriptView Raw
1import { Injector } from '@angular/core';
2import { NgbConfig } from '../ngb-config';
3/**
4 * Options available when opening new modal windows with `NgbModal.open()` method.
5 */
6export interface NgbModalOptions {
7 /**
8 * If `true`, modal opening and closing will be animated.
9 *
10 * @since 8.0.0
11 */
12 animation?: boolean;
13 /**
14 * `aria-labelledby` attribute value to set on the modal window.
15 *
16 * @since 2.2.0
17 */
18 ariaLabelledBy?: string;
19 /**
20 * `aria-describedby` attribute value to set on the modal window.
21 *
22 * @since 6.1.0
23 */
24 ariaDescribedBy?: string;
25 /**
26 * If `true`, the backdrop element will be created for a given modal.
27 *
28 * Alternatively, specify `'static'` for a backdrop which doesn't close the modal on click.
29 *
30 * Default value is `true`.
31 */
32 backdrop?: boolean | 'static';
33 /**
34 * Callback right before the modal will be dismissed.
35 *
36 * If this function returns:
37 * * `false`
38 * * a promise resolved with `false`
39 * * a promise that is rejected
40 *
41 * then the modal won't be dismissed.
42 */
43 beforeDismiss?: () => boolean | Promise<boolean>;
44 /**
45 * If `true`, the modal will be centered vertically.
46 *
47 * Default value is `false`.
48 *
49 * @since 1.1.0
50 */
51 centered?: boolean;
52 /**
53 * A selector specifying the element all new modal windows should be appended to.
54 * Since v5.3.0 it is also possible to pass the reference to an `HTMLElement`.
55 *
56 * If not specified, will be `body`.
57 */
58 container?: string | HTMLElement;
59 /**
60 * The `Injector` to use for modal content.
61 */
62 injector?: Injector;
63 /**
64 * If `true`, the modal will be closed when `Escape` key is pressed
65 *
66 * Default value is `true`.
67 */
68 keyboard?: boolean;
69 /**
70 * Scrollable modal content (false by default).
71 *
72 * @since 5.0.0
73 */
74 scrollable?: boolean;
75 /**
76 * Size of a new modal window.
77 */
78 size?: 'sm' | 'lg' | 'xl' | string;
79 /**
80 * A custom class to append to the modal window.
81 */
82 windowClass?: string;
83 /**
84 * A custom class to append to the modal dialog.
85 *
86 * @since 9.1.0
87 */
88 modalDialogClass?: string;
89 /**
90 * A custom class to append to the modal backdrop.
91 *
92 * @since 1.1.0
93 */
94 backdropClass?: string;
95}
96/**
97 * A configuration service for the [`NgbModal`](#/components/modal/api#NgbModal) service.
98 *
99 * You can inject this service, typically in your root component, and customize the values of its properties in
100 * order to provide default values for all modals used in the application.
101*
102* @since 3.1.0
103*/
104export declare class NgbModalConfig implements Required<NgbModalOptions> {
105 private _ngbConfig;
106 ariaLabelledBy: string;
107 ariaDescribedBy: string;
108 backdrop: boolean | 'static';
109 beforeDismiss: () => boolean | Promise<boolean>;
110 centered: boolean;
111 container: string;
112 injector: Injector;
113 keyboard: boolean;
114 scrollable: boolean;
115 size: 'sm' | 'lg' | 'xl' | string;
116 windowClass: string;
117 modalDialogClass: string;
118 backdropClass: string;
119 private _animation;
120 constructor(_ngbConfig: NgbConfig);
121 get animation(): boolean;
122 set animation(animation: boolean);
123}