sidenav.js 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229
  1. /**
  2. * @license
  3. * Copyright Google LLC All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.io/license
  7. */
  8. import { animate, state, style, transition, trigger } from '@angular/animations';
  9. import { FocusMonitor, FocusTrapFactory } from '@angular/cdk/a11y';
  10. import { Directionality } from '@angular/cdk/bidi';
  11. import { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
  12. import { ESCAPE, hasModifierKey } from '@angular/cdk/keycodes';
  13. import { Platform, PlatformModule } from '@angular/cdk/platform';
  14. import { CdkScrollable, ScrollDispatcher, ViewportRuler, ScrollingModule } from '@angular/cdk/scrolling';
  15. import { DOCUMENT, CommonModule } from '@angular/common';
  16. import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ContentChildren, ElementRef, EventEmitter, forwardRef, Inject, InjectionToken, Input, NgZone, Optional, Output, ViewChild, ViewEncapsulation, HostListener, HostBinding, NgModule } from '@angular/core';
  17. import { fromEvent, merge, Subject } from 'rxjs';
  18. import { debounceTime, filter, map, startWith, take, takeUntil, distinctUntilChanged } from 'rxjs/operators';
  19. import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
  20. import { MatCommonModule } from '@angular/material/core';
  21. /**
  22. * @fileoverview added by tsickle
  23. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  24. */
  25. /**
  26. * Animations used by the Material drawers.
  27. * \@docs-private
  28. * @type {?}
  29. */
  30. const matDrawerAnimations = {
  31. /**
  32. * Animation that slides a drawer in and out.
  33. */
  34. transformDrawer: trigger('transform', [
  35. // We remove the `transform` here completely, rather than setting it to zero, because:
  36. // 1. Having a transform can cause elements with ripples or an animated
  37. // transform to shift around in Chrome with an RTL layout (see #10023).
  38. // 2. 3d transforms causes text to appear blurry on IE and Edge.
  39. state('open, open-instant', style({
  40. 'transform': 'none',
  41. 'visibility': 'visible',
  42. })),
  43. state('void', style({
  44. // Avoids the shadow showing up when closed in SSR.
  45. 'box-shadow': 'none',
  46. 'visibility': 'hidden',
  47. })),
  48. transition('void => open-instant', animate('0ms')),
  49. transition('void <=> open, open-instant => void', animate('400ms cubic-bezier(0.25, 0.8, 0.25, 1)'))
  50. ])
  51. };
  52. /**
  53. * @fileoverview added by tsickle
  54. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  55. */
  56. /**
  57. * Throws an exception when two MatDrawer are matching the same position.
  58. * \@docs-private
  59. * @param {?} position
  60. * @return {?}
  61. */
  62. function throwMatDuplicatedDrawerError(position) {
  63. throw Error(`A drawer was already declared for 'position="${position}"'`);
  64. }
  65. /**
  66. * Configures whether drawers should use auto sizing by default.
  67. * @type {?}
  68. */
  69. const MAT_DRAWER_DEFAULT_AUTOSIZE = new InjectionToken('MAT_DRAWER_DEFAULT_AUTOSIZE', {
  70. providedIn: 'root',
  71. factory: MAT_DRAWER_DEFAULT_AUTOSIZE_FACTORY,
  72. });
  73. /**
  74. * \@docs-private
  75. * @return {?}
  76. */
  77. function MAT_DRAWER_DEFAULT_AUTOSIZE_FACTORY() {
  78. return false;
  79. }
  80. class MatDrawerContent extends CdkScrollable {
  81. /**
  82. * @param {?} _changeDetectorRef
  83. * @param {?} _container
  84. * @param {?} elementRef
  85. * @param {?} scrollDispatcher
  86. * @param {?} ngZone
  87. */
  88. constructor(_changeDetectorRef, _container, elementRef, scrollDispatcher, ngZone) {
  89. super(elementRef, scrollDispatcher, ngZone);
  90. this._changeDetectorRef = _changeDetectorRef;
  91. this._container = _container;
  92. }
  93. /**
  94. * @return {?}
  95. */
  96. ngAfterContentInit() {
  97. this._container._contentMarginChanges.subscribe((/**
  98. * @return {?}
  99. */
  100. () => {
  101. this._changeDetectorRef.markForCheck();
  102. }));
  103. }
  104. }
  105. MatDrawerContent.decorators = [
  106. { type: Component, args: [{selector: 'mat-drawer-content',
  107. template: '<ng-content></ng-content>',
  108. host: {
  109. 'class': 'mat-drawer-content',
  110. '[style.margin-left.px]': '_container._contentMargins.left',
  111. '[style.margin-right.px]': '_container._contentMargins.right',
  112. },
  113. changeDetection: ChangeDetectionStrategy.OnPush,
  114. encapsulation: ViewEncapsulation.None,
  115. },] },
  116. ];
  117. /** @nocollapse */
  118. MatDrawerContent.ctorParameters = () => [
  119. { type: ChangeDetectorRef },
  120. { type: MatDrawerContainer, decorators: [{ type: Inject, args: [forwardRef((/**
  121. * @return {?}
  122. */
  123. () => MatDrawerContainer)),] }] },
  124. { type: ElementRef },
  125. { type: ScrollDispatcher },
  126. { type: NgZone }
  127. ];
  128. /**
  129. * This component corresponds to a drawer that can be opened on the drawer container.
  130. */
  131. class MatDrawer {
  132. /**
  133. * @param {?} _elementRef
  134. * @param {?} _focusTrapFactory
  135. * @param {?} _focusMonitor
  136. * @param {?} _platform
  137. * @param {?} _ngZone
  138. * @param {?} _doc
  139. */
  140. constructor(_elementRef, _focusTrapFactory, _focusMonitor, _platform, _ngZone, _doc) {
  141. this._elementRef = _elementRef;
  142. this._focusTrapFactory = _focusTrapFactory;
  143. this._focusMonitor = _focusMonitor;
  144. this._platform = _platform;
  145. this._ngZone = _ngZone;
  146. this._doc = _doc;
  147. this._elementFocusedBeforeDrawerWasOpened = null;
  148. /**
  149. * Whether the drawer is initialized. Used for disabling the initial animation.
  150. */
  151. this._enableAnimations = false;
  152. this._position = 'start';
  153. this._mode = 'over';
  154. this._disableClose = false;
  155. this._autoFocus = true;
  156. /**
  157. * Emits whenever the drawer has started animating.
  158. */
  159. this._animationStarted = new Subject();
  160. /**
  161. * Emits whenever the drawer is done animating.
  162. */
  163. this._animationEnd = new Subject();
  164. /**
  165. * Current state of the sidenav animation.
  166. */
  167. // @HostBinding is used in the class as it is expected to be extended. Since @Component decorator
  168. // metadata is not inherited by child classes, instead the host binding data is defined in a way
  169. // that can be inherited.
  170. // tslint:disable:no-host-decorator-in-concrete
  171. this._animationState = 'void';
  172. /**
  173. * Event emitted when the drawer open state is changed.
  174. */
  175. this.openedChange =
  176. // Note this has to be async in order to avoid some issues with two-bindings (see #8872).
  177. new EventEmitter(/* isAsync */ true);
  178. /**
  179. * Emits when the component is destroyed.
  180. */
  181. this._destroyed = new Subject();
  182. /**
  183. * Event emitted when the drawer's position changes.
  184. */
  185. // tslint:disable-next-line:no-output-on-prefix
  186. this.onPositionChanged = new EventEmitter();
  187. /**
  188. * An observable that emits when the drawer mode changes. This is used by the drawer container to
  189. * to know when to when the mode changes so it can adapt the margins on the content.
  190. */
  191. this._modeChanged = new Subject();
  192. this._opened = false;
  193. this.openedChange.subscribe((/**
  194. * @param {?} opened
  195. * @return {?}
  196. */
  197. (opened) => {
  198. if (opened) {
  199. if (this._doc) {
  200. this._elementFocusedBeforeDrawerWasOpened = (/** @type {?} */ (this._doc.activeElement));
  201. }
  202. if (this._isFocusTrapEnabled && this._focusTrap) {
  203. this._trapFocus();
  204. }
  205. }
  206. else {
  207. this._restoreFocus();
  208. }
  209. }));
  210. /**
  211. * Listen to `keydown` events outside the zone so that change detection is not run every
  212. * time a key is pressed. Instead we re-enter the zone only if the `ESC` key is pressed
  213. * and we don't have close disabled.
  214. */
  215. this._ngZone.runOutsideAngular((/**
  216. * @return {?}
  217. */
  218. () => {
  219. ((/** @type {?} */ (fromEvent(this._elementRef.nativeElement, 'keydown')))).pipe(filter((/**
  220. * @param {?} event
  221. * @return {?}
  222. */
  223. event => {
  224. return event.keyCode === ESCAPE && !this.disableClose && !hasModifierKey(event);
  225. })), takeUntil(this._destroyed)).subscribe((/**
  226. * @param {?} event
  227. * @return {?}
  228. */
  229. event => this._ngZone.run((/**
  230. * @return {?}
  231. */
  232. () => {
  233. this.close();
  234. event.stopPropagation();
  235. event.preventDefault();
  236. }))));
  237. }));
  238. // We need a Subject with distinctUntilChanged, because the `done` event
  239. // fires twice on some browsers. See https://github.com/angular/angular/issues/24084
  240. this._animationEnd.pipe(distinctUntilChanged((/**
  241. * @param {?} x
  242. * @param {?} y
  243. * @return {?}
  244. */
  245. (x, y) => {
  246. return x.fromState === y.fromState && x.toState === y.toState;
  247. }))).subscribe((/**
  248. * @param {?} event
  249. * @return {?}
  250. */
  251. (event) => {
  252. const { fromState, toState } = event;
  253. if ((toState.indexOf('open') === 0 && fromState === 'void') ||
  254. (toState === 'void' && fromState.indexOf('open') === 0)) {
  255. this.openedChange.emit(this._opened);
  256. }
  257. }));
  258. }
  259. /**
  260. * The side that the drawer is attached to.
  261. * @return {?}
  262. */
  263. get position() { return this._position; }
  264. /**
  265. * @param {?} value
  266. * @return {?}
  267. */
  268. set position(value) {
  269. // Make sure we have a valid value.
  270. value = value === 'end' ? 'end' : 'start';
  271. if (value != this._position) {
  272. this._position = value;
  273. this.onPositionChanged.emit();
  274. }
  275. }
  276. /**
  277. * Mode of the drawer; one of 'over', 'push' or 'side'.
  278. * @return {?}
  279. */
  280. get mode() { return this._mode; }
  281. /**
  282. * @param {?} value
  283. * @return {?}
  284. */
  285. set mode(value) {
  286. this._mode = value;
  287. this._updateFocusTrapState();
  288. this._modeChanged.next();
  289. }
  290. /**
  291. * Whether the drawer can be closed with the escape key or by clicking on the backdrop.
  292. * @return {?}
  293. */
  294. get disableClose() { return this._disableClose; }
  295. /**
  296. * @param {?} value
  297. * @return {?}
  298. */
  299. set disableClose(value) { this._disableClose = coerceBooleanProperty(value); }
  300. /**
  301. * Whether the drawer should focus the first focusable element automatically when opened.
  302. * @return {?}
  303. */
  304. get autoFocus() { return this._autoFocus; }
  305. /**
  306. * @param {?} value
  307. * @return {?}
  308. */
  309. set autoFocus(value) { this._autoFocus = coerceBooleanProperty(value); }
  310. /**
  311. * Event emitted when the drawer has been opened.
  312. * @return {?}
  313. */
  314. get _openedStream() {
  315. return this.openedChange.pipe(filter((/**
  316. * @param {?} o
  317. * @return {?}
  318. */
  319. o => o)), map((/**
  320. * @return {?}
  321. */
  322. () => { })));
  323. }
  324. /**
  325. * Event emitted when the drawer has started opening.
  326. * @return {?}
  327. */
  328. get openedStart() {
  329. return this._animationStarted.pipe(filter((/**
  330. * @param {?} e
  331. * @return {?}
  332. */
  333. e => e.fromState !== e.toState && e.toState.indexOf('open') === 0)), map((/**
  334. * @return {?}
  335. */
  336. () => { })));
  337. }
  338. /**
  339. * Event emitted when the drawer has been closed.
  340. * @return {?}
  341. */
  342. get _closedStream() {
  343. return this.openedChange.pipe(filter((/**
  344. * @param {?} o
  345. * @return {?}
  346. */
  347. o => !o)), map((/**
  348. * @return {?}
  349. */
  350. () => { })));
  351. }
  352. /**
  353. * Event emitted when the drawer has started closing.
  354. * @return {?}
  355. */
  356. get closedStart() {
  357. return this._animationStarted.pipe(filter((/**
  358. * @param {?} e
  359. * @return {?}
  360. */
  361. e => e.fromState !== e.toState && e.toState === 'void')), map((/**
  362. * @return {?}
  363. */
  364. () => { })));
  365. }
  366. /**
  367. * @return {?}
  368. */
  369. get _isFocusTrapEnabled() {
  370. // The focus trap is only enabled when the drawer is open in any mode other than side.
  371. return this.opened && this.mode !== 'side';
  372. }
  373. /**
  374. * Traps focus inside the drawer.
  375. * @private
  376. * @return {?}
  377. */
  378. _trapFocus() {
  379. if (!this.autoFocus) {
  380. return;
  381. }
  382. this._focusTrap.focusInitialElementWhenReady().then((/**
  383. * @param {?} hasMovedFocus
  384. * @return {?}
  385. */
  386. hasMovedFocus => {
  387. // If there were no focusable elements, focus the sidenav itself so the keyboard navigation
  388. // still works. We need to check that `focus` is a function due to Universal.
  389. if (!hasMovedFocus && typeof this._elementRef.nativeElement.focus === 'function') {
  390. this._elementRef.nativeElement.focus();
  391. }
  392. }));
  393. }
  394. /**
  395. * If focus is currently inside the drawer, restores it to where it was before the drawer
  396. * opened.
  397. * @private
  398. * @return {?}
  399. */
  400. _restoreFocus() {
  401. if (!this.autoFocus) {
  402. return;
  403. }
  404. /** @type {?} */
  405. const activeEl = this._doc && this._doc.activeElement;
  406. if (activeEl && this._elementRef.nativeElement.contains(activeEl)) {
  407. if (this._elementFocusedBeforeDrawerWasOpened instanceof HTMLElement) {
  408. this._focusMonitor.focusVia(this._elementFocusedBeforeDrawerWasOpened, this._openedVia);
  409. }
  410. else {
  411. this._elementRef.nativeElement.blur();
  412. }
  413. }
  414. this._elementFocusedBeforeDrawerWasOpened = null;
  415. this._openedVia = null;
  416. }
  417. /**
  418. * @return {?}
  419. */
  420. ngAfterContentInit() {
  421. this._focusTrap = this._focusTrapFactory.create(this._elementRef.nativeElement);
  422. this._updateFocusTrapState();
  423. }
  424. /**
  425. * @return {?}
  426. */
  427. ngAfterContentChecked() {
  428. // Enable the animations after the lifecycle hooks have run, in order to avoid animating
  429. // drawers that are open by default. When we're on the server, we shouldn't enable the
  430. // animations, because we don't want the drawer to animate the first time the user sees
  431. // the page.
  432. if (this._platform.isBrowser) {
  433. this._enableAnimations = true;
  434. }
  435. }
  436. /**
  437. * @return {?}
  438. */
  439. ngOnDestroy() {
  440. if (this._focusTrap) {
  441. this._focusTrap.destroy();
  442. }
  443. this._animationStarted.complete();
  444. this._animationEnd.complete();
  445. this._modeChanged.complete();
  446. this._destroyed.next();
  447. this._destroyed.complete();
  448. }
  449. /**
  450. * Whether the drawer is opened. We overload this because we trigger an event when it
  451. * starts or end.
  452. * @return {?}
  453. */
  454. get opened() { return this._opened; }
  455. /**
  456. * @param {?} value
  457. * @return {?}
  458. */
  459. set opened(value) { this.toggle(coerceBooleanProperty(value)); }
  460. /**
  461. * Open the drawer.
  462. * @param {?=} openedVia Whether the drawer was opened by a key press, mouse click or programmatically.
  463. * Used for focus management after the sidenav is closed.
  464. * @return {?}
  465. */
  466. open(openedVia) {
  467. return this.toggle(true, openedVia);
  468. }
  469. /**
  470. * Close the drawer.
  471. * @return {?}
  472. */
  473. close() {
  474. return this.toggle(false);
  475. }
  476. /**
  477. * Toggle this drawer.
  478. * @param {?=} isOpen Whether the drawer should be open.
  479. * @param {?=} openedVia Whether the drawer was opened by a key press, mouse click or programmatically.
  480. * Used for focus management after the sidenav is closed.
  481. * @return {?}
  482. */
  483. toggle(isOpen = !this.opened, openedVia = 'program') {
  484. this._opened = isOpen;
  485. if (isOpen) {
  486. this._animationState = this._enableAnimations ? 'open' : 'open-instant';
  487. this._openedVia = openedVia;
  488. }
  489. else {
  490. this._animationState = 'void';
  491. this._restoreFocus();
  492. }
  493. this._updateFocusTrapState();
  494. return new Promise((/**
  495. * @param {?} resolve
  496. * @return {?}
  497. */
  498. resolve => {
  499. this.openedChange.pipe(take(1)).subscribe((/**
  500. * @param {?} open
  501. * @return {?}
  502. */
  503. open => resolve(open ? 'open' : 'close')));
  504. }));
  505. }
  506. /**
  507. * @return {?}
  508. */
  509. get _width() {
  510. return this._elementRef.nativeElement ? (this._elementRef.nativeElement.offsetWidth || 0) : 0;
  511. }
  512. /**
  513. * Updates the enabled state of the focus trap.
  514. * @private
  515. * @return {?}
  516. */
  517. _updateFocusTrapState() {
  518. if (this._focusTrap) {
  519. this._focusTrap.enabled = this._isFocusTrapEnabled;
  520. }
  521. }
  522. // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
  523. // In Ivy the `host` bindings will be merged when this class is extended, whereas in
  524. // ViewEngine they're overwritten.
  525. // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
  526. // tslint:disable-next-line:no-host-decorator-in-concrete
  527. /**
  528. * @param {?} event
  529. * @return {?}
  530. */
  531. _animationStartListener(event) {
  532. this._animationStarted.next(event);
  533. }
  534. // We have to use a `HostListener` here in order to support both Ivy and ViewEngine.
  535. // In Ivy the `host` bindings will be merged when this class is extended, whereas in
  536. // ViewEngine they're overwritten.
  537. // TODO(crisbeto): we move this back into `host` once Ivy is turned on by default.
  538. // tslint:disable-next-line:no-host-decorator-in-concrete
  539. /**
  540. * @param {?} event
  541. * @return {?}
  542. */
  543. _animationDoneListener(event) {
  544. this._animationEnd.next(event);
  545. }
  546. }
  547. MatDrawer.decorators = [
  548. { type: Component, args: [{selector: 'mat-drawer',
  549. exportAs: 'matDrawer',
  550. template: "<div class=\"mat-drawer-inner-container\"><ng-content></ng-content></div>",
  551. animations: [matDrawerAnimations.transformDrawer],
  552. host: {
  553. 'class': 'mat-drawer',
  554. // must prevent the browser from aligning text based on value
  555. '[attr.align]': 'null',
  556. '[class.mat-drawer-end]': 'position === "end"',
  557. '[class.mat-drawer-over]': 'mode === "over"',
  558. '[class.mat-drawer-push]': 'mode === "push"',
  559. '[class.mat-drawer-side]': 'mode === "side"',
  560. '[class.mat-drawer-opened]': 'opened',
  561. 'tabIndex': '-1',
  562. },
  563. changeDetection: ChangeDetectionStrategy.OnPush,
  564. encapsulation: ViewEncapsulation.None,
  565. },] },
  566. ];
  567. /** @nocollapse */
  568. MatDrawer.ctorParameters = () => [
  569. { type: ElementRef },
  570. { type: FocusTrapFactory },
  571. { type: FocusMonitor },
  572. { type: Platform },
  573. { type: NgZone },
  574. { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DOCUMENT,] }] }
  575. ];
  576. MatDrawer.propDecorators = {
  577. position: [{ type: Input }],
  578. mode: [{ type: Input }],
  579. disableClose: [{ type: Input }],
  580. autoFocus: [{ type: Input }],
  581. _animationState: [{ type: HostBinding, args: ['@transform',] }],
  582. openedChange: [{ type: Output }],
  583. _openedStream: [{ type: Output, args: ['opened',] }],
  584. openedStart: [{ type: Output }],
  585. _closedStream: [{ type: Output, args: ['closed',] }],
  586. closedStart: [{ type: Output }],
  587. onPositionChanged: [{ type: Output, args: ['positionChanged',] }],
  588. opened: [{ type: Input }],
  589. _animationStartListener: [{ type: HostListener, args: ['@transform.start', ['$event'],] }],
  590. _animationDoneListener: [{ type: HostListener, args: ['@transform.done', ['$event'],] }]
  591. };
  592. /**
  593. * `<mat-drawer-container>` component.
  594. *
  595. * This is the parent component to one or two `<mat-drawer>`s that validates the state internally
  596. * and coordinates the backdrop and content styling.
  597. */
  598. class MatDrawerContainer {
  599. /**
  600. * @param {?} _dir
  601. * @param {?} _element
  602. * @param {?} _ngZone
  603. * @param {?} _changeDetectorRef
  604. * @param {?} viewportRuler
  605. * @param {?=} defaultAutosize
  606. * @param {?=} _animationMode
  607. */
  608. constructor(_dir, _element, _ngZone, _changeDetectorRef, viewportRuler, defaultAutosize = false, _animationMode) {
  609. this._dir = _dir;
  610. this._element = _element;
  611. this._ngZone = _ngZone;
  612. this._changeDetectorRef = _changeDetectorRef;
  613. this._animationMode = _animationMode;
  614. /**
  615. * Event emitted when the drawer backdrop is clicked.
  616. */
  617. this.backdropClick = new EventEmitter();
  618. /**
  619. * Emits when the component is destroyed.
  620. */
  621. this._destroyed = new Subject();
  622. /**
  623. * Emits on every ngDoCheck. Used for debouncing reflows.
  624. */
  625. this._doCheckSubject = new Subject();
  626. /**
  627. * Margins to be applied to the content. These are used to push / shrink the drawer content when a
  628. * drawer is open. We use margin rather than transform even for push mode because transform breaks
  629. * fixed position elements inside of the transformed element.
  630. */
  631. this._contentMargins = { left: null, right: null };
  632. this._contentMarginChanges = new Subject();
  633. // If a `Dir` directive exists up the tree, listen direction changes
  634. // and update the left/right properties to point to the proper start/end.
  635. if (_dir) {
  636. _dir.change.pipe(takeUntil(this._destroyed)).subscribe((/**
  637. * @return {?}
  638. */
  639. () => {
  640. this._validateDrawers();
  641. this.updateContentMargins();
  642. }));
  643. }
  644. // Since the minimum width of the sidenav depends on the viewport width,
  645. // we need to recompute the margins if the viewport changes.
  646. viewportRuler.change()
  647. .pipe(takeUntil(this._destroyed))
  648. .subscribe((/**
  649. * @return {?}
  650. */
  651. () => this.updateContentMargins()));
  652. this._autosize = defaultAutosize;
  653. }
  654. /**
  655. * The drawer child with the `start` position.
  656. * @return {?}
  657. */
  658. get start() { return this._start; }
  659. /**
  660. * The drawer child with the `end` position.
  661. * @return {?}
  662. */
  663. get end() { return this._end; }
  664. /**
  665. * Whether to automatically resize the container whenever
  666. * the size of any of its drawers changes.
  667. *
  668. * **Use at your own risk!** Enabling this option can cause layout thrashing by measuring
  669. * the drawers on every change detection cycle. Can be configured globally via the
  670. * `MAT_DRAWER_DEFAULT_AUTOSIZE` token.
  671. * @return {?}
  672. */
  673. get autosize() { return this._autosize; }
  674. /**
  675. * @param {?} value
  676. * @return {?}
  677. */
  678. set autosize(value) { this._autosize = coerceBooleanProperty(value); }
  679. /**
  680. * Whether the drawer container should have a backdrop while one of the sidenavs is open.
  681. * If explicitly set to `true`, the backdrop will be enabled for drawers in the `side`
  682. * mode as well.
  683. * @return {?}
  684. */
  685. get hasBackdrop() {
  686. if (this._backdropOverride == null) {
  687. return !this._start || this._start.mode !== 'side' || !this._end || this._end.mode !== 'side';
  688. }
  689. return this._backdropOverride;
  690. }
  691. /**
  692. * @param {?} value
  693. * @return {?}
  694. */
  695. set hasBackdrop(value) {
  696. this._backdropOverride = value == null ? null : coerceBooleanProperty(value);
  697. }
  698. /**
  699. * Reference to the CdkScrollable instance that wraps the scrollable content.
  700. * @return {?}
  701. */
  702. get scrollable() {
  703. return this._userContent || this._content;
  704. }
  705. /**
  706. * @return {?}
  707. */
  708. ngAfterContentInit() {
  709. this._drawers.changes.pipe(startWith(null)).subscribe((/**
  710. * @return {?}
  711. */
  712. () => {
  713. this._validateDrawers();
  714. this._drawers.forEach((/**
  715. * @param {?} drawer
  716. * @return {?}
  717. */
  718. (drawer) => {
  719. this._watchDrawerToggle(drawer);
  720. this._watchDrawerPosition(drawer);
  721. this._watchDrawerMode(drawer);
  722. }));
  723. if (!this._drawers.length ||
  724. this._isDrawerOpen(this._start) ||
  725. this._isDrawerOpen(this._end)) {
  726. this.updateContentMargins();
  727. }
  728. this._changeDetectorRef.markForCheck();
  729. }));
  730. this._doCheckSubject.pipe(debounceTime(10), // Arbitrary debounce time, less than a frame at 60fps
  731. takeUntil(this._destroyed)).subscribe((/**
  732. * @return {?}
  733. */
  734. () => this.updateContentMargins()));
  735. }
  736. /**
  737. * @return {?}
  738. */
  739. ngOnDestroy() {
  740. this._contentMarginChanges.complete();
  741. this._doCheckSubject.complete();
  742. this._destroyed.next();
  743. this._destroyed.complete();
  744. }
  745. /**
  746. * Calls `open` of both start and end drawers
  747. * @return {?}
  748. */
  749. open() {
  750. this._drawers.forEach((/**
  751. * @param {?} drawer
  752. * @return {?}
  753. */
  754. drawer => drawer.open()));
  755. }
  756. /**
  757. * Calls `close` of both start and end drawers
  758. * @return {?}
  759. */
  760. close() {
  761. this._drawers.forEach((/**
  762. * @param {?} drawer
  763. * @return {?}
  764. */
  765. drawer => drawer.close()));
  766. }
  767. /**
  768. * Recalculates and updates the inline styles for the content. Note that this should be used
  769. * sparingly, because it causes a reflow.
  770. * @return {?}
  771. */
  772. updateContentMargins() {
  773. // 1. For drawers in `over` mode, they don't affect the content.
  774. // 2. For drawers in `side` mode they should shrink the content. We do this by adding to the
  775. // left margin (for left drawer) or right margin (for right the drawer).
  776. // 3. For drawers in `push` mode the should shift the content without resizing it. We do this by
  777. // adding to the left or right margin and simultaneously subtracting the same amount of
  778. // margin from the other side.
  779. /** @type {?} */
  780. let left = 0;
  781. /** @type {?} */
  782. let right = 0;
  783. if (this._left && this._left.opened) {
  784. if (this._left.mode == 'side') {
  785. left += this._left._width;
  786. }
  787. else if (this._left.mode == 'push') {
  788. /** @type {?} */
  789. const width = this._left._width;
  790. left += width;
  791. right -= width;
  792. }
  793. }
  794. if (this._right && this._right.opened) {
  795. if (this._right.mode == 'side') {
  796. right += this._right._width;
  797. }
  798. else if (this._right.mode == 'push') {
  799. /** @type {?} */
  800. const width = this._right._width;
  801. right += width;
  802. left -= width;
  803. }
  804. }
  805. // If either `right` or `left` is zero, don't set a style to the element. This
  806. // allows users to specify a custom size via CSS class in SSR scenarios where the
  807. // measured widths will always be zero. Note that we reset to `null` here, rather
  808. // than below, in order to ensure that the types in the `if` below are consistent.
  809. left = left || (/** @type {?} */ (null));
  810. right = right || (/** @type {?} */ (null));
  811. if (left !== this._contentMargins.left || right !== this._contentMargins.right) {
  812. this._contentMargins = { left, right };
  813. // Pull back into the NgZone since in some cases we could be outside. We need to be careful
  814. // to do it only when something changed, otherwise we can end up hitting the zone too often.
  815. this._ngZone.run((/**
  816. * @return {?}
  817. */
  818. () => this._contentMarginChanges.next(this._contentMargins)));
  819. }
  820. }
  821. /**
  822. * @return {?}
  823. */
  824. ngDoCheck() {
  825. // If users opted into autosizing, do a check every change detection cycle.
  826. if (this._autosize && this._isPushed()) {
  827. // Run outside the NgZone, otherwise the debouncer will throw us into an infinite loop.
  828. this._ngZone.runOutsideAngular((/**
  829. * @return {?}
  830. */
  831. () => this._doCheckSubject.next()));
  832. }
  833. }
  834. /**
  835. * Subscribes to drawer events in order to set a class on the main container element when the
  836. * drawer is open and the backdrop is visible. This ensures any overflow on the container element
  837. * is properly hidden.
  838. * @private
  839. * @param {?} drawer
  840. * @return {?}
  841. */
  842. _watchDrawerToggle(drawer) {
  843. drawer._animationStarted.pipe(filter((/**
  844. * @param {?} event
  845. * @return {?}
  846. */
  847. (event) => event.fromState !== event.toState)), takeUntil(this._drawers.changes))
  848. .subscribe((/**
  849. * @param {?} event
  850. * @return {?}
  851. */
  852. (event) => {
  853. // Set the transition class on the container so that the animations occur. This should not
  854. // be set initially because animations should only be triggered via a change in state.
  855. if (event.toState !== 'open-instant' && this._animationMode !== 'NoopAnimations') {
  856. this._element.nativeElement.classList.add('mat-drawer-transition');
  857. }
  858. this.updateContentMargins();
  859. this._changeDetectorRef.markForCheck();
  860. }));
  861. if (drawer.mode !== 'side') {
  862. drawer.openedChange.pipe(takeUntil(this._drawers.changes)).subscribe((/**
  863. * @return {?}
  864. */
  865. () => this._setContainerClass(drawer.opened)));
  866. }
  867. }
  868. /**
  869. * Subscribes to drawer onPositionChanged event in order to
  870. * re-validate drawers when the position changes.
  871. * @private
  872. * @param {?} drawer
  873. * @return {?}
  874. */
  875. _watchDrawerPosition(drawer) {
  876. if (!drawer) {
  877. return;
  878. }
  879. // NOTE: We need to wait for the microtask queue to be empty before validating,
  880. // since both drawers may be swapping positions at the same time.
  881. drawer.onPositionChanged.pipe(takeUntil(this._drawers.changes)).subscribe((/**
  882. * @return {?}
  883. */
  884. () => {
  885. this._ngZone.onMicrotaskEmpty.asObservable().pipe(take(1)).subscribe((/**
  886. * @return {?}
  887. */
  888. () => {
  889. this._validateDrawers();
  890. }));
  891. }));
  892. }
  893. /**
  894. * Subscribes to changes in drawer mode so we can run change detection.
  895. * @private
  896. * @param {?} drawer
  897. * @return {?}
  898. */
  899. _watchDrawerMode(drawer) {
  900. if (drawer) {
  901. drawer._modeChanged.pipe(takeUntil(merge(this._drawers.changes, this._destroyed)))
  902. .subscribe((/**
  903. * @return {?}
  904. */
  905. () => {
  906. this.updateContentMargins();
  907. this._changeDetectorRef.markForCheck();
  908. }));
  909. }
  910. }
  911. /**
  912. * Toggles the 'mat-drawer-opened' class on the main 'mat-drawer-container' element.
  913. * @private
  914. * @param {?} isAdd
  915. * @return {?}
  916. */
  917. _setContainerClass(isAdd) {
  918. /** @type {?} */
  919. const classList = this._element.nativeElement.classList;
  920. /** @type {?} */
  921. const className = 'mat-drawer-container-has-open';
  922. if (isAdd) {
  923. classList.add(className);
  924. }
  925. else {
  926. classList.remove(className);
  927. }
  928. }
  929. /**
  930. * Validate the state of the drawer children components.
  931. * @private
  932. * @return {?}
  933. */
  934. _validateDrawers() {
  935. this._start = this._end = null;
  936. // Ensure that we have at most one start and one end drawer.
  937. this._drawers.forEach((/**
  938. * @param {?} drawer
  939. * @return {?}
  940. */
  941. drawer => {
  942. if (drawer.position == 'end') {
  943. if (this._end != null) {
  944. throwMatDuplicatedDrawerError('end');
  945. }
  946. this._end = drawer;
  947. }
  948. else {
  949. if (this._start != null) {
  950. throwMatDuplicatedDrawerError('start');
  951. }
  952. this._start = drawer;
  953. }
  954. }));
  955. this._right = this._left = null;
  956. // Detect if we're LTR or RTL.
  957. if (this._dir && this._dir.value === 'rtl') {
  958. this._left = this._end;
  959. this._right = this._start;
  960. }
  961. else {
  962. this._left = this._start;
  963. this._right = this._end;
  964. }
  965. }
  966. /**
  967. * Whether the container is being pushed to the side by one of the drawers.
  968. * @private
  969. * @return {?}
  970. */
  971. _isPushed() {
  972. return (this._isDrawerOpen(this._start) && this._start.mode != 'over') ||
  973. (this._isDrawerOpen(this._end) && this._end.mode != 'over');
  974. }
  975. /**
  976. * @return {?}
  977. */
  978. _onBackdropClicked() {
  979. this.backdropClick.emit();
  980. this._closeModalDrawer();
  981. }
  982. /**
  983. * @return {?}
  984. */
  985. _closeModalDrawer() {
  986. // Close all open drawers where closing is not disabled and the mode is not `side`.
  987. [this._start, this._end]
  988. .filter((/**
  989. * @param {?} drawer
  990. * @return {?}
  991. */
  992. drawer => drawer && !drawer.disableClose && this._canHaveBackdrop(drawer)))
  993. .forEach((/**
  994. * @param {?} drawer
  995. * @return {?}
  996. */
  997. drawer => (/** @type {?} */ (drawer)).close()));
  998. }
  999. /**
  1000. * @return {?}
  1001. */
  1002. _isShowingBackdrop() {
  1003. return (this._isDrawerOpen(this._start) && this._canHaveBackdrop(this._start)) ||
  1004. (this._isDrawerOpen(this._end) && this._canHaveBackdrop(this._end));
  1005. }
  1006. /**
  1007. * @private
  1008. * @param {?} drawer
  1009. * @return {?}
  1010. */
  1011. _canHaveBackdrop(drawer) {
  1012. return drawer.mode !== 'side' || !!this._backdropOverride;
  1013. }
  1014. /**
  1015. * @private
  1016. * @param {?} drawer
  1017. * @return {?}
  1018. */
  1019. _isDrawerOpen(drawer) {
  1020. return drawer != null && drawer.opened;
  1021. }
  1022. }
  1023. MatDrawerContainer.decorators = [
  1024. { type: Component, args: [{selector: 'mat-drawer-container',
  1025. exportAs: 'matDrawerContainer',
  1026. template: "<div class=\"mat-drawer-backdrop\" (click)=\"_onBackdropClicked()\" *ngIf=\"hasBackdrop\" [class.mat-drawer-shown]=\"_isShowingBackdrop()\"></div><ng-content select=\"mat-drawer\"></ng-content><ng-content select=\"mat-drawer-content\"></ng-content><mat-drawer-content *ngIf=\"!_content\"><ng-content></ng-content></mat-drawer-content>",
  1027. styles: [".mat-drawer-container{position:relative;z-index:1;box-sizing:border-box;-webkit-overflow-scrolling:touch;display:block;overflow:hidden}.mat-drawer-container[fullscreen]{top:0;left:0;right:0;bottom:0;position:absolute}.mat-drawer-container[fullscreen].mat-drawer-container-has-open{overflow:hidden}.mat-drawer-container.mat-drawer-container-explicit-backdrop .mat-drawer-side{z-index:3}.mat-drawer-container.ng-animate-disabled .mat-drawer-backdrop,.mat-drawer-container.ng-animate-disabled .mat-drawer-content,.ng-animate-disabled .mat-drawer-container .mat-drawer-backdrop,.ng-animate-disabled .mat-drawer-container .mat-drawer-content{transition:none}.mat-drawer-backdrop{top:0;left:0;right:0;bottom:0;position:absolute;display:block;z-index:3;visibility:hidden}.mat-drawer-backdrop.mat-drawer-shown{visibility:visible}.mat-drawer-transition .mat-drawer-backdrop{transition-duration:.4s;transition-timing-function:cubic-bezier(.25,.8,.25,1);transition-property:background-color,visibility}@media (-ms-high-contrast:active){.mat-drawer-backdrop{opacity:.5}}.mat-drawer-content{position:relative;z-index:1;display:block;height:100%;overflow:auto}.mat-drawer-transition .mat-drawer-content{transition-duration:.4s;transition-timing-function:cubic-bezier(.25,.8,.25,1);transition-property:transform,margin-left,margin-right}.mat-drawer{position:relative;z-index:4;display:block;position:absolute;top:0;bottom:0;z-index:3;outline:0;box-sizing:border-box;overflow-y:auto;transform:translate3d(-100%,0,0)}@media (-ms-high-contrast:active){.mat-drawer,[dir=rtl] .mat-drawer.mat-drawer-end{border-right:solid 1px currentColor}}@media (-ms-high-contrast:active){.mat-drawer.mat-drawer-end,[dir=rtl] .mat-drawer{border-left:solid 1px currentColor;border-right:none}}.mat-drawer.mat-drawer-side{z-index:2}.mat-drawer.mat-drawer-end{right:0;transform:translate3d(100%,0,0)}[dir=rtl] .mat-drawer{transform:translate3d(100%,0,0)}[dir=rtl] .mat-drawer.mat-drawer-end{left:0;right:auto;transform:translate3d(-100%,0,0)}.mat-drawer-inner-container{width:100%;height:100%;overflow:auto;-webkit-overflow-scrolling:touch}.mat-sidenav-fixed{position:fixed}"],
  1028. host: {
  1029. 'class': 'mat-drawer-container',
  1030. '[class.mat-drawer-container-explicit-backdrop]': '_backdropOverride',
  1031. },
  1032. changeDetection: ChangeDetectionStrategy.OnPush,
  1033. encapsulation: ViewEncapsulation.None,
  1034. },] },
  1035. ];
  1036. /** @nocollapse */
  1037. MatDrawerContainer.ctorParameters = () => [
  1038. { type: Directionality, decorators: [{ type: Optional }] },
  1039. { type: ElementRef },
  1040. { type: NgZone },
  1041. { type: ChangeDetectorRef },
  1042. { type: ViewportRuler },
  1043. { type: undefined, decorators: [{ type: Inject, args: [MAT_DRAWER_DEFAULT_AUTOSIZE,] }] },
  1044. { type: String, decorators: [{ type: Optional }, { type: Inject, args: [ANIMATION_MODULE_TYPE,] }] }
  1045. ];
  1046. MatDrawerContainer.propDecorators = {
  1047. _drawers: [{ type: ContentChildren, args: [MatDrawer,] }],
  1048. _content: [{ type: ContentChild, args: [MatDrawerContent, { static: false },] }],
  1049. _userContent: [{ type: ViewChild, args: [MatDrawerContent, { static: false },] }],
  1050. autosize: [{ type: Input }],
  1051. hasBackdrop: [{ type: Input }],
  1052. backdropClick: [{ type: Output }]
  1053. };
  1054. /**
  1055. * @fileoverview added by tsickle
  1056. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1057. */
  1058. class MatSidenavContent extends MatDrawerContent {
  1059. /**
  1060. * @param {?} changeDetectorRef
  1061. * @param {?} container
  1062. * @param {?} elementRef
  1063. * @param {?} scrollDispatcher
  1064. * @param {?} ngZone
  1065. */
  1066. constructor(changeDetectorRef, container, elementRef, scrollDispatcher, ngZone) {
  1067. super(changeDetectorRef, container, elementRef, scrollDispatcher, ngZone);
  1068. }
  1069. }
  1070. MatSidenavContent.decorators = [
  1071. { type: Component, args: [{selector: 'mat-sidenav-content',
  1072. template: '<ng-content></ng-content>',
  1073. host: {
  1074. 'class': 'mat-drawer-content mat-sidenav-content',
  1075. '[style.margin-left.px]': '_container._contentMargins.left',
  1076. '[style.margin-right.px]': '_container._contentMargins.right',
  1077. },
  1078. changeDetection: ChangeDetectionStrategy.OnPush,
  1079. encapsulation: ViewEncapsulation.None,
  1080. },] },
  1081. ];
  1082. /** @nocollapse */
  1083. MatSidenavContent.ctorParameters = () => [
  1084. { type: ChangeDetectorRef },
  1085. { type: MatSidenavContainer, decorators: [{ type: Inject, args: [forwardRef((/**
  1086. * @return {?}
  1087. */
  1088. () => MatSidenavContainer)),] }] },
  1089. { type: ElementRef },
  1090. { type: ScrollDispatcher },
  1091. { type: NgZone }
  1092. ];
  1093. class MatSidenav extends MatDrawer {
  1094. constructor() {
  1095. super(...arguments);
  1096. this._fixedInViewport = false;
  1097. this._fixedTopGap = 0;
  1098. this._fixedBottomGap = 0;
  1099. }
  1100. /**
  1101. * Whether the sidenav is fixed in the viewport.
  1102. * @return {?}
  1103. */
  1104. get fixedInViewport() { return this._fixedInViewport; }
  1105. /**
  1106. * @param {?} value
  1107. * @return {?}
  1108. */
  1109. set fixedInViewport(value) { this._fixedInViewport = coerceBooleanProperty(value); }
  1110. /**
  1111. * The gap between the top of the sidenav and the top of the viewport when the sidenav is in fixed
  1112. * mode.
  1113. * @return {?}
  1114. */
  1115. get fixedTopGap() { return this._fixedTopGap; }
  1116. /**
  1117. * @param {?} value
  1118. * @return {?}
  1119. */
  1120. set fixedTopGap(value) { this._fixedTopGap = coerceNumberProperty(value); }
  1121. /**
  1122. * The gap between the bottom of the sidenav and the bottom of the viewport when the sidenav is in
  1123. * fixed mode.
  1124. * @return {?}
  1125. */
  1126. get fixedBottomGap() { return this._fixedBottomGap; }
  1127. /**
  1128. * @param {?} value
  1129. * @return {?}
  1130. */
  1131. set fixedBottomGap(value) { this._fixedBottomGap = coerceNumberProperty(value); }
  1132. }
  1133. MatSidenav.decorators = [
  1134. { type: Component, args: [{selector: 'mat-sidenav',
  1135. exportAs: 'matSidenav',
  1136. template: "<div class=\"mat-drawer-inner-container\"><ng-content></ng-content></div>",
  1137. animations: [matDrawerAnimations.transformDrawer],
  1138. host: {
  1139. 'class': 'mat-drawer mat-sidenav',
  1140. 'tabIndex': '-1',
  1141. // must prevent the browser from aligning text based on value
  1142. '[attr.align]': 'null',
  1143. '[class.mat-drawer-end]': 'position === "end"',
  1144. '[class.mat-drawer-over]': 'mode === "over"',
  1145. '[class.mat-drawer-push]': 'mode === "push"',
  1146. '[class.mat-drawer-side]': 'mode === "side"',
  1147. '[class.mat-drawer-opened]': 'opened',
  1148. '[class.mat-sidenav-fixed]': 'fixedInViewport',
  1149. '[style.top.px]': 'fixedInViewport ? fixedTopGap : null',
  1150. '[style.bottom.px]': 'fixedInViewport ? fixedBottomGap : null',
  1151. },
  1152. changeDetection: ChangeDetectionStrategy.OnPush,
  1153. encapsulation: ViewEncapsulation.None,
  1154. },] },
  1155. ];
  1156. MatSidenav.propDecorators = {
  1157. fixedInViewport: [{ type: Input }],
  1158. fixedTopGap: [{ type: Input }],
  1159. fixedBottomGap: [{ type: Input }]
  1160. };
  1161. class MatSidenavContainer extends MatDrawerContainer {
  1162. }
  1163. MatSidenavContainer.decorators = [
  1164. { type: Component, args: [{selector: 'mat-sidenav-container',
  1165. exportAs: 'matSidenavContainer',
  1166. template: "<div class=\"mat-drawer-backdrop\" (click)=\"_onBackdropClicked()\" *ngIf=\"hasBackdrop\" [class.mat-drawer-shown]=\"_isShowingBackdrop()\"></div><ng-content select=\"mat-sidenav\"></ng-content><ng-content select=\"mat-sidenav-content\"></ng-content><mat-sidenav-content *ngIf=\"!_content\" cdkScrollable><ng-content></ng-content></mat-sidenav-content>",
  1167. styles: [".mat-drawer-container{position:relative;z-index:1;box-sizing:border-box;-webkit-overflow-scrolling:touch;display:block;overflow:hidden}.mat-drawer-container[fullscreen]{top:0;left:0;right:0;bottom:0;position:absolute}.mat-drawer-container[fullscreen].mat-drawer-container-has-open{overflow:hidden}.mat-drawer-container.mat-drawer-container-explicit-backdrop .mat-drawer-side{z-index:3}.mat-drawer-container.ng-animate-disabled .mat-drawer-backdrop,.mat-drawer-container.ng-animate-disabled .mat-drawer-content,.ng-animate-disabled .mat-drawer-container .mat-drawer-backdrop,.ng-animate-disabled .mat-drawer-container .mat-drawer-content{transition:none}.mat-drawer-backdrop{top:0;left:0;right:0;bottom:0;position:absolute;display:block;z-index:3;visibility:hidden}.mat-drawer-backdrop.mat-drawer-shown{visibility:visible}.mat-drawer-transition .mat-drawer-backdrop{transition-duration:.4s;transition-timing-function:cubic-bezier(.25,.8,.25,1);transition-property:background-color,visibility}@media (-ms-high-contrast:active){.mat-drawer-backdrop{opacity:.5}}.mat-drawer-content{position:relative;z-index:1;display:block;height:100%;overflow:auto}.mat-drawer-transition .mat-drawer-content{transition-duration:.4s;transition-timing-function:cubic-bezier(.25,.8,.25,1);transition-property:transform,margin-left,margin-right}.mat-drawer{position:relative;z-index:4;display:block;position:absolute;top:0;bottom:0;z-index:3;outline:0;box-sizing:border-box;overflow-y:auto;transform:translate3d(-100%,0,0)}@media (-ms-high-contrast:active){.mat-drawer,[dir=rtl] .mat-drawer.mat-drawer-end{border-right:solid 1px currentColor}}@media (-ms-high-contrast:active){.mat-drawer.mat-drawer-end,[dir=rtl] .mat-drawer{border-left:solid 1px currentColor;border-right:none}}.mat-drawer.mat-drawer-side{z-index:2}.mat-drawer.mat-drawer-end{right:0;transform:translate3d(100%,0,0)}[dir=rtl] .mat-drawer{transform:translate3d(100%,0,0)}[dir=rtl] .mat-drawer.mat-drawer-end{left:0;right:auto;transform:translate3d(-100%,0,0)}.mat-drawer-inner-container{width:100%;height:100%;overflow:auto;-webkit-overflow-scrolling:touch}.mat-sidenav-fixed{position:fixed}"],
  1168. host: {
  1169. 'class': 'mat-drawer-container mat-sidenav-container',
  1170. '[class.mat-drawer-container-explicit-backdrop]': '_backdropOverride',
  1171. },
  1172. changeDetection: ChangeDetectionStrategy.OnPush,
  1173. encapsulation: ViewEncapsulation.None,
  1174. },] },
  1175. ];
  1176. MatSidenavContainer.propDecorators = {
  1177. _drawers: [{ type: ContentChildren, args: [MatSidenav,] }],
  1178. _content: [{ type: ContentChild, args: [MatSidenavContent, { static: false },] }]
  1179. };
  1180. /**
  1181. * @fileoverview added by tsickle
  1182. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1183. */
  1184. class MatSidenavModule {
  1185. }
  1186. MatSidenavModule.decorators = [
  1187. { type: NgModule, args: [{
  1188. imports: [
  1189. CommonModule,
  1190. MatCommonModule,
  1191. ScrollingModule,
  1192. PlatformModule,
  1193. ],
  1194. exports: [
  1195. MatCommonModule,
  1196. MatDrawer,
  1197. MatDrawerContainer,
  1198. MatDrawerContent,
  1199. MatSidenav,
  1200. MatSidenavContainer,
  1201. MatSidenavContent,
  1202. ],
  1203. declarations: [
  1204. MatDrawer,
  1205. MatDrawerContainer,
  1206. MatDrawerContent,
  1207. MatSidenav,
  1208. MatSidenavContainer,
  1209. MatSidenavContent,
  1210. ],
  1211. },] },
  1212. ];
  1213. /**
  1214. * @fileoverview added by tsickle
  1215. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1216. */
  1217. /**
  1218. * @fileoverview added by tsickle
  1219. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1220. */
  1221. export { MatSidenavModule, throwMatDuplicatedDrawerError, MAT_DRAWER_DEFAULT_AUTOSIZE_FACTORY, MAT_DRAWER_DEFAULT_AUTOSIZE, MatDrawerContent, MatDrawer, MatDrawerContainer, MatSidenavContent, MatSidenav, MatSidenavContainer, matDrawerAnimations };
  1222. //# sourceMappingURL=sidenav.js.map