UNPKG

4.36 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 * Scrollable modal content (false by default).
83 *
84 * @since 5.0.0
85 */
86 scrollable?: boolean;
87 /**
88 * Size of a new modal window.
89 */
90 size?: 'sm' | 'lg' | 'xl' | string;
91 /**
92 * A custom class to append to the modal window.
93 */
94 windowClass?: string;
95 /**
96 * A custom class to append to the modal dialog.
97 *
98 * @since 9.1.0
99 */
100 modalDialogClass?: string;
101 /**
102 * A custom class to append to the modal backdrop.
103 *
104 * @since 1.1.0
105 */
106 backdropClass?: string;
107}
108/**
109 * Options that can be changed on an opened modal with `NgbModalRef.update()` and `NgbActiveModal.update()` methods.
110 *
111 * @since 14.2.0
112 */
113export type NgbModalUpdatableOptions = Pick<NgbModalOptions, 'ariaLabelledBy' | 'ariaDescribedBy' | 'centered' | 'fullscreen' | 'backdropClass' | 'size' | 'windowClass' | 'modalDialogClass'>;
114/**
115 * A configuration service for the [`NgbModal`](#/components/modal/api#NgbModal) service.
116 *
117 * You can inject this service, typically in your root component, and customize the values of its properties in
118 * order to provide default values for all modals used in the application.
119 *
120 * @since 3.1.0
121 */
122export declare class NgbModalConfig implements Required<NgbModalOptions> {
123 private _ngbConfig;
124 private _animation;
125 ariaLabelledBy: string;
126 ariaDescribedBy: string;
127 backdrop: boolean | 'static';
128 beforeDismiss: () => boolean | Promise<boolean>;
129 centered: boolean;
130 container: string | HTMLElement;
131 fullscreen: 'sm' | 'md' | 'lg' | 'xl' | 'xxl' | boolean | string;
132 injector: Injector;
133 keyboard: boolean;
134 scrollable: boolean;
135 size: 'sm' | 'lg' | 'xl' | string;
136 windowClass: string;
137 modalDialogClass: string;
138 backdropClass: string;
139 get animation(): boolean;
140 set animation(animation: boolean);
141 static ɵfac: i0.ɵɵFactoryDeclaration<NgbModalConfig, never>;
142 static ɵprov: i0.ɵɵInjectableDeclaration<NgbModalConfig>;
143}