source: trip-planner-front/node_modules/@angular/material/esm2015/toolbar/toolbar.js@ 59329aa

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

initial commit

  • Property mode set to 100644
File size: 11.1 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 { Platform } from '@angular/cdk/platform';
9import { DOCUMENT } from '@angular/common';
10import { ChangeDetectionStrategy, Component, ContentChildren, Directive, ElementRef, Inject, QueryList, ViewEncapsulation, } from '@angular/core';
11import { mixinColor } from '@angular/material/core';
12// Boilerplate for applying mixins to MatToolbar.
13/** @docs-private */
14const _MatToolbarBase = mixinColor(class {
15 constructor(_elementRef) {
16 this._elementRef = _elementRef;
17 }
18});
19export class MatToolbarRow {
20}
21MatToolbarRow.decorators = [
22 { type: Directive, args: [{
23 selector: 'mat-toolbar-row',
24 exportAs: 'matToolbarRow',
25 host: { 'class': 'mat-toolbar-row' },
26 },] }
27];
28export class MatToolbar extends _MatToolbarBase {
29 constructor(elementRef, _platform, document) {
30 super(elementRef);
31 this._platform = _platform;
32 // TODO: make the document a required param when doing breaking changes.
33 this._document = document;
34 }
35 ngAfterViewInit() {
36 if (this._platform.isBrowser) {
37 this._checkToolbarMixedModes();
38 this._toolbarRows.changes.subscribe(() => this._checkToolbarMixedModes());
39 }
40 }
41 /**
42 * Throws an exception when developers are attempting to combine the different toolbar row modes.
43 */
44 _checkToolbarMixedModes() {
45 if (this._toolbarRows.length && (typeof ngDevMode === 'undefined' || ngDevMode)) {
46 // Check if there are any other DOM nodes that can display content but aren't inside of
47 // a <mat-toolbar-row> element.
48 const isCombinedUsage = Array.from(this._elementRef.nativeElement.childNodes)
49 .filter(node => !(node.classList && node.classList.contains('mat-toolbar-row')))
50 .filter(node => node.nodeType !== (this._document ? this._document.COMMENT_NODE : 8))
51 .some(node => !!(node.textContent && node.textContent.trim()));
52 if (isCombinedUsage) {
53 throwToolbarMixedModesError();
54 }
55 }
56 }
57}
58MatToolbar.decorators = [
59 { type: Component, args: [{
60 selector: 'mat-toolbar',
61 exportAs: 'matToolbar',
62 template: "<ng-content></ng-content>\n<ng-content select=\"mat-toolbar-row\"></ng-content>\n",
63 inputs: ['color'],
64 host: {
65 'class': 'mat-toolbar',
66 '[class.mat-toolbar-multiple-rows]': '_toolbarRows.length > 0',
67 '[class.mat-toolbar-single-row]': '_toolbarRows.length === 0',
68 },
69 changeDetection: ChangeDetectionStrategy.OnPush,
70 encapsulation: ViewEncapsulation.None,
71 styles: [".cdk-high-contrast-active .mat-toolbar{outline:solid 1px}.mat-toolbar-row,.mat-toolbar-single-row{display:flex;box-sizing:border-box;padding:0 16px;width:100%;flex-direction:row;align-items:center;white-space:nowrap}.mat-toolbar-multiple-rows{display:flex;box-sizing:border-box;flex-direction:column;width:100%}\n"]
72 },] }
73];
74MatToolbar.ctorParameters = () => [
75 { type: ElementRef },
76 { type: Platform },
77 { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
78];
79MatToolbar.propDecorators = {
80 _toolbarRows: [{ type: ContentChildren, args: [MatToolbarRow, { descendants: true },] }]
81};
82/**
83 * Throws an exception when attempting to combine the different toolbar row modes.
84 * @docs-private
85 */
86export function throwToolbarMixedModesError() {
87 throw Error('MatToolbar: Attempting to combine different toolbar modes. ' +
88 'Either specify multiple `<mat-toolbar-row>` elements explicitly or just place content ' +
89 'inside of a `<mat-toolbar>` for a single row.');
90}
91//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9vbGJhci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3NyYy9tYXRlcmlhbC90b29sYmFyL3Rvb2xiYXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsT0FBTyxFQUFDLFFBQVEsRUFBQyx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hIShub2RlLnRleHRDb250ZW50ICYmIG5vZGUudGV4dENvbnRlbnQudHJpbSgpKSk7XG5cbiAgICAgIGlmIChpc0NvbWJpbmVkVXNhZ2UpIHtcbiAgICAgICAgdGhyb3dUb29sYmFyTWl4ZWRNb2Rlc0Vycm9yKCk7XG4gICAgICB9XG4gICAgfVxuICB9XG59XG5cbi8qKlxuICogVGhyb3dzIGFuIGV4Y2VwdGlvbiB3aGVuIGF0dGVtcHRpbmcgdG8gY29tYmluZSB0aGUgZGlmZmVyZW50IHRvb2xiYXIgcm93IG1vZGVzLlxuICogQGRvY3MtcHJpdmF0ZVxuICovXG5leHBvcnQgZnVuY3Rpb24gdGhyb3dUb29sYmFyTWl4ZWRNb2Rlc0Vycm9yKCkge1xuICB0aHJvdyBFcnJvcignTWF0VG9vbGJhcjogQXR0ZW1wdGluZyB0byBjb21iaW5lIGRpZmZlcmVudCB0b29sYmFyIG1vZGVzLiAnICtcbiAgICAnRWl0aGVyIHNwZWNpZnkgbXVsdGlwbGUgYDxtYXQtdG9vbGJhci1yb3c+YCBlbGVtZW50cyBleHBsaWNpdGx5IG9yIGp1c3QgcGxhY2UgY29udGVudCAnICtcbiAgICAnaW5zaWRlIG9mIGEgYDxtYXQtdG9vbGJhcj5gIGZvciBhIHNpbmdsZSByb3cuJyk7XG59XG4iXX0=
Note: See TracBrowser for help on using the repository browser.