/** * @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 */ import {ChangeDetectionStrategy, Component, Input, ViewEncapsulation} from '@angular/core'; import {CanDisable, CanDisableCtor, mixinDisabled} from '../common-behaviors/disabled'; // Boilerplate for applying mixins to MatOptgroup. /** @docs-private */ class MatOptgroupBase { } const _MatOptgroupMixinBase: CanDisableCtor & typeof MatOptgroupBase = mixinDisabled(MatOptgroupBase); // Counter for unique group ids. let _uniqueOptgroupIdCounter = 0; /** * Component that is used to group instances of `mat-option`. */ @Component({ moduleId: module.id, selector: 'mat-optgroup', exportAs: 'matOptgroup', templateUrl: 'optgroup.html', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, inputs: ['disabled'], styleUrls: ['optgroup.css'], host: { 'class': 'mat-optgroup', 'role': 'group', '[class.mat-optgroup-disabled]': 'disabled', '[attr.aria-disabled]': 'disabled.toString()', '[attr.aria-labelledby]': '_labelId', } }) export class MatOptgroup extends _MatOptgroupMixinBase implements CanDisable { /** Label for the option group. */ @Input() label: string; /** Unique id for the underlying label. */ _labelId: string = `mat-optgroup-label-${_uniqueOptgroupIdCounter++}`; }