UNPKG

5.33 kBTypeScriptView Raw
1import { ModuleWithProviders, AfterContentInit, ElementRef, QueryList, EventEmitter, Renderer } from '@angular/core';
2import { Dir, MdError } from '@angular2-material/core';
3/** Exception thrown when two MdSidenav are matching the same side. */
4export declare class MdDuplicatedSidenavError extends MdError {
5 constructor(align: string);
6}
7/**
8 * <md-sidenav> component.
9 *
10 * This component corresponds to the drawer of the sidenav.
11 *
12 * Please refer to README.md for examples on how to use it.
13 */
14export declare class MdSidenav {
15 private _elementRef;
16 /** Alignment of the sidenav (direction neutral); whether 'start' or 'end'. */
17 align: 'start' | 'end';
18 /** Mode of the sidenav; whether 'over' or 'side'. */
19 mode: 'over' | 'push' | 'side';
20 /** Whether the sidenav is opened. */
21 private _opened;
22 /** Event emitted when the sidenav is being opened. Use this to synchronize animations. */
23 onOpenStart: EventEmitter<void>;
24 /** Event emitted when the sidenav is fully opened. */
25 onOpen: EventEmitter<void>;
26 /** Event emitted when the sidenav is being closed. Use this to synchronize animations. */
27 onCloseStart: EventEmitter<void>;
28 /** Event emitted when the sidenav is fully closed. */
29 onClose: EventEmitter<void>;
30 /**
31 * @param _elementRef The DOM element reference. Used for transition and width calculation.
32 * If not available we do not hook on transitions.
33 */
34 constructor(_elementRef: ElementRef);
35 /**
36 * Whether the sidenav is opened. We overload this because we trigger an event when it
37 * starts or end.
38 */
39 opened: boolean;
40 /** Open this sidenav, and return a Promise that will resolve when it's fully opened (or get
41 * rejected if it didn't). */
42 open(): Promise<void>;
43 /**
44 * Close this sidenav, and return a Promise that will resolve when it's fully closed (or get
45 * rejected if it didn't).
46 */
47 close(): Promise<void>;
48 /**
49 * Toggle this sidenav. This is equivalent to calling open() when it's already opened, or
50 * close() when it's closed.
51 * @param isOpen
52 */
53 toggle(isOpen?: boolean): Promise<void>;
54 /**
55 * When transition has finished, set the internal state for classes and emit the proper event.
56 * The event passed is actually of type TransitionEvent, but that type is not available in
57 * Android so we use any.
58 */
59 _onTransitionEnd(transitionEvent: TransitionEvent): void;
60 readonly _isClosing: boolean;
61 readonly _isOpening: boolean;
62 readonly _isClosed: boolean;
63 readonly _isOpened: boolean;
64 readonly _isEnd: boolean;
65 readonly _modeSide: boolean;
66 readonly _modeOver: boolean;
67 readonly _modePush: boolean;
68 /** TODO: internal (needed by MdSidenavLayout). */
69 readonly _width: any;
70 private _transition;
71 private _openPromise;
72 private _openPromiseResolve;
73 private _openPromiseReject;
74 private _closePromise;
75 private _closePromiseResolve;
76 private _closePromiseReject;
77}
78/**
79 * <md-sidenav-layout> component.
80 *
81 * This is the parent component to one or two <md-sidenav>s that validates the state internally
82 * and coordinate the backdrop and content styling.
83 */
84export declare class MdSidenavLayout implements AfterContentInit {
85 private _dir;
86 private _element;
87 private _renderer;
88 _sidenavs: QueryList<MdSidenav>;
89 readonly start: MdSidenav;
90 readonly end: MdSidenav;
91 /** The sidenav at the start/end alignment, independent of direction. */
92 private _start;
93 private _end;
94 /**
95 * The sidenav at the left/right. When direction changes, these will change as well.
96 * They're used as aliases for the above to set the left/right style properly.
97 * In LTR, _left == _start and _right == _end.
98 * In RTL, _left == _end and _right == _start.
99 */
100 private _left;
101 private _right;
102 constructor(_dir: Dir, _element: ElementRef, _renderer: Renderer);
103 /** TODO: internal */
104 ngAfterContentInit(): void;
105 private _watchSidenavToggle(sidenav);
106 private _setLayoutClass(sidenav, bool);
107 /** Validate the state of the sidenav children components. */
108 private _validateDrawers();
109 _closeModalSidenav(): void;
110 _isShowingBackdrop(): boolean;
111 private _isSidenavOpen(side);
112 /**
113 * Return the width of the sidenav, if it's in the proper mode and opened.
114 * This may relayout the view, so do not call this often.
115 * @param sidenav
116 * @param mode
117 */
118 private _getSidenavEffectiveWidth(sidenav, mode);
119 _getMarginLeft(): number;
120 _getMarginRight(): number;
121 _getPositionLeft(): number;
122 _getPositionRight(): number;
123 /**
124 * Returns the horizontal offset for the content area. There should never be a value for both
125 * left and right, so by subtracting the right value from the left value, we should always get
126 * the appropriate offset.
127 */
128 _getPositionOffset(): number;
129 /**
130 * This is using [ngStyle] rather than separate [style...] properties because [style.transform]
131 * doesn't seem to work right now.
132 */
133 _getStyles(): {
134 marginLeft: string;
135 marginRight: string;
136 transform: string;
137 };
138}
139export declare class MdSidenavModule {
140 static forRoot(): ModuleWithProviders;
141}