UNPKG

4.01 kBTypeScriptView Raw
1import { ComponentRef } from '@angular/core';
2import { Observable } from 'rxjs';
3import { NgbModalBackdrop } from './modal-backdrop';
4import { NgbModalWindow } from './modal-window';
5import { NgbModalUpdatableOptions } from './modal-config';
6import { ContentRef } from '../util/popup';
7/**
8 * A reference to the currently opened (active) modal.
9 *
10 * Instances of this class can be injected into your component passed as modal content.
11 * So you can `.update()`, `.close()` or `.dismiss()` the modal window from your component.
12 */
13export declare class NgbActiveModal {
14 /**
15 * Updates options of an opened modal.
16 *
17 * @since 14.2.0
18 */
19 update(options: NgbModalUpdatableOptions): void;
20 /**
21 * Closes the modal with an optional `result` value.
22 *
23 * The `NgbModalRef.result` promise will be resolved with the provided value.
24 */
25 close(result?: any): void;
26 /**
27 * Dismisses the modal with an optional `reason` value.
28 *
29 * The `NgbModalRef.result` promise will be rejected with the provided value.
30 */
31 dismiss(reason?: any): void;
32}
33/**
34 * A reference to the newly opened modal returned by the `NgbModal.open()` method.
35 */
36export declare class NgbModalRef {
37 private _windowCmptRef;
38 private _contentRef;
39 private _backdropCmptRef?;
40 private _beforeDismiss?;
41 private _closed;
42 private _dismissed;
43 private _hidden;
44 private _resolve;
45 private _reject;
46 private _applyWindowOptions;
47 private _applyBackdropOptions;
48 /**
49 * Updates options of an opened modal.
50 *
51 * @since 14.2.0
52 */
53 update(options: NgbModalUpdatableOptions): void;
54 /**
55 * The instance of a component used for the modal content.
56 *
57 * When a `TemplateRef` is used as the content or when the modal is closed, will return `undefined`.
58 */
59 get componentInstance(): any;
60 /**
61 * The promise that is resolved when the modal is closed and rejected when the modal is dismissed.
62 */
63 result: Promise<any>;
64 /**
65 * The observable that emits when the modal is closed via the `.close()` method.
66 *
67 * It will emit the result passed to the `.close()` method.
68 *
69 * @since 8.0.0
70 */
71 get closed(): Observable<any>;
72 /**
73 * The observable that emits when the modal is dismissed via the `.dismiss()` method.
74 *
75 * It will emit the reason passed to the `.dismissed()` method by the user, or one of the internal
76 * reasons like backdrop click or ESC key press.
77 *
78 * @since 8.0.0
79 */
80 get dismissed(): Observable<any>;
81 /**
82 * The observable that emits when both modal window and backdrop are closed and animations were finished.
83 * At this point modal and backdrop elements will be removed from the DOM tree.
84 *
85 * This observable will be completed after emitting.
86 *
87 * @since 8.0.0
88 */
89 get hidden(): Observable<void>;
90 /**
91 * The observable that emits when modal is fully visible and animation was finished.
92 * Modal DOM element is always available synchronously after calling 'modal.open()' service.
93 *
94 * This observable will be completed after emitting.
95 * It will not emit, if modal is closed before open animation is finished.
96 *
97 * @since 8.0.0
98 */
99 get shown(): Observable<void>;
100 constructor(_windowCmptRef: ComponentRef<NgbModalWindow>, _contentRef: ContentRef, _backdropCmptRef?: ComponentRef<NgbModalBackdrop> | undefined, _beforeDismiss?: (() => boolean | Promise<boolean>) | undefined);
101 /**
102 * Closes the modal with an optional `result` value.
103 *
104 * The `NgbMobalRef.result` promise will be resolved with the provided value.
105 */
106 close(result?: any): void;
107 private _dismiss;
108 /**
109 * Dismisses the modal with an optional `reason` value.
110 *
111 * The `NgbModalRef.result` promise will be rejected with the provided value.
112 */
113 dismiss(reason?: any): void;
114 private _removeModalElements;
115}