UNPKG

4.57 kBTypeScriptView Raw
1import { Injector } from '@angular/core';
2import * as i0 from "@angular/core";
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 * If `true` modal will always be displayed in fullscreen mode.
61 *
62 * For values like `'md'` it means that modal will be displayed in fullscreen mode
63 * only if the viewport width is below `'md'`. For custom strings (ex. when passing `'mysize'`)
64 * it will add a `'modal-fullscreen-mysize-down'` class.
65 *
66 * If not specified will be `false`.
67 *
68 * @since 12.1.0
69 */
70 fullscreen?: 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | boolean | string;
71 /**
72 * The `Injector` to use for modal content.
73 */
74 injector?: Injector;
75 /**
76 * If `true`, the modal will be closed when `Escape` key is pressed
77 *
78 * Default value is `true`.
79 */
80 keyboard?: boolean;
81 /**
82 * `role` attribute value to set on the modal window.
83 *
84 * Default value is `dialog`.
85 *
86 * @since 18.0.0
87 */
88 role?: 'alertdialog' | 'dialog';
89 /**
90 * Scrollable modal content (false by default).
91 *
92 * @since 5.0.0
93 */
94 scrollable?: boolean;
95 /**
96 * Size of a new modal window.
97 */
98 size?: 'sm' | 'lg' | 'xl' | string;
99 /**
100 * A custom class to append to the modal window.
101 */
102 windowClass?: string;
103 /**
104 * A custom class to append to the modal dialog.
105 *
106 * @since 9.1.0
107 */
108 modalDialogClass?: string;
109 /**
110 * A custom class to append to the modal backdrop.
111 *
112 * @since 1.1.0
113 */
114 backdropClass?: string;
115}
116/**
117 * Options that can be changed on an opened modal with `NgbModalRef.update()` and `NgbActiveModal.update()` methods.
118 *
119 * @since 14.2.0
120 */
121export type NgbModalUpdatableOptions = Pick<NgbModalOptions, 'ariaLabelledBy' | 'ariaDescribedBy' | 'centered' | 'fullscreen' | 'backdropClass' | 'size' | 'windowClass' | 'modalDialogClass'>;
122/**
123 * A configuration service for the [`NgbModal`](#/components/modal/api#NgbModal) service.
124 *
125 * You can inject this service, typically in your root component, and customize the values of its properties in
126 * order to provide default values for all modals used in the application.
127 *
128 * @since 3.1.0
129 */
130export declare class NgbModalConfig implements Required<NgbModalOptions> {
131 private _ngbConfig;
132 private _animation;
133 ariaLabelledBy: string;
134 ariaDescribedBy: string;
135 backdrop: boolean | 'static';
136 beforeDismiss: () => boolean | Promise<boolean>;
137 centered: boolean;
138 container: string | HTMLElement;
139 fullscreen: 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | boolean | string;
140 injector: Injector;
141 keyboard: boolean;
142 role: 'alertdialog' | 'dialog';
143 scrollable: boolean;
144 size: 'sm' | 'lg' | 'xl' | string;
145 windowClass: string;
146 modalDialogClass: string;
147 backdropClass: string;
148 get animation(): boolean;
149 set animation(animation: boolean);
150 static ɵfac: i0.ɵɵFactoryDeclaration<NgbModalConfig, never>;
151 static ɵprov: i0.ɵɵInjectableDeclaration<NgbModalConfig>;
152}