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 | */
|
---|
8 | import { FocusMonitor } from '@angular/cdk/a11y';
|
---|
9 | import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Input, ViewEncapsulation, } from '@angular/core';
|
---|
10 | import { MatStepLabel } from './step-label';
|
---|
11 | import { MatStepperIntl } from './stepper-intl';
|
---|
12 | import { CdkStepHeader } from '@angular/cdk/stepper';
|
---|
13 | import { mixinColor } from '@angular/material/core';
|
---|
14 | // Boilerplate for applying mixins to MatStepHeader.
|
---|
15 | /** @docs-private */
|
---|
16 | const _MatStepHeaderBase = mixinColor(class MatStepHeaderBase extends CdkStepHeader {
|
---|
17 | constructor(elementRef) {
|
---|
18 | super(elementRef);
|
---|
19 | }
|
---|
20 | }, 'primary');
|
---|
21 | export class MatStepHeader extends _MatStepHeaderBase {
|
---|
22 | constructor(_intl, _focusMonitor, _elementRef, changeDetectorRef) {
|
---|
23 | super(_elementRef);
|
---|
24 | this._intl = _intl;
|
---|
25 | this._focusMonitor = _focusMonitor;
|
---|
26 | this._intlSubscription = _intl.changes.subscribe(() => changeDetectorRef.markForCheck());
|
---|
27 | }
|
---|
28 | ngAfterViewInit() {
|
---|
29 | this._focusMonitor.monitor(this._elementRef, true);
|
---|
30 | }
|
---|
31 | ngOnDestroy() {
|
---|
32 | this._intlSubscription.unsubscribe();
|
---|
33 | this._focusMonitor.stopMonitoring(this._elementRef);
|
---|
34 | }
|
---|
35 | /** Focuses the step header. */
|
---|
36 | focus(origin, options) {
|
---|
37 | if (origin) {
|
---|
38 | this._focusMonitor.focusVia(this._elementRef, origin, options);
|
---|
39 | }
|
---|
40 | else {
|
---|
41 | this._elementRef.nativeElement.focus(options);
|
---|
42 | }
|
---|
43 | }
|
---|
44 | /** Returns string label of given step if it is a text label. */
|
---|
45 | _stringLabel() {
|
---|
46 | return this.label instanceof MatStepLabel ? null : this.label;
|
---|
47 | }
|
---|
48 | /** Returns MatStepLabel if the label of given step is a template label. */
|
---|
49 | _templateLabel() {
|
---|
50 | return this.label instanceof MatStepLabel ? this.label : null;
|
---|
51 | }
|
---|
52 | /** Returns the host HTML element. */
|
---|
53 | _getHostElement() {
|
---|
54 | return this._elementRef.nativeElement;
|
---|
55 | }
|
---|
56 | /** Template context variables that are exposed to the `matStepperIcon` instances. */
|
---|
57 | _getIconContext() {
|
---|
58 | return {
|
---|
59 | index: this.index,
|
---|
60 | active: this.active,
|
---|
61 | optional: this.optional
|
---|
62 | };
|
---|
63 | }
|
---|
64 | _getDefaultTextForState(state) {
|
---|
65 | if (state == 'number') {
|
---|
66 | return `${this.index + 1}`;
|
---|
67 | }
|
---|
68 | if (state == 'edit') {
|
---|
69 | return 'create';
|
---|
70 | }
|
---|
71 | if (state == 'error') {
|
---|
72 | return 'warning';
|
---|
73 | }
|
---|
74 | return state;
|
---|
75 | }
|
---|
76 | }
|
---|
77 | MatStepHeader.decorators = [
|
---|
78 | { type: Component, args: [{
|
---|
79 | selector: 'mat-step-header',
|
---|
80 | template: "<div class=\"mat-step-header-ripple mat-focus-indicator\" matRipple\n [matRippleTrigger]=\"_getHostElement()\"\n [matRippleDisabled]=\"disableRipple\"></div>\n\n<div class=\"mat-step-icon-state-{{state}} mat-step-icon\" [class.mat-step-icon-selected]=\"selected\">\n <div class=\"mat-step-icon-content\" [ngSwitch]=\"!!(iconOverrides && iconOverrides[state])\">\n <ng-container\n *ngSwitchCase=\"true\"\n [ngTemplateOutlet]=\"iconOverrides[state]\"\n [ngTemplateOutletContext]=\"_getIconContext()\"></ng-container>\n <ng-container *ngSwitchDefault [ngSwitch]=\"state\">\n <span *ngSwitchCase=\"'number'\">{{_getDefaultTextForState(state)}}</span>\n <span class=\"cdk-visually-hidden\" *ngIf=\"state === 'done'\">{{_intl.completedLabel}}</span>\n <span class=\"cdk-visually-hidden\" *ngIf=\"state === 'edit'\">{{_intl.editableLabel}}</span>\n <mat-icon *ngSwitchDefault>{{_getDefaultTextForState(state)}}</mat-icon>\n </ng-container>\n </div>\n</div>\n<div class=\"mat-step-label\"\n [class.mat-step-label-active]=\"active\"\n [class.mat-step-label-selected]=\"selected\"\n [class.mat-step-label-error]=\"state == 'error'\">\n <!-- If there is a label template, use it. -->\n <div class=\"mat-step-text-label\" *ngIf=\"_templateLabel()\">\n <ng-container [ngTemplateOutlet]=\"_templateLabel()!.template\"></ng-container>\n </div>\n <!-- If there is no label template, fall back to the text label. -->\n <div class=\"mat-step-text-label\" *ngIf=\"_stringLabel()\">{{label}}</div>\n\n <div class=\"mat-step-optional\" *ngIf=\"optional && state != 'error'\">{{_intl.optionalLabel}}</div>\n <div class=\"mat-step-sub-label-error\" *ngIf=\"state == 'error'\">{{errorMessage}}</div>\n</div>\n\n",
|
---|
81 | inputs: ['color'],
|
---|
82 | host: {
|
---|
83 | 'class': 'mat-step-header',
|
---|
84 | 'role': 'tab',
|
---|
85 | },
|
---|
86 | encapsulation: ViewEncapsulation.None,
|
---|
87 | changeDetection: ChangeDetectionStrategy.OnPush,
|
---|
88 | styles: [".mat-step-header{overflow:hidden;outline:none;cursor:pointer;position:relative;box-sizing:content-box;-webkit-tap-highlight-color:transparent}.cdk-high-contrast-active .mat-step-header{outline:solid 1px}.cdk-high-contrast-active .mat-step-header.cdk-keyboard-focused,.cdk-high-contrast-active .mat-step-header.cdk-program-focused{outline:solid 3px}.cdk-high-contrast-active .mat-step-header[aria-selected=true] .mat-step-label{text-decoration:underline}.mat-step-optional,.mat-step-sub-label-error{font-size:12px}.mat-step-icon{border-radius:50%;height:24px;width:24px;flex-shrink:0;position:relative}.mat-step-icon-content,.mat-step-icon .mat-icon{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.mat-step-icon .mat-icon{font-size:16px;height:16px;width:16px}.mat-step-icon-state-error .mat-icon{font-size:24px;height:24px;width:24px}.mat-step-label{display:inline-block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:50px;vertical-align:middle}.mat-step-text-label{text-overflow:ellipsis;overflow:hidden}.mat-step-header .mat-step-header-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}\n"]
|
---|
89 | },] }
|
---|
90 | ];
|
---|
91 | MatStepHeader.ctorParameters = () => [
|
---|
92 | { type: MatStepperIntl },
|
---|
93 | { type: FocusMonitor },
|
---|
94 | { type: ElementRef },
|
---|
95 | { type: ChangeDetectorRef }
|
---|
96 | ];
|
---|
97 | MatStepHeader.propDecorators = {
|
---|
98 | state: [{ type: Input }],
|
---|
99 | label: [{ type: Input }],
|
---|
100 | errorMessage: [{ type: Input }],
|
---|
101 | iconOverrides: [{ type: Input }],
|
---|
102 | index: [{ type: Input }],
|
---|
103 | selected: [{ type: Input }],
|
---|
104 | active: [{ type: Input }],
|
---|
105 | optional: [{ type: Input }],
|
---|
106 | disableRipple: [{ type: Input }]
|
---|
107 | };
|
---|
108 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RlcC1oZWFkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9zcmMvbWF0ZXJpYWwvc3RlcHBlci9zdGVwLWhlYWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7O0dBTUc7QUFFSCxPQUFPLEVBQUMsWUFBWSxFQUFjLE1BQU0sbUJBQW1CLENBQUM7QUFDNUQsT0FBTyxFQUNMLHVCQUF1QixFQUN2QixpQkFBaUIsRUFDakIsU0FBUyxFQUNULFVBQVUsRUFDVixLQUFLLEVBRUwsaUJBQWlCLEdBR2xCLE1BQU0sZUFBZSxDQUFDO0FBRXZCLE9BQU8sRUFBQyxZQUFZLEVBQUMsTUFBTSxjQUFjLENBQUM7QUFDMUMsT0FBTyxFQUFDLGNBQWMsRUFBQyxNQUFNLGdCQUFnQix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