import { Directive, Component, ChangeDetectionStrategy, ViewEncapsulation, ElementRef, Inject, ContentChildren, NgModule } from '@angular/core'; import { mixinColor, MatCommonModule } from '@angular/material/core'; import { Platform } from '@angular/cdk/platform'; import { DOCUMENT } from '@angular/common'; /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // Boilerplate for applying mixins to MatToolbar. /** @docs-private */ import * as ɵngcc0 from '@angular/core'; import * as ɵngcc1 from '@angular/cdk/platform'; const _c0 = ["*", [["mat-toolbar-row"]]]; const _c1 = ["*", "mat-toolbar-row"]; const _MatToolbarBase = mixinColor(class { constructor(_elementRef) { this._elementRef = _elementRef; } }); class MatToolbarRow { } MatToolbarRow.ɵfac = function MatToolbarRow_Factory(t) { return new (t || MatToolbarRow)(); }; MatToolbarRow.ɵdir = /*@__PURE__*/ ɵngcc0.ɵɵdefineDirective({ type: MatToolbarRow, selectors: [["mat-toolbar-row"]], hostAttrs: [1, "mat-toolbar-row"], exportAs: ["matToolbarRow"] }); (function () { (typeof ngDevMode === "undefined" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(MatToolbarRow, [{ type: Directive, args: [{ selector: 'mat-toolbar-row', exportAs: 'matToolbarRow', host: { 'class': 'mat-toolbar-row' } }] }], null, null); })(); class MatToolbar extends _MatToolbarBase { constructor(elementRef, _platform, document) { super(elementRef); this._platform = _platform; // TODO: make the document a required param when doing breaking changes. this._document = document; } ngAfterViewInit() { if (this._platform.isBrowser) { this._checkToolbarMixedModes(); this._toolbarRows.changes.subscribe(() => this._checkToolbarMixedModes()); } } /** * Throws an exception when developers are attempting to combine the different toolbar row modes. */ _checkToolbarMixedModes() { if (this._toolbarRows.length && (typeof ngDevMode === 'undefined' || ngDevMode)) { // Check if there are any other DOM nodes that can display content but aren't inside of // a element. const isCombinedUsage = Array.from(this._elementRef.nativeElement.childNodes) .filter(node => !(node.classList && node.classList.contains('mat-toolbar-row'))) .filter(node => node.nodeType !== (this._document ? this._document.COMMENT_NODE : 8)) .some(node => !!(node.textContent && node.textContent.trim())); if (isCombinedUsage) { throwToolbarMixedModesError(); } } } } MatToolbar.ɵfac = function MatToolbar_Factory(t) { return new (t || MatToolbar)(ɵngcc0.ɵɵdirectiveInject(ɵngcc0.ElementRef), ɵngcc0.ɵɵdirectiveInject(ɵngcc1.Platform), ɵngcc0.ɵɵdirectiveInject(DOCUMENT)); }; MatToolbar.ɵcmp = /*@__PURE__*/ ɵngcc0.ɵɵdefineComponent({ type: MatToolbar, selectors: [["mat-toolbar"]], contentQueries: function MatToolbar_ContentQueries(rf, ctx, dirIndex) { if (rf & 1) { ɵngcc0.ɵɵcontentQuery(dirIndex, MatToolbarRow, 5); } if (rf & 2) { let _t; ɵngcc0.ɵɵqueryRefresh(_t = ɵngcc0.ɵɵloadQuery()) && (ctx._toolbarRows = _t); } }, hostAttrs: [1, "mat-toolbar"], hostVars: 4, hostBindings: function MatToolbar_HostBindings(rf, ctx) { if (rf & 2) { ɵngcc0.ɵɵclassProp("mat-toolbar-multiple-rows", ctx._toolbarRows.length > 0)("mat-toolbar-single-row", ctx._toolbarRows.length === 0); } }, inputs: { color: "color" }, exportAs: ["matToolbar"], features: [ɵngcc0.ɵɵInheritDefinitionFeature], ngContentSelectors: _c1, decls: 2, vars: 0, template: function MatToolbar_Template(rf, ctx) { if (rf & 1) { ɵngcc0.ɵɵprojectionDef(_c0); ɵngcc0.ɵɵprojection(0); ɵngcc0.ɵɵprojection(1, 1); } }, 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"], encapsulation: 2, changeDetection: 0 }); MatToolbar.ctorParameters = () => [ { type: ElementRef }, { type: Platform }, { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] } ]; MatToolbar.propDecorators = { _toolbarRows: [{ type: ContentChildren, args: [MatToolbarRow, { descendants: true },] }] }; (function () { (typeof ngDevMode === "undefined" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(MatToolbar, [{ type: Component, args: [{ selector: 'mat-toolbar', exportAs: 'matToolbar', template: "\n\n", inputs: ['color'], host: { 'class': 'mat-toolbar', '[class.mat-toolbar-multiple-rows]': '_toolbarRows.length > 0', '[class.mat-toolbar-single-row]': '_toolbarRows.length === 0' }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, 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"] }] }], function () { return [{ type: ɵngcc0.ElementRef }, { type: ɵngcc1.Platform }, { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT] }] }]; }, { _toolbarRows: [{ type: ContentChildren, args: [MatToolbarRow, { descendants: true }] }] }); })(); /** * Throws an exception when attempting to combine the different toolbar row modes. * @docs-private */ function throwToolbarMixedModesError() { throw Error('MatToolbar: Attempting to combine different toolbar modes. ' + 'Either specify multiple `` elements explicitly or just place content ' + 'inside of a `` for a single row.'); } /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ class MatToolbarModule { } MatToolbarModule.ɵfac = function MatToolbarModule_Factory(t) { return new (t || MatToolbarModule)(); }; MatToolbarModule.ɵmod = /*@__PURE__*/ ɵngcc0.ɵɵdefineNgModule({ type: MatToolbarModule }); MatToolbarModule.ɵinj = /*@__PURE__*/ ɵngcc0.ɵɵdefineInjector({ imports: [[MatCommonModule], MatCommonModule] }); (function () { (typeof ngDevMode === "undefined" || ngDevMode) && ɵngcc0.ɵsetClassMetadata(MatToolbarModule, [{ type: NgModule, args: [{ imports: [MatCommonModule], exports: [MatToolbar, MatToolbarRow, MatCommonModule], declarations: [MatToolbar, MatToolbarRow] }] }], null, null); })(); (function () { (typeof ngJitMode === "undefined" || ngJitMode) && ɵngcc0.ɵɵsetNgModuleScope(MatToolbarModule, { declarations: function () { return [MatToolbar, MatToolbarRow]; }, imports: function () { return [MatCommonModule]; }, exports: function () { return [MatToolbar, MatToolbarRow, MatCommonModule]; } }); })(); /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Generated bundle index. Do not edit. */ export { MatToolbar, MatToolbarModule, MatToolbarRow, throwToolbarMixedModesError }; //# sourceMappingURL=toolbar.js.map