blob: b4cca665ba67ccf16b7564b2573c7790ce73654a [file] [log] [blame]
{"version":3,"file":"toolbar.es5.js","sources":["../../../src/material/toolbar/toolbar-module.ts","../../../src/material/toolbar/toolbar.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {NgModule} from '@angular/core';\nimport {MatCommonModule} from '@angular/material/core';\nimport {MatToolbar, MatToolbarRow} from './toolbar';\n\n\n@NgModule({\n imports: [MatCommonModule],\n exports: [MatToolbar, MatToolbarRow, MatCommonModule],\n declarations: [MatToolbar, MatToolbarRow],\n})\nexport class MatToolbarModule {}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Platform} from '@angular/cdk/platform';\nimport {DOCUMENT} from '@angular/common';\nimport {\n AfterViewInit,\n ChangeDetectionStrategy,\n Component,\n ContentChildren,\n Directive,\n ElementRef,\n Inject,\n isDevMode,\n QueryList,\n ViewEncapsulation,\n} from '@angular/core';\nimport {CanColor, CanColorCtor, mixinColor} from '@angular/material/core';\n\n\n// Boilerplate for applying mixins to MatToolbar.\n/** @docs-private */\nclass MatToolbarBase {\n constructor(public _elementRef: ElementRef) {}\n}\nconst _MatToolbarMixinBase: CanColorCtor & typeof MatToolbarBase = mixinColor(MatToolbarBase);\n\n@Directive({\n selector: 'mat-toolbar-row',\n exportAs: 'matToolbarRow',\n host: {'class': 'mat-toolbar-row'},\n})\nexport class MatToolbarRow {}\n\n@Component({\n moduleId: module.id,\n selector: 'mat-toolbar',\n exportAs: 'matToolbar',\n templateUrl: 'toolbar.html',\n styleUrls: ['toolbar.css'],\n inputs: ['color'],\n host: {\n 'class': 'mat-toolbar',\n '[class.mat-toolbar-multiple-rows]': '_toolbarRows.length > 0',\n '[class.mat-toolbar-single-row]': '_toolbarRows.length === 0',\n },\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class MatToolbar extends _MatToolbarMixinBase implements CanColor, AfterViewInit {\n private _document: Document;\n\n /** Reference to all toolbar row elements that have been projected. */\n @ContentChildren(MatToolbarRow) _toolbarRows: QueryList<MatToolbarRow>;\n\n constructor(\n elementRef: ElementRef,\n private _platform: Platform,\n @Inject(DOCUMENT) document?: any) {\n super(elementRef);\n\n // TODO: make the document a required param when doing breaking changes.\n this._document = document;\n }\n\n ngAfterViewInit() {\n if (!isDevMode() || !this._platform.isBrowser) {\n return;\n }\n\n this._checkToolbarMixedModes();\n this._toolbarRows.changes.subscribe(() => this._checkToolbarMixedModes());\n }\n\n /**\n * Throws an exception when developers are attempting to combine the different toolbar row modes.\n */\n private _checkToolbarMixedModes() {\n if (!this._toolbarRows.length) {\n return;\n }\n\n // Check if there are any other DOM nodes that can display content but aren't inside of\n // a <mat-toolbar-row> element.\n const isCombinedUsage = Array.from<HTMLElement>(this._elementRef.nativeElement.childNodes)\n .filter(node => !(node.classList && node.classList.contains('mat-toolbar-row')))\n .filter(node => node.nodeType !== (this._document ? this._document.COMMENT_NODE : 8))\n .some(node => !!(node.textContent && node.textContent.trim()));\n\n if (isCombinedUsage) {\n throwToolbarMixedModesError();\n }\n }\n}\n\n/**\n * Throws an exception when attempting to combine the different toolbar row modes.\n * @docs-private\n */\nexport function throwToolbarMixedModesError() {\n throw Error('MatToolbar: Attempting to combine different toolbar modes. ' +\n 'Either specify multiple `<mat-toolbar-row>` elements explicitly or just place content ' +\n 'inside of a `<mat-toolbar>` for a single row.');\n}\n"],"names":["tslib_1.__extends"],"mappings":";;;;;;;;;;;;;;;;;;;;;AC2BA;;;;;;IACE,SAAF,cAAA,CAAqB,WAAuB,EAA5C;QAAqB,IAArB,CAAA,WAAgC,GAAX,WAAW,CAAY;KAAI;IAChD,OAAA,cAAC,CAAD;CAAC,EAAD,CAAA,CAAC;;AACD,IAAM,oBAAoB,GAAyC,UAAU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