source: trip-planner-front/node_modules/@angular/material/esm2015/expansion/accordion.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 10.3 KB
Line 
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 */
8import { Directive, Input, ContentChildren, QueryList, } from '@angular/core';
9import { coerceBooleanProperty } from '@angular/cdk/coercion';
10import { CdkAccordion } from '@angular/cdk/accordion';
11import { FocusKeyManager } from '@angular/cdk/a11y';
12import { startWith } from 'rxjs/operators';
13import { MAT_ACCORDION } from './accordion-base';
14import { MatExpansionPanelHeader } from './expansion-panel-header';
15/**
16 * Directive for a Material Design Accordion.
17 */
18export class MatAccordion extends CdkAccordion {
19 constructor() {
20 super(...arguments);
21 /** Headers belonging to this accordion. */
22 this._ownHeaders = new QueryList();
23 this._hideToggle = false;
24 /**
25 * Display mode used for all expansion panels in the accordion. Currently two display
26 * modes exist:
27 * default - a gutter-like spacing is placed around any expanded panel, placing the expanded
28 * panel at a different elevation from the rest of the accordion.
29 * flat - no spacing is placed around expanded panels, showing all panels at the same
30 * elevation.
31 */
32 this.displayMode = 'default';
33 /** The position of the expansion indicator. */
34 this.togglePosition = 'after';
35 }
36 /** Whether the expansion indicator should be hidden. */
37 get hideToggle() { return this._hideToggle; }
38 set hideToggle(show) { this._hideToggle = coerceBooleanProperty(show); }
39 ngAfterContentInit() {
40 this._headers.changes
41 .pipe(startWith(this._headers))
42 .subscribe((headers) => {
43 this._ownHeaders.reset(headers.filter(header => header.panel.accordion === this));
44 this._ownHeaders.notifyOnChanges();
45 });
46 this._keyManager = new FocusKeyManager(this._ownHeaders).withWrap().withHomeAndEnd();
47 }
48 /** Handles keyboard events coming in from the panel headers. */
49 _handleHeaderKeydown(event) {
50 this._keyManager.onKeydown(event);
51 }
52 _handleHeaderFocus(header) {
53 this._keyManager.updateActiveItem(header);
54 }
55 ngOnDestroy() {
56 super.ngOnDestroy();
57 this._ownHeaders.destroy();
58 }
59}
60MatAccordion.decorators = [
61 { type: Directive, args: [{
62 selector: 'mat-accordion',
63 exportAs: 'matAccordion',
64 inputs: ['multi'],
65 providers: [{
66 provide: MAT_ACCORDION,
67 useExisting: MatAccordion
68 }],
69 host: {
70 class: 'mat-accordion',
71 // Class binding which is only used by the test harness as there is no other
72 // way for the harness to detect if multiple panel support is enabled.
73 '[class.mat-accordion-multi]': 'this.multi',
74 }
75 },] }
76];
77MatAccordion.propDecorators = {
78 _headers: [{ type: ContentChildren, args: [MatExpansionPanelHeader, { descendants: true },] }],
79 hideToggle: [{ type: Input }],
80 displayMode: [{ type: Input }],
81 togglePosition: [{ type: Input }]
82};
83//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWNjb3JkaW9uLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vc3JjL21hdGVyaWFsL2V4cGFuc2lvbi9hY2NvcmRpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUNMLFNBQVMsRUFDVCxLQUFLLEVBQ0wsZUFBZSxFQUNmLFNBQVMsR0FHVixNQUFNLGVBQWUsQ0FBQztBQUN2QixPQUFPLEVBQWUscUJBQXFCLEVBQUMsTUFBTSx1QkFBdUIsQ0FBQztBQUMxRSxPQUFPLEVBQUMsWUFBWSxFQUFDLE1BQU0sd0JBQXdCLENBQUM7QUFDcEQsT0FBTyxFQUFDLGVBQWUsRUFBQyxNQUFNLG1CQUFtQixDQUFDO0FBQ2xELE9BQU8sRUFBQyxTQUFTLEVBQUMsTUFBTSxnQkFBZ0IsQ0FBQztBQUN6QyxPQUFPLEVBQ0wsYUFBYSxFQUlkLE1BQU0sa0JBQWtCLENBQUM7QUFDMUIsT0FBTyxFQUFDLHVCQUF1QixFQUFDLE1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