UNPKG

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