source: trip-planner-front/node_modules/@angular/material/bundles/material-expansion.umd.js@ 188ee53

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

initial commit

  • Property mode set to 100644
File size: 48.3 KB
Line 
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/accordion'), require('@angular/cdk/portal'), require('@angular/common'), require('@angular/core'), require('@angular/material/core'), require('@angular/cdk/coercion'), require('@angular/cdk/a11y'), require('rxjs/operators'), require('@angular/cdk/keycodes'), require('@angular/platform-browser/animations'), require('rxjs'), require('@angular/animations'), require('@angular/cdk/collections')) :
3 typeof define === 'function' && define.amd ? define('@angular/material/expansion', ['exports', '@angular/cdk/accordion', '@angular/cdk/portal', '@angular/common', '@angular/core', '@angular/material/core', '@angular/cdk/coercion', '@angular/cdk/a11y', 'rxjs/operators', '@angular/cdk/keycodes', '@angular/platform-browser/animations', 'rxjs', '@angular/animations', '@angular/cdk/collections'], factory) :
4 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ng = global.ng || {}, global.ng.material = global.ng.material || {}, global.ng.material.expansion = {}), global.ng.cdk.accordion, global.ng.cdk.portal, global.ng.common, global.ng.core, global.ng.material.core, global.ng.cdk.coercion, global.ng.cdk.a11y, global.rxjs.operators, global.ng.cdk.keycodes, global.ng.platformBrowser.animations, global.rxjs, global.ng.animations, global.ng.cdk.collections));
5}(this, (function (exports, accordion, portal, common, core, core$1, coercion, a11y, operators, keycodes, animations$1, rxjs, animations, collections) { 'use strict';
6
7 /*! *****************************************************************************
8 Copyright (c) Microsoft Corporation.
9
10 Permission to use, copy, modify, and/or distribute this software for any
11 purpose with or without fee is hereby granted.
12
13 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15 AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18 OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 PERFORMANCE OF THIS SOFTWARE.
20 ***************************************************************************** */
21 /* global Reflect, Promise */
22 var extendStatics = function (d, b) {
23 extendStatics = Object.setPrototypeOf ||
24 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
25 function (d, b) { for (var p in b)
26 if (Object.prototype.hasOwnProperty.call(b, p))
27 d[p] = b[p]; };
28 return extendStatics(d, b);
29 };
30 function __extends(d, b) {
31 if (typeof b !== "function" && b !== null)
32 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
33 extendStatics(d, b);
34 function __() { this.constructor = d; }
35 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36 }
37 var __assign = function () {
38 __assign = Object.assign || function __assign(t) {
39 for (var s, i = 1, n = arguments.length; i < n; i++) {
40 s = arguments[i];
41 for (var p in s)
42 if (Object.prototype.hasOwnProperty.call(s, p))
43 t[p] = s[p];
44 }
45 return t;
46 };
47 return __assign.apply(this, arguments);
48 };
49 function __rest(s, e) {
50 var t = {};
51 for (var p in s)
52 if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
53 t[p] = s[p];
54 if (s != null && typeof Object.getOwnPropertySymbols === "function")
55 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
56 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
57 t[p[i]] = s[p[i]];
58 }
59 return t;
60 }
61 function __decorate(decorators, target, key, desc) {
62 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
63 if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
64 r = Reflect.decorate(decorators, target, key, desc);
65 else
66 for (var i = decorators.length - 1; i >= 0; i--)
67 if (d = decorators[i])
68 r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
69 return c > 3 && r && Object.defineProperty(target, key, r), r;
70 }
71 function __param(paramIndex, decorator) {
72 return function (target, key) { decorator(target, key, paramIndex); };
73 }
74 function __metadata(metadataKey, metadataValue) {
75 if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
76 return Reflect.metadata(metadataKey, metadataValue);
77 }
78 function __awaiter(thisArg, _arguments, P, generator) {
79 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
80 return new (P || (P = Promise))(function (resolve, reject) {
81 function fulfilled(value) { try {
82 step(generator.next(value));
83 }
84 catch (e) {
85 reject(e);
86 } }
87 function rejected(value) { try {
88 step(generator["throw"](value));
89 }
90 catch (e) {
91 reject(e);
92 } }
93 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
94 step((generator = generator.apply(thisArg, _arguments || [])).next());
95 });
96 }
97 function __generator(thisArg, body) {
98 var _ = { label: 0, sent: function () { if (t[0] & 1)
99 throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
100 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
101 function verb(n) { return function (v) { return step([n, v]); }; }
102 function step(op) {
103 if (f)
104 throw new TypeError("Generator is already executing.");
105 while (_)
106 try {
107 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
108 return t;
109 if (y = 0, t)
110 op = [op[0] & 2, t.value];
111 switch (op[0]) {
112 case 0:
113 case 1:
114 t = op;
115 break;
116 case 4:
117 _.label++;
118 return { value: op[1], done: false };
119 case 5:
120 _.label++;
121 y = op[1];
122 op = [0];
123 continue;
124 case 7:
125 op = _.ops.pop();
126 _.trys.pop();
127 continue;
128 default:
129 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
130 _ = 0;
131 continue;
132 }
133 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
134 _.label = op[1];
135 break;
136 }
137 if (op[0] === 6 && _.label < t[1]) {
138 _.label = t[1];
139 t = op;
140 break;
141 }
142 if (t && _.label < t[2]) {
143 _.label = t[2];
144 _.ops.push(op);
145 break;
146 }
147 if (t[2])
148 _.ops.pop();
149 _.trys.pop();
150 continue;
151 }
152 op = body.call(thisArg, _);
153 }
154 catch (e) {
155 op = [6, e];
156 y = 0;
157 }
158 finally {
159 f = t = 0;
160 }
161 if (op[0] & 5)
162 throw op[1];
163 return { value: op[0] ? op[1] : void 0, done: true };
164 }
165 }
166 var __createBinding = Object.create ? (function (o, m, k, k2) {
167 if (k2 === undefined)
168 k2 = k;
169 Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
170 }) : (function (o, m, k, k2) {
171 if (k2 === undefined)
172 k2 = k;
173 o[k2] = m[k];
174 });
175 function __exportStar(m, o) {
176 for (var p in m)
177 if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
178 __createBinding(o, m, p);
179 }
180 function __values(o) {
181 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
182 if (m)
183 return m.call(o);
184 if (o && typeof o.length === "number")
185 return {
186 next: function () {
187 if (o && i >= o.length)
188 o = void 0;
189 return { value: o && o[i++], done: !o };
190 }
191 };
192 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
193 }
194 function __read(o, n) {
195 var m = typeof Symbol === "function" && o[Symbol.iterator];
196 if (!m)
197 return o;
198 var i = m.call(o), r, ar = [], e;
199 try {
200 while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
201 ar.push(r.value);
202 }
203 catch (error) {
204 e = { error: error };
205 }
206 finally {
207 try {
208 if (r && !r.done && (m = i["return"]))
209 m.call(i);
210 }
211 finally {
212 if (e)
213 throw e.error;
214 }
215 }
216 return ar;
217 }
218 /** @deprecated */
219 function __spread() {
220 for (var ar = [], i = 0; i < arguments.length; i++)
221 ar = ar.concat(__read(arguments[i]));
222 return ar;
223 }
224 /** @deprecated */
225 function __spreadArrays() {
226 for (var s = 0, i = 0, il = arguments.length; i < il; i++)
227 s += arguments[i].length;
228 for (var r = Array(s), k = 0, i = 0; i < il; i++)
229 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
230 r[k] = a[j];
231 return r;
232 }
233 function __spreadArray(to, from, pack) {
234 if (pack || arguments.length === 2)
235 for (var i = 0, l = from.length, ar; i < l; i++) {
236 if (ar || !(i in from)) {
237 if (!ar)
238 ar = Array.prototype.slice.call(from, 0, i);
239 ar[i] = from[i];
240 }
241 }
242 return to.concat(ar || from);
243 }
244 function __await(v) {
245 return this instanceof __await ? (this.v = v, this) : new __await(v);
246 }
247 function __asyncGenerator(thisArg, _arguments, generator) {
248 if (!Symbol.asyncIterator)
249 throw new TypeError("Symbol.asyncIterator is not defined.");
250 var g = generator.apply(thisArg, _arguments || []), i, q = [];
251 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
252 function verb(n) { if (g[n])
253 i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
254 function resume(n, v) { try {
255 step(g[n](v));
256 }
257 catch (e) {
258 settle(q[0][3], e);
259 } }
260 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
261 function fulfill(value) { resume("next", value); }
262 function reject(value) { resume("throw", value); }
263 function settle(f, v) { if (f(v), q.shift(), q.length)
264 resume(q[0][0], q[0][1]); }
265 }
266 function __asyncDelegator(o) {
267 var i, p;
268 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
269 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
270 }
271 function __asyncValues(o) {
272 if (!Symbol.asyncIterator)
273 throw new TypeError("Symbol.asyncIterator is not defined.");
274 var m = o[Symbol.asyncIterator], i;
275 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
276 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
277 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
278 }
279 function __makeTemplateObject(cooked, raw) {
280 if (Object.defineProperty) {
281 Object.defineProperty(cooked, "raw", { value: raw });
282 }
283 else {
284 cooked.raw = raw;
285 }
286 return cooked;
287 }
288 ;
289 var __setModuleDefault = Object.create ? (function (o, v) {
290 Object.defineProperty(o, "default", { enumerable: true, value: v });
291 }) : function (o, v) {
292 o["default"] = v;
293 };
294 function __importStar(mod) {
295 if (mod && mod.__esModule)
296 return mod;
297 var result = {};
298 if (mod != null)
299 for (var k in mod)
300 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
301 __createBinding(result, mod, k);
302 __setModuleDefault(result, mod);
303 return result;
304 }
305 function __importDefault(mod) {
306 return (mod && mod.__esModule) ? mod : { default: mod };
307 }
308 function __classPrivateFieldGet(receiver, state, kind, f) {
309 if (kind === "a" && !f)
310 throw new TypeError("Private accessor was defined without a getter");
311 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
312 throw new TypeError("Cannot read private member from an object whose class did not declare it");
313 return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
314 }
315 function __classPrivateFieldSet(receiver, state, value, kind, f) {
316 if (kind === "m")
317 throw new TypeError("Private method is not writable");
318 if (kind === "a" && !f)
319 throw new TypeError("Private accessor was defined without a setter");
320 if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
321 throw new TypeError("Cannot write private member to an object whose class did not declare it");
322 return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
323 }
324
325 /**
326 * @license
327 * Copyright Google LLC All Rights Reserved.
328 *
329 * Use of this source code is governed by an MIT-style license that can be
330 * found in the LICENSE file at https://angular.io/license
331 */
332 /**
333 * Token used to provide a `MatAccordion` to `MatExpansionPanel`.
334 * Used primarily to avoid circular imports between `MatAccordion` and `MatExpansionPanel`.
335 */
336 var MAT_ACCORDION = new core.InjectionToken('MAT_ACCORDION');
337
338 /**
339 * @license
340 * Copyright Google LLC All Rights Reserved.
341 *
342 * Use of this source code is governed by an MIT-style license that can be
343 * found in the LICENSE file at https://angular.io/license
344 */
345 /** Time and timing curve for expansion panel animations. */
346 // Note: Keep this in sync with the Sass variable for the panel header animation.
347 var EXPANSION_PANEL_ANIMATION_TIMING = '225ms cubic-bezier(0.4,0.0,0.2,1)';
348 /**
349 * Animations used by the Material expansion panel.
350 *
351 * A bug in angular animation's `state` when ViewContainers are moved using ViewContainerRef.move()
352 * causes the animation state of moved components to become `void` upon exit, and not update again
353 * upon reentry into the DOM. This can lead a to situation for the expansion panel where the state
354 * of the panel is `expanded` or `collapsed` but the animation state is `void`.
355 *
356 * To correctly handle animating to the next state, we animate between `void` and `collapsed` which
357 * are defined to have the same styles. Since angular animates from the current styles to the
358 * destination state's style definition, in situations where we are moving from `void`'s styles to
359 * `collapsed` this acts a noop since no style values change.
360 *
361 * In the case where angular's animation state is out of sync with the expansion panel's state, the
362 * expansion panel being `expanded` and angular animations being `void`, the animation from the
363 * `expanded`'s effective styles (though in a `void` animation state) to the collapsed state will
364 * occur as expected.
365 *
366 * Angular Bug: https://github.com/angular/angular/issues/18847
367 *
368 * @docs-private
369 */
370 var matExpansionAnimations = {
371 /** Animation that rotates the indicator arrow. */
372 indicatorRotate: animations.trigger('indicatorRotate', [
373 animations.state('collapsed, void', animations.style({ transform: 'rotate(0deg)' })),
374 animations.state('expanded', animations.style({ transform: 'rotate(180deg)' })),
375 animations.transition('expanded <=> collapsed, void => collapsed', animations.animate(EXPANSION_PANEL_ANIMATION_TIMING)),
376 ]),
377 /** Animation that expands and collapses the panel content. */
378 bodyExpansion: animations.trigger('bodyExpansion', [
379 animations.state('collapsed, void', animations.style({ height: '0px', visibility: 'hidden' })),
380 animations.state('expanded', animations.style({ height: '*', visibility: 'visible' })),
381 animations.transition('expanded <=> collapsed, void => collapsed', animations.animate(EXPANSION_PANEL_ANIMATION_TIMING)),
382 ])
383 };
384
385 /**
386 * @license
387 * Copyright Google LLC All Rights Reserved.
388 *
389 * Use of this source code is governed by an MIT-style license that can be
390 * found in the LICENSE file at https://angular.io/license
391 */
392 /**
393 * Expansion panel content that will be rendered lazily
394 * after the panel is opened for the first time.
395 */
396 var MatExpansionPanelContent = /** @class */ (function () {
397 function MatExpansionPanelContent(_template) {
398 this._template = _template;
399 }
400 return MatExpansionPanelContent;
401 }());
402 MatExpansionPanelContent.decorators = [
403 { type: core.Directive, args: [{
404 selector: 'ng-template[matExpansionPanelContent]'
405 },] }
406 ];
407 MatExpansionPanelContent.ctorParameters = function () { return [
408 { type: core.TemplateRef }
409 ]; };
410
411 /** Counter for generating unique element ids. */
412 var uniqueId = 0;
413 /**
414 * Injection token that can be used to configure the default
415 * options for the expansion panel component.
416 */
417 var MAT_EXPANSION_PANEL_DEFAULT_OPTIONS = new core.InjectionToken('MAT_EXPANSION_PANEL_DEFAULT_OPTIONS');
418 var ɵ0 = undefined;
419 /**
420 * This component can be used as a single element to show expandable content, or as one of
421 * multiple children of an element with the MatAccordion directive attached.
422 */
423 var MatExpansionPanel = /** @class */ (function (_super) {
424 __extends(MatExpansionPanel, _super);
425 function MatExpansionPanel(accordion, _changeDetectorRef, _uniqueSelectionDispatcher, _viewContainerRef, _document, _animationMode, defaultOptions) {
426 var _this = _super.call(this, accordion, _changeDetectorRef, _uniqueSelectionDispatcher) || this;
427 _this._viewContainerRef = _viewContainerRef;
428 _this._animationMode = _animationMode;
429 _this._hideToggle = false;
430 /** An event emitted after the body's expansion animation happens. */
431 _this.afterExpand = new core.EventEmitter();
432 /** An event emitted after the body's collapse animation happens. */
433 _this.afterCollapse = new core.EventEmitter();
434 /** Stream that emits for changes in `@Input` properties. */
435 _this._inputChanges = new rxjs.Subject();
436 /** ID for the associated header element. Used for a11y labelling. */
437 _this._headerId = "mat-expansion-panel-header-" + uniqueId++;
438 /** Stream of body animation done events. */
439 _this._bodyAnimationDone = new rxjs.Subject();
440 _this.accordion = accordion;
441 _this._document = _document;
442 // We need a Subject with distinctUntilChanged, because the `done` event
443 // fires twice on some browsers. See https://github.com/angular/angular/issues/24084
444 _this._bodyAnimationDone.pipe(operators.distinctUntilChanged(function (x, y) {
445 return x.fromState === y.fromState && x.toState === y.toState;
446 })).subscribe(function (event) {
447 if (event.fromState !== 'void') {
448 if (event.toState === 'expanded') {
449 _this.afterExpand.emit();
450 }
451 else if (event.toState === 'collapsed') {
452 _this.afterCollapse.emit();
453 }
454 }
455 });
456 if (defaultOptions) {
457 _this.hideToggle = defaultOptions.hideToggle;
458 }
459 return _this;
460 }
461 Object.defineProperty(MatExpansionPanel.prototype, "hideToggle", {
462 /** Whether the toggle indicator should be hidden. */
463 get: function () {
464 return this._hideToggle || (this.accordion && this.accordion.hideToggle);
465 },
466 set: function (value) {
467 this._hideToggle = coercion.coerceBooleanProperty(value);
468 },
469 enumerable: false,
470 configurable: true
471 });
472 Object.defineProperty(MatExpansionPanel.prototype, "togglePosition", {
473 /** The position of the expansion indicator. */
474 get: function () {
475 return this._togglePosition || (this.accordion && this.accordion.togglePosition);
476 },
477 set: function (value) {
478 this._togglePosition = value;
479 },
480 enumerable: false,
481 configurable: true
482 });
483 /** Determines whether the expansion panel should have spacing between it and its siblings. */
484 MatExpansionPanel.prototype._hasSpacing = function () {
485 if (this.accordion) {
486 return this.expanded && this.accordion.displayMode === 'default';
487 }
488 return false;
489 };
490 /** Gets the expanded state string. */
491 MatExpansionPanel.prototype._getExpandedState = function () {
492 return this.expanded ? 'expanded' : 'collapsed';
493 };
494 /** Toggles the expanded state of the expansion panel. */
495 MatExpansionPanel.prototype.toggle = function () {
496 this.expanded = !this.expanded;
497 };
498 /** Sets the expanded state of the expansion panel to false. */
499 MatExpansionPanel.prototype.close = function () {
500 this.expanded = false;
501 };
502 /** Sets the expanded state of the expansion panel to true. */
503 MatExpansionPanel.prototype.open = function () {
504 this.expanded = true;
505 };
506 MatExpansionPanel.prototype.ngAfterContentInit = function () {
507 var _this = this;
508 if (this._lazyContent) {
509 // Render the content as soon as the panel becomes open.
510 this.opened.pipe(operators.startWith(null), operators.filter(function () { return _this.expanded && !_this._portal; }), operators.take(1)).subscribe(function () {
511 _this._portal = new portal.TemplatePortal(_this._lazyContent._template, _this._viewContainerRef);
512 });
513 }
514 };
515 MatExpansionPanel.prototype.ngOnChanges = function (changes) {
516 this._inputChanges.next(changes);
517 };
518 MatExpansionPanel.prototype.ngOnDestroy = function () {
519 _super.prototype.ngOnDestroy.call(this);
520 this._bodyAnimationDone.complete();
521 this._inputChanges.complete();
522 };
523 /** Checks whether the expansion panel's content contains the currently-focused element. */
524 MatExpansionPanel.prototype._containsFocus = function () {
525 if (this._body) {
526 var focusedElement = this._document.activeElement;
527 var bodyElement = this._body.nativeElement;
528 return focusedElement === bodyElement || bodyElement.contains(focusedElement);
529 }
530 return false;
531 };
532 return MatExpansionPanel;
533 }(accordion.CdkAccordionItem));
534 MatExpansionPanel.decorators = [
535 { type: core.Component, args: [{
536 selector: 'mat-expansion-panel',
537 exportAs: 'matExpansionPanel',
538 template: "<ng-content select=\"mat-expansion-panel-header\"></ng-content>\n<div class=\"mat-expansion-panel-content\"\n role=\"region\"\n [@bodyExpansion]=\"_getExpandedState()\"\n (@bodyExpansion.done)=\"_bodyAnimationDone.next($event)\"\n [attr.aria-labelledby]=\"_headerId\"\n [id]=\"id\"\n #body>\n <div class=\"mat-expansion-panel-body\">\n <ng-content></ng-content>\n <ng-template [cdkPortalOutlet]=\"_portal\"></ng-template>\n </div>\n <ng-content select=\"mat-action-row\"></ng-content>\n</div>\n",
539 encapsulation: core.ViewEncapsulation.None,
540 changeDetection: core.ChangeDetectionStrategy.OnPush,
541 inputs: ['disabled', 'expanded'],
542 outputs: ['opened', 'closed', 'expandedChange'],
543 animations: [matExpansionAnimations.bodyExpansion],
544 providers: [
545 // Provide MatAccordion as undefined to prevent nested expansion panels from registering
546 // to the same accordion.
547 { provide: MAT_ACCORDION, useValue: ɵ0 },
548 ],
549 host: {
550 'class': 'mat-expansion-panel',
551 '[class.mat-expanded]': 'expanded',
552 '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
553 '[class.mat-expansion-panel-spacing]': '_hasSpacing()',
554 },
555 styles: [".mat-expansion-panel{box-sizing:content-box;display:block;margin:0;border-radius:4px;overflow:hidden;transition:margin 225ms cubic-bezier(0.4, 0, 0.2, 1),box-shadow 280ms cubic-bezier(0.4, 0, 0.2, 1);position:relative}.mat-accordion .mat-expansion-panel:not(.mat-expanded),.mat-accordion .mat-expansion-panel:not(.mat-expansion-panel-spacing){border-radius:0}.mat-accordion .mat-expansion-panel:first-of-type{border-top-right-radius:4px;border-top-left-radius:4px}.mat-accordion .mat-expansion-panel:last-of-type{border-bottom-right-radius:4px;border-bottom-left-radius:4px}.cdk-high-contrast-active .mat-expansion-panel{outline:solid 1px}.mat-expansion-panel.ng-animate-disabled,.ng-animate-disabled .mat-expansion-panel,.mat-expansion-panel._mat-animation-noopable{transition:none}.mat-expansion-panel-content{display:flex;flex-direction:column;overflow:visible}.mat-expansion-panel-body{padding:0 24px 16px}.mat-expansion-panel-spacing{margin:16px 0}.mat-accordion>.mat-expansion-panel-spacing:first-child,.mat-accordion>*:first-child:not(.mat-expansion-panel) .mat-expansion-panel-spacing{margin-top:0}.mat-accordion>.mat-expansion-panel-spacing:last-child,.mat-accordion>*:last-child:not(.mat-expansion-panel) .mat-expansion-panel-spacing{margin-bottom:0}.mat-action-row{border-top-style:solid;border-top-width:1px;display:flex;flex-direction:row;justify-content:flex-end;padding:16px 8px 16px 24px}.mat-action-row button.mat-button-base,.mat-action-row button.mat-mdc-button-base{margin-left:8px}[dir=rtl] .mat-action-row button.mat-button-base,[dir=rtl] .mat-action-row button.mat-mdc-button-base{margin-left:0;margin-right:8px}\n"]
556 },] }
557 ];
558 MatExpansionPanel.ctorParameters = function () { return [
559 { type: undefined, decorators: [{ type: core.Optional }, { type: core.SkipSelf }, { type: core.Inject, args: [MAT_ACCORDION,] }] },
560 { type: core.ChangeDetectorRef },
561 { type: collections.UniqueSelectionDispatcher },
562 { type: core.ViewContainerRef },
563 { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
564 { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations$1.ANIMATION_MODULE_TYPE,] }] },
565 { type: undefined, decorators: [{ type: core.Inject, args: [MAT_EXPANSION_PANEL_DEFAULT_OPTIONS,] }, { type: core.Optional }] }
566 ]; };
567 MatExpansionPanel.propDecorators = {
568 hideToggle: [{ type: core.Input }],
569 togglePosition: [{ type: core.Input }],
570 afterExpand: [{ type: core.Output }],
571 afterCollapse: [{ type: core.Output }],
572 _lazyContent: [{ type: core.ContentChild, args: [MatExpansionPanelContent,] }],
573 _body: [{ type: core.ViewChild, args: ['body',] }]
574 };
575 /**
576 * Actions of a `<mat-expansion-panel>`.
577 */
578 var MatExpansionPanelActionRow = /** @class */ (function () {
579 function MatExpansionPanelActionRow() {
580 }
581 return MatExpansionPanelActionRow;
582 }());
583 MatExpansionPanelActionRow.decorators = [
584 { type: core.Directive, args: [{
585 selector: 'mat-action-row',
586 host: {
587 class: 'mat-action-row'
588 }
589 },] }
590 ];
591
592 // Boilerplate for applying mixins to MatExpansionPanelHeader.
593 /** @docs-private */
594 var MatExpansionPanelHeaderBase = /** @class */ (function () {
595 function MatExpansionPanelHeaderBase() {
596 }
597 return MatExpansionPanelHeaderBase;
598 }());
599 var _MatExpansionPanelHeaderMixinBase = core$1.mixinTabIndex(MatExpansionPanelHeaderBase);
600 /**
601 * Header element of a `<mat-expansion-panel>`.
602 */
603 var MatExpansionPanelHeader = /** @class */ (function (_super) {
604 __extends(MatExpansionPanelHeader, _super);
605 function MatExpansionPanelHeader(panel, _element, _focusMonitor, _changeDetectorRef, defaultOptions, _animationMode, tabIndex) {
606 var _this = _super.call(this) || this;
607 _this.panel = panel;
608 _this._element = _element;
609 _this._focusMonitor = _focusMonitor;
610 _this._changeDetectorRef = _changeDetectorRef;
611 _this._animationMode = _animationMode;
612 _this._parentChangeSubscription = rxjs.Subscription.EMPTY;
613 var accordionHideToggleChange = panel.accordion ?
614 panel.accordion._stateChanges.pipe(operators.filter(function (changes) { return !!(changes['hideToggle'] || changes['togglePosition']); })) :
615 rxjs.EMPTY;
616 _this.tabIndex = parseInt(tabIndex || '') || 0;
617 // Since the toggle state depends on an @Input on the panel, we
618 // need to subscribe and trigger change detection manually.
619 _this._parentChangeSubscription =
620 rxjs.merge(panel.opened, panel.closed, accordionHideToggleChange, panel._inputChanges.pipe(operators.filter(function (changes) {
621 return !!(changes['hideToggle'] ||
622 changes['disabled'] ||
623 changes['togglePosition']);
624 })))
625 .subscribe(function () { return _this._changeDetectorRef.markForCheck(); });
626 // Avoids focus being lost if the panel contained the focused element and was closed.
627 panel.closed
628 .pipe(operators.filter(function () { return panel._containsFocus(); }))
629 .subscribe(function () { return _focusMonitor.focusVia(_element, 'program'); });
630 if (defaultOptions) {
631 _this.expandedHeight = defaultOptions.expandedHeight;
632 _this.collapsedHeight = defaultOptions.collapsedHeight;
633 }
634 return _this;
635 }
636 Object.defineProperty(MatExpansionPanelHeader.prototype, "disabled", {
637 /**
638 * Whether the associated panel is disabled. Implemented as a part of `FocusableOption`.
639 * @docs-private
640 */
641 get: function () {
642 return this.panel.disabled;
643 },
644 enumerable: false,
645 configurable: true
646 });
647 /** Toggles the expanded state of the panel. */
648 MatExpansionPanelHeader.prototype._toggle = function () {
649 if (!this.disabled) {
650 this.panel.toggle();
651 }
652 };
653 /** Gets whether the panel is expanded. */
654 MatExpansionPanelHeader.prototype._isExpanded = function () {
655 return this.panel.expanded;
656 };
657 /** Gets the expanded state string of the panel. */
658 MatExpansionPanelHeader.prototype._getExpandedState = function () {
659 return this.panel._getExpandedState();
660 };
661 /** Gets the panel id. */
662 MatExpansionPanelHeader.prototype._getPanelId = function () {
663 return this.panel.id;
664 };
665 /** Gets the toggle position for the header. */
666 MatExpansionPanelHeader.prototype._getTogglePosition = function () {
667 return this.panel.togglePosition;
668 };
669 /** Gets whether the expand indicator should be shown. */
670 MatExpansionPanelHeader.prototype._showToggle = function () {
671 return !this.panel.hideToggle && !this.panel.disabled;
672 };
673 /**
674 * Gets the current height of the header. Null if no custom height has been
675 * specified, and if the default height from the stylesheet should be used.
676 */
677 MatExpansionPanelHeader.prototype._getHeaderHeight = function () {
678 var isExpanded = this._isExpanded();
679 if (isExpanded && this.expandedHeight) {
680 return this.expandedHeight;
681 }
682 else if (!isExpanded && this.collapsedHeight) {
683 return this.collapsedHeight;
684 }
685 return null;
686 };
687 /** Handle keydown event calling to toggle() if appropriate. */
688 MatExpansionPanelHeader.prototype._keydown = function (event) {
689 switch (event.keyCode) {
690 // Toggle for space and enter keys.
691 case keycodes.SPACE:
692 case keycodes.ENTER:
693 if (!keycodes.hasModifierKey(event)) {
694 event.preventDefault();
695 this._toggle();
696 }
697 break;
698 default:
699 if (this.panel.accordion) {
700 this.panel.accordion._handleHeaderKeydown(event);
701 }
702 return;
703 }
704 };
705 /**
706 * Focuses the panel header. Implemented as a part of `FocusableOption`.
707 * @param origin Origin of the action that triggered the focus.
708 * @docs-private
709 */
710 MatExpansionPanelHeader.prototype.focus = function (origin, options) {
711 if (origin) {
712 this._focusMonitor.focusVia(this._element, origin, options);
713 }
714 else {
715 this._element.nativeElement.focus(options);
716 }
717 };
718 MatExpansionPanelHeader.prototype.ngAfterViewInit = function () {
719 var _this = this;
720 this._focusMonitor.monitor(this._element).subscribe(function (origin) {
721 if (origin && _this.panel.accordion) {
722 _this.panel.accordion._handleHeaderFocus(_this);
723 }
724 });
725 };
726 MatExpansionPanelHeader.prototype.ngOnDestroy = function () {
727 this._parentChangeSubscription.unsubscribe();
728 this._focusMonitor.stopMonitoring(this._element);
729 };
730 return MatExpansionPanelHeader;
731 }(_MatExpansionPanelHeaderMixinBase));
732 MatExpansionPanelHeader.decorators = [
733 { type: core.Component, args: [{
734 selector: 'mat-expansion-panel-header',
735 template: "<span class=\"mat-content\">\n <ng-content select=\"mat-panel-title\"></ng-content>\n <ng-content select=\"mat-panel-description\"></ng-content>\n <ng-content></ng-content>\n</span>\n<span [@indicatorRotate]=\"_getExpandedState()\" *ngIf=\"_showToggle()\"\n class=\"mat-expansion-indicator\"></span>\n",
736 encapsulation: core.ViewEncapsulation.None,
737 changeDetection: core.ChangeDetectionStrategy.OnPush,
738 inputs: ['tabIndex'],
739 animations: [
740 matExpansionAnimations.indicatorRotate,
741 ],
742 host: {
743 'class': 'mat-expansion-panel-header mat-focus-indicator',
744 'role': 'button',
745 '[attr.id]': 'panel._headerId',
746 '[attr.tabindex]': 'tabIndex',
747 '[attr.aria-controls]': '_getPanelId()',
748 '[attr.aria-expanded]': '_isExpanded()',
749 '[attr.aria-disabled]': 'panel.disabled',
750 '[class.mat-expanded]': '_isExpanded()',
751 '[class.mat-expansion-toggle-indicator-after]': "_getTogglePosition() === 'after'",
752 '[class.mat-expansion-toggle-indicator-before]': "_getTogglePosition() === 'before'",
753 '[class._mat-animation-noopable]': '_animationMode === "NoopAnimations"',
754 '[style.height]': '_getHeaderHeight()',
755 '(click)': '_toggle()',
756 '(keydown)': '_keydown($event)',
757 },
758 styles: [".mat-expansion-panel-header{display:flex;flex-direction:row;align-items:center;padding:0 24px;border-radius:inherit;transition:height 225ms cubic-bezier(0.4, 0, 0.2, 1)}.mat-expansion-panel-header._mat-animation-noopable{transition:none}.mat-expansion-panel-header:focus,.mat-expansion-panel-header:hover{outline:none}.mat-expansion-panel-header.mat-expanded:focus,.mat-expansion-panel-header.mat-expanded:hover{background:inherit}.mat-expansion-panel-header:not([aria-disabled=true]){cursor:pointer}.mat-expansion-panel-header.mat-expansion-toggle-indicator-before{flex-direction:row-reverse}.mat-expansion-panel-header.mat-expansion-toggle-indicator-before .mat-expansion-indicator{margin:0 16px 0 0}[dir=rtl] .mat-expansion-panel-header.mat-expansion-toggle-indicator-before .mat-expansion-indicator{margin:0 0 0 16px}.mat-content{display:flex;flex:1;flex-direction:row;overflow:hidden}.mat-expansion-panel-header-title,.mat-expansion-panel-header-description{display:flex;flex-grow:1;margin-right:16px}[dir=rtl] .mat-expansion-panel-header-title,[dir=rtl] .mat-expansion-panel-header-description{margin-right:0;margin-left:16px}.mat-expansion-panel-header-description{flex-grow:2}.mat-expansion-indicator::after{border-style:solid;border-width:0 2px 2px 0;content:\"\";display:inline-block;padding:3px;transform:rotate(45deg);vertical-align:middle}.cdk-high-contrast-active .mat-expansion-panel .mat-expansion-panel-header.cdk-keyboard-focused:not([aria-disabled=true])::before,.cdk-high-contrast-active .mat-expansion-panel .mat-expansion-panel-header.cdk-program-focused:not([aria-disabled=true])::before,.cdk-high-contrast-active .mat-expansion-panel:not(.mat-expanded) .mat-expansion-panel-header:hover:not([aria-disabled=true])::before{top:0;left:0;right:0;bottom:0;position:absolute;box-sizing:border-box;pointer-events:none;border:3px solid;border-radius:4px;content:\"\"}.cdk-high-contrast-active .mat-expansion-panel-content{border-top:1px solid;border-top-left-radius:0;border-top-right-radius:0}\n"]
759 },] }
760 ];
761 MatExpansionPanelHeader.ctorParameters = function () { return [
762 { type: MatExpansionPanel, decorators: [{ type: core.Host }] },
763 { type: core.ElementRef },
764 { type: a11y.FocusMonitor },
765 { type: core.ChangeDetectorRef },
766 { type: undefined, decorators: [{ type: core.Inject, args: [MAT_EXPANSION_PANEL_DEFAULT_OPTIONS,] }, { type: core.Optional }] },
767 { type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [animations$1.ANIMATION_MODULE_TYPE,] }] },
768 { type: String, decorators: [{ type: core.Attribute, args: ['tabindex',] }] }
769 ]; };
770 MatExpansionPanelHeader.propDecorators = {
771 expandedHeight: [{ type: core.Input }],
772 collapsedHeight: [{ type: core.Input }]
773 };
774 /**
775 * Description element of a `<mat-expansion-panel-header>`.
776 */
777 var MatExpansionPanelDescription = /** @class */ (function () {
778 function MatExpansionPanelDescription() {
779 }
780 return MatExpansionPanelDescription;
781 }());
782 MatExpansionPanelDescription.decorators = [
783 { type: core.Directive, args: [{
784 selector: 'mat-panel-description',
785 host: {
786 class: 'mat-expansion-panel-header-description'
787 }
788 },] }
789 ];
790 /**
791 * Title element of a `<mat-expansion-panel-header>`.
792 */
793 var MatExpansionPanelTitle = /** @class */ (function () {
794 function MatExpansionPanelTitle() {
795 }
796 return MatExpansionPanelTitle;
797 }());
798 MatExpansionPanelTitle.decorators = [
799 { type: core.Directive, args: [{
800 selector: 'mat-panel-title',
801 host: {
802 class: 'mat-expansion-panel-header-title'
803 }
804 },] }
805 ];
806
807 /**
808 * Directive for a Material Design Accordion.
809 */
810 var MatAccordion = /** @class */ (function (_super) {
811 __extends(MatAccordion, _super);
812 function MatAccordion() {
813 var _this = _super.apply(this, __spreadArray([], __read(arguments))) || this;
814 /** Headers belonging to this accordion. */
815 _this._ownHeaders = new core.QueryList();
816 _this._hideToggle = false;
817 /**
818 * Display mode used for all expansion panels in the accordion. Currently two display
819 * modes exist:
820 * default - a gutter-like spacing is placed around any expanded panel, placing the expanded
821 * panel at a different elevation from the rest of the accordion.
822 * flat - no spacing is placed around expanded panels, showing all panels at the same
823 * elevation.
824 */
825 _this.displayMode = 'default';
826 /** The position of the expansion indicator. */
827 _this.togglePosition = 'after';
828 return _this;
829 }
830 Object.defineProperty(MatAccordion.prototype, "hideToggle", {
831 /** Whether the expansion indicator should be hidden. */
832 get: function () { return this._hideToggle; },
833 set: function (show) { this._hideToggle = coercion.coerceBooleanProperty(show); },
834 enumerable: false,
835 configurable: true
836 });
837 MatAccordion.prototype.ngAfterContentInit = function () {
838 var _this = this;
839 this._headers.changes
840 .pipe(operators.startWith(this._headers))
841 .subscribe(function (headers) {
842 _this._ownHeaders.reset(headers.filter(function (header) { return header.panel.accordion === _this; }));
843 _this._ownHeaders.notifyOnChanges();
844 });
845 this._keyManager = new a11y.FocusKeyManager(this._ownHeaders).withWrap().withHomeAndEnd();
846 };
847 /** Handles keyboard events coming in from the panel headers. */
848 MatAccordion.prototype._handleHeaderKeydown = function (event) {
849 this._keyManager.onKeydown(event);
850 };
851 MatAccordion.prototype._handleHeaderFocus = function (header) {
852 this._keyManager.updateActiveItem(header);
853 };
854 MatAccordion.prototype.ngOnDestroy = function () {
855 _super.prototype.ngOnDestroy.call(this);
856 this._ownHeaders.destroy();
857 };
858 return MatAccordion;
859 }(accordion.CdkAccordion));
860 MatAccordion.decorators = [
861 { type: core.Directive, args: [{
862 selector: 'mat-accordion',
863 exportAs: 'matAccordion',
864 inputs: ['multi'],
865 providers: [{
866 provide: MAT_ACCORDION,
867 useExisting: MatAccordion
868 }],
869 host: {
870 class: 'mat-accordion',
871 // Class binding which is only used by the test harness as there is no other
872 // way for the harness to detect if multiple panel support is enabled.
873 '[class.mat-accordion-multi]': 'this.multi',
874 }
875 },] }
876 ];
877 MatAccordion.propDecorators = {
878 _headers: [{ type: core.ContentChildren, args: [MatExpansionPanelHeader, { descendants: true },] }],
879 hideToggle: [{ type: core.Input }],
880 displayMode: [{ type: core.Input }],
881 togglePosition: [{ type: core.Input }]
882 };
883
884 /**
885 * @license
886 * Copyright Google LLC All Rights Reserved.
887 *
888 * Use of this source code is governed by an MIT-style license that can be
889 * found in the LICENSE file at https://angular.io/license
890 */
891 var MatExpansionModule = /** @class */ (function () {
892 function MatExpansionModule() {
893 }
894 return MatExpansionModule;
895 }());
896 MatExpansionModule.decorators = [
897 { type: core.NgModule, args: [{
898 imports: [common.CommonModule, core$1.MatCommonModule, accordion.CdkAccordionModule, portal.PortalModule],
899 exports: [
900 MatAccordion,
901 MatExpansionPanel,
902 MatExpansionPanelActionRow,
903 MatExpansionPanelHeader,
904 MatExpansionPanelTitle,
905 MatExpansionPanelDescription,
906 MatExpansionPanelContent,
907 ],
908 declarations: [
909 MatAccordion,
910 MatExpansionPanel,
911 MatExpansionPanelActionRow,
912 MatExpansionPanelHeader,
913 MatExpansionPanelTitle,
914 MatExpansionPanelDescription,
915 MatExpansionPanelContent,
916 ],
917 },] }
918 ];
919
920 /**
921 * @license
922 * Copyright Google LLC All Rights Reserved.
923 *
924 * Use of this source code is governed by an MIT-style license that can be
925 * found in the LICENSE file at https://angular.io/license
926 */
927
928 /**
929 * Generated bundle index. Do not edit.
930 */
931
932 exports.EXPANSION_PANEL_ANIMATION_TIMING = EXPANSION_PANEL_ANIMATION_TIMING;
933 exports.MAT_ACCORDION = MAT_ACCORDION;
934 exports.MAT_EXPANSION_PANEL_DEFAULT_OPTIONS = MAT_EXPANSION_PANEL_DEFAULT_OPTIONS;
935 exports.MatAccordion = MatAccordion;
936 exports.MatExpansionModule = MatExpansionModule;
937 exports.MatExpansionPanel = MatExpansionPanel;
938 exports.MatExpansionPanelActionRow = MatExpansionPanelActionRow;
939 exports.MatExpansionPanelContent = MatExpansionPanelContent;
940 exports.MatExpansionPanelDescription = MatExpansionPanelDescription;
941 exports.MatExpansionPanelHeader = MatExpansionPanelHeader;
942 exports.MatExpansionPanelTitle = MatExpansionPanelTitle;
943 exports.matExpansionAnimations = matExpansionAnimations;
944 exports.ɵ0 = ɵ0;
945
946 Object.defineProperty(exports, '__esModule', { value: true });
947
948})));
949//# sourceMappingURL=material-expansion.umd.js.map
Note: See TracBrowser for help on using the repository browser.