UNPKG

@angular/material

Version:
1 lines 7.89 kB
{"version":3,"file":"toolbar.mjs","sources":["../../../../../../src/material/toolbar/toolbar.ts","../../../../../../src/material/toolbar/toolbar.html","../../../../../../src/material/toolbar/toolbar-module.ts","../../../../../../src/material/toolbar/toolbar_public_index.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 {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 Input,\n QueryList,\n ViewEncapsulation,\n} from '@angular/core';\n\n@Directive({\n selector: 'mat-toolbar-row',\n exportAs: 'matToolbarRow',\n host: {'class': 'mat-toolbar-row'},\n standalone: true,\n})\nexport class MatToolbarRow {}\n\n@Component({\n selector: 'mat-toolbar',\n exportAs: 'matToolbar',\n templateUrl: 'toolbar.html',\n styleUrl: 'toolbar.css',\n host: {\n 'class': 'mat-toolbar',\n '[class]': 'color ? \"mat-\" + color : \"\"',\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 standalone: true,\n})\nexport class MatToolbar implements AfterViewInit {\n // TODO: should be typed as `ThemePalette` but internal apps pass in arbitrary strings.\n /**\n * Theme color of the toolbar. This API is supported in M2 themes only, it has\n * no effect in M3 themes.\n *\n * For information on applying color variants in M3, see\n * https://material.angular.io/guide/theming#using-component-color-variants.\n */\n @Input() color?: string | null;\n\n private _document: Document;\n\n /** Reference to all toolbar row elements that have been projected. */\n @ContentChildren(MatToolbarRow, {descendants: true}) _toolbarRows: QueryList<MatToolbarRow>;\n\n constructor(\n protected _elementRef: ElementRef,\n private _platform: Platform,\n @Inject(DOCUMENT) document?: any,\n ) {\n // TODO: make the document a required param when doing breaking changes.\n this._document = document;\n }\n\n ngAfterViewInit() {\n if (this._platform.isBrowser) {\n this._checkToolbarMixedModes();\n this._toolbarRows.changes.subscribe(() => this._checkToolbarMixedModes());\n }\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 && (typeof ngDevMode === 'undefined' || ngDevMode)) {\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/**\n * Throws an exception when attempting to combine the different toolbar row modes.\n * @docs-private\n */\nexport function throwToolbarMixedModesError() {\n throw Error(\n '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}\n","<ng-content></ng-content>\n<ng-content select=\"mat-toolbar-row\"></ng-content>\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 {NgModule} from '@angular/core';\nimport {MatCommonModule} from '@angular/material/core';\nimport {MatToolbar, MatToolbarRow} from './toolbar';\n\n@NgModule({\n imports: [MatCommonModule, MatToolbar, MatToolbarRow],\n exports: [MatToolbar, MatToolbarRow, MatCommonModule],\n})\nexport class MatToolbarModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MA6Ba,aAAa,CAAA;qHAAb,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA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