import { TemplatePortal, PortalModule } from '@angular/cdk/portal'; import { CdkStepLabel, CdkStepHeader, CdkStep, STEPPER_GLOBAL_OPTIONS, CdkStepper, CdkStepperNext, CdkStepperPrevious, CdkStepperModule } from '@angular/cdk/stepper'; import { DOCUMENT, CommonModule } from '@angular/common'; import * as i0 from '@angular/core'; import { Directive, Injectable, Optional, SkipSelf, Component, ViewEncapsulation, ChangeDetectionStrategy, ElementRef, ChangeDetectorRef, Input, TemplateRef, Inject, forwardRef, ViewContainerRef, ContentChild, QueryList, EventEmitter, ViewChildren, ContentChildren, Output, NgModule } from '@angular/core'; import { MatButtonModule } from '@angular/material/button'; import { mixinColor, ErrorStateMatcher, MatCommonModule, MatRippleModule } from '@angular/material/core'; import { MatIconModule } from '@angular/material/icon'; import { FocusMonitor } from '@angular/cdk/a11y'; import { Subject, Subscription } from 'rxjs'; import { Directionality } from '@angular/cdk/bidi'; import { switchMap, map, startWith, takeUntil, distinctUntilChanged } from 'rxjs/operators'; import { trigger, state, style, transition, animate } from '@angular/animations'; /** * @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 MatStepLabel extends CdkStepLabel { } MatStepLabel.decorators = [ { type: Directive, args: [{ selector: '[matStepLabel]', },] } ]; /** * @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 */ /** Stepper data that is required for internationalization. */ class MatStepperIntl { constructor() { /** * Stream that emits whenever the labels here are changed. Use this to notify * components if the labels have changed after initialization. */ this.changes = new Subject(); /** Label that is rendered below optional steps. */ this.optionalLabel = 'Optional'; /** Label that is used to indicate step as completed to screen readers. */ this.completedLabel = 'Completed'; /** Label that is used to indicate step as editable to screen readers. */ this.editableLabel = 'Editable'; } } MatStepperIntl.ɵprov = i0.ɵɵdefineInjectable({ factory: function MatStepperIntl_Factory() { return new MatStepperIntl(); }, token: MatStepperIntl, providedIn: "root" }); MatStepperIntl.decorators = [ { type: Injectable, args: [{ providedIn: 'root' },] } ]; /** @docs-private */ function MAT_STEPPER_INTL_PROVIDER_FACTORY(parentIntl) { return parentIntl || new MatStepperIntl(); } /** @docs-private */ const MAT_STEPPER_INTL_PROVIDER = { provide: MatStepperIntl, deps: [[new Optional(), new SkipSelf(), MatStepperIntl]], useFactory: MAT_STEPPER_INTL_PROVIDER_FACTORY }; /** * @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 MatStepHeader. /** @docs-private */ const _MatStepHeaderBase = mixinColor(class MatStepHeaderBase extends CdkStepHeader { constructor(elementRef) { super(elementRef); } }, 'primary'); class MatStepHeader extends _MatStepHeaderBase { constructor(_intl, _focusMonitor, _elementRef, changeDetectorRef) { super(_elementRef); this._intl = _intl; this._focusMonitor = _focusMonitor; this._intlSubscription = _intl.changes.subscribe(() => changeDetectorRef.markForCheck()); } ngAfterViewInit() { this._focusMonitor.monitor(this._elementRef, true); } ngOnDestroy() { this._intlSubscription.unsubscribe(); this._focusMonitor.stopMonitoring(this._elementRef); } /** Focuses the step header. */ focus(origin, options) { if (origin) { this._focusMonitor.focusVia(this._elementRef, origin, options); } else { this._elementRef.nativeElement.focus(options); } } /** Returns string label of given step if it is a text label. */ _stringLabel() { return this.label instanceof MatStepLabel ? null : this.label; } /** Returns MatStepLabel if the label of given step is a template label. */ _templateLabel() { return this.label instanceof MatStepLabel ? this.label : null; } /** Returns the host HTML element. */ _getHostElement() { return this._elementRef.nativeElement; } /** Template context variables that are exposed to the `matStepperIcon` instances. */ _getIconContext() { return { index: this.index, active: this.active, optional: this.optional }; } _getDefaultTextForState(state) { if (state == 'number') { return `${this.index + 1}`; } if (state == 'edit') { return 'create'; } if (state == 'error') { return 'warning'; } return state; } } MatStepHeader.decorators = [ { type: Component, args: [{ selector: 'mat-step-header', template: "
\n\n
\n
\n \n \n {{_getDefaultTextForState(state)}}\n {{_intl.completedLabel}}\n {{_intl.editableLabel}}\n {{_getDefaultTextForState(state)}}\n \n
\n
\n
\n \n
\n \n
\n \n
{{label}}
\n\n
{{_intl.optionalLabel}}
\n
{{errorMessage}}
\n
\n\n", inputs: ['color'], host: { 'class': 'mat-step-header', 'role': 'tab', }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, 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"] },] } ]; MatStepHeader.ctorParameters = () => [ { type: MatStepperIntl }, { type: FocusMonitor }, { type: ElementRef }, { type: ChangeDetectorRef } ]; MatStepHeader.propDecorators = { state: [{ type: Input }], label: [{ type: Input }], errorMessage: [{ type: Input }], iconOverrides: [{ type: Input }], index: [{ type: Input }], selected: [{ type: Input }], active: [{ type: Input }], optional: [{ type: Input }], disableRipple: [{ type: Input }] }; /** * @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 */ /** * Animations used by the Material steppers. * @docs-private */ const matStepperAnimations = { /** Animation that transitions the step along the X axis in a horizontal stepper. */ horizontalStepTransition: trigger('horizontalStepTransition', [ state('previous', style({ transform: 'translate3d(-100%, 0, 0)', visibility: 'hidden' })), // Transition to `inherit`, rather than `visible`, // because visibility on a child element the one from the parent, // making this element focusable inside of a `hidden` element. state('current', style({ transform: 'none', visibility: 'inherit' })), state('next', style({ transform: 'translate3d(100%, 0, 0)', visibility: 'hidden' })), transition('* => *', animate('500ms cubic-bezier(0.35, 0, 0.25, 1)')) ]), /** Animation that transitions the step along the Y axis in a vertical stepper. */ verticalStepTransition: trigger('verticalStepTransition', [ state('previous', style({ height: '0px', visibility: 'hidden' })), state('next', style({ height: '0px', visibility: 'hidden' })), // Transition to `inherit`, rather than `visible`, // because visibility on a child element the one from the parent, // making this element focusable inside of a `hidden` element. state('current', style({ height: '*', visibility: 'inherit' })), transition('* <=> current', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')) ]) }; /** * @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 */ /** * Template to be used to override the icons inside the step header. */ class MatStepperIcon { constructor(templateRef) { this.templateRef = templateRef; } } MatStepperIcon.decorators = [ { type: Directive, args: [{ selector: 'ng-template[matStepperIcon]', },] } ]; MatStepperIcon.ctorParameters = () => [ { type: TemplateRef } ]; MatStepperIcon.propDecorators = { name: [{ type: Input, args: ['matStepperIcon',] }] }; /** * @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 */ /** * Content for a `mat-step` that will be rendered lazily. */ class MatStepContent { constructor(_template) { this._template = _template; } } MatStepContent.decorators = [ { type: Directive, args: [{ selector: 'ng-template[matStepContent]' },] } ]; MatStepContent.ctorParameters = () => [ { type: TemplateRef } ]; /** * @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 MatStep extends CdkStep { constructor(stepper, _errorStateMatcher, _viewContainerRef, stepperOptions) { super(stepper, stepperOptions); this._errorStateMatcher = _errorStateMatcher; this._viewContainerRef = _viewContainerRef; this._isSelected = Subscription.EMPTY; } ngAfterContentInit() { this._isSelected = this._stepper.steps.changes.pipe(switchMap(() => { return this._stepper.selectionChange.pipe(map(event => event.selectedStep === this), startWith(this._stepper.selected === this)); })).subscribe(isSelected => { if (isSelected && this._lazyContent && !this._portal) { this._portal = new TemplatePortal(this._lazyContent._template, this._viewContainerRef); } }); } ngOnDestroy() { this._isSelected.unsubscribe(); } /** Custom error state matcher that additionally checks for validity of interacted form. */ isErrorState(control, form) { const originalErrorState = this._errorStateMatcher.isErrorState(control, form); // Custom error state checks for the validity of form that is not submitted or touched // since user can trigger a form change by calling for another step without directly // interacting with the current form. const customErrorState = !!(control && control.invalid && this.interacted); return originalErrorState || customErrorState; } } MatStep.decorators = [ { type: Component, args: [{ selector: 'mat-step', template: "\n \n \n\n", providers: [ { provide: ErrorStateMatcher, useExisting: MatStep }, { provide: CdkStep, useExisting: MatStep }, ], encapsulation: ViewEncapsulation.None, exportAs: 'matStep', changeDetection: ChangeDetectionStrategy.OnPush },] } ]; MatStep.ctorParameters = () => [ { type: MatStepper, decorators: [{ type: Inject, args: [forwardRef(() => MatStepper),] }] }, { type: ErrorStateMatcher, decorators: [{ type: SkipSelf }] }, { type: ViewContainerRef }, { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [STEPPER_GLOBAL_OPTIONS,] }] } ]; MatStep.propDecorators = { stepLabel: [{ type: ContentChild, args: [MatStepLabel,] }], color: [{ type: Input }], _lazyContent: [{ type: ContentChild, args: [MatStepContent, { static: false },] }] }; /** * Proxies the public APIs from `MatStepper` to the deprecated `MatHorizontalStepper` and * `MatVerticalStepper`. * @deprecated Use `MatStepper` instead. * @breaking-change 13.0.0 * @docs-private */ class _MatProxyStepperBase extends CdkStepper { } _MatProxyStepperBase.decorators = [ { type: Directive } ]; /** * @deprecated Use `MatStepper` instead. * @breaking-change 13.0.0 */ class MatHorizontalStepper extends _MatProxyStepperBase { } MatHorizontalStepper.decorators = [ { type: Directive, args: [{ selector: 'mat-horizontal-stepper' },] } ]; /** * @deprecated Use `MatStepper` instead. * @breaking-change 13.0.0 */ class MatVerticalStepper extends _MatProxyStepperBase { } MatVerticalStepper.decorators = [ { type: Directive, args: [{ selector: 'mat-vertical-stepper' },] } ]; class MatStepper extends CdkStepper { constructor(dir, changeDetectorRef, elementRef, _document) { super(dir, changeDetectorRef, elementRef, _document); /** Steps that belong to the current stepper, excluding ones from nested steppers. */ this.steps = new QueryList(); /** Event emitted when the current step is done transitioning in. */ this.animationDone = new EventEmitter(); /** * Whether the label should display in bottom or end position. * Only applies in the `horizontal` orientation. */ this.labelPosition = 'end'; /** Consumer-specified template-refs to be used to override the header icons. */ this._iconOverrides = {}; /** Stream of animation `done` events when the body expands/collapses. */ this._animationDone = new Subject(); const nodeName = elementRef.nativeElement.nodeName.toLowerCase(); this.orientation = nodeName === 'mat-vertical-stepper' ? 'vertical' : 'horizontal'; } ngAfterContentInit() { super.ngAfterContentInit(); this._icons.forEach(({ name, templateRef }) => this._iconOverrides[name] = templateRef); // Mark the component for change detection whenever the content children query changes this.steps.changes.pipe(takeUntil(this._destroyed)).subscribe(() => { this._stateChanged(); }); this._animationDone.pipe( // This needs a `distinctUntilChanged` in order to avoid emitting the same event twice due // to a bug in animations where the `.done` callback gets invoked twice on some browsers. // See https://github.com/angular/angular/issues/24084 distinctUntilChanged((x, y) => x.fromState === y.fromState && x.toState === y.toState), takeUntil(this._destroyed)).subscribe(event => { if (event.toState === 'current') { this.animationDone.emit(); } }); } _stepIsNavigable(index, step) { return step.completed || this.selectedIndex === index || !this.linear; } } MatStepper.decorators = [ { type: Component, args: [{ selector: 'mat-stepper, mat-vertical-stepper, mat-horizontal-stepper, [matStepper]', exportAs: 'matStepper, matVerticalStepper, matHorizontalStepper', template: "\n \n \n
\n \n \n
\n \n
\n\n
\n
\n \n
\n
\n
\n\n \n \n
\n \n
\n
\n
\n \n
\n
\n
\n
\n
\n\n
\n\n\n\n \n\n", inputs: ['selectedIndex'], host: { '[class.mat-stepper-horizontal]': 'orientation === "horizontal"', '[class.mat-stepper-vertical]': 'orientation === "vertical"', '[class.mat-stepper-label-position-end]': 'orientation === "horizontal" && labelPosition == "end"', '[class.mat-stepper-label-position-bottom]': 'orientation === "horizontal" && labelPosition == "bottom"', '[attr.aria-orientation]': 'orientation', 'role': 'tablist', }, animations: [ matStepperAnimations.horizontalStepTransition, matStepperAnimations.verticalStepTransition, ], providers: [ { provide: CdkStepper, useExisting: MatStepper }, { provide: MatHorizontalStepper, useExisting: MatStepper }, { provide: MatVerticalStepper, useExisting: MatStepper }, ], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".mat-stepper-vertical,.mat-stepper-horizontal{display:block}.mat-horizontal-stepper-header-container{white-space:nowrap;display:flex;align-items:center}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header-container{align-items:flex-start}.mat-stepper-horizontal-line{border-top-width:1px;border-top-style:solid;flex:auto;height:0;margin:0 -16px;min-width:32px}.mat-stepper-label-position-bottom .mat-stepper-horizontal-line{margin:0;min-width:0;position:relative}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:first-child)::before,[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:last-child)::before,.mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:last-child)::after,[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:first-child)::after{border-top-width:1px;border-top-style:solid;content:\"\";display:inline-block;height:0;position:absolute;width:calc(50% - 20px)}.mat-horizontal-stepper-header{display:flex;height:72px;overflow:hidden;align-items:center;padding:0 24px}.mat-horizontal-stepper-header .mat-step-icon{margin-right:8px;flex:none}[dir=rtl] .mat-horizontal-stepper-header .mat-step-icon{margin-right:0;margin-left:8px}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header{box-sizing:border-box;flex-direction:column;height:auto}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:last-child)::after,[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:first-child)::after{right:0}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:first-child)::before,[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:not(:last-child)::before{left:0}[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:last-child::before,[dir=rtl] .mat-stepper-label-position-bottom .mat-horizontal-stepper-header:first-child::after{display:none}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header .mat-step-icon{margin-right:0;margin-left:0}.mat-stepper-label-position-bottom .mat-horizontal-stepper-header .mat-step-label{padding:16px 0 0 0;text-align:center;width:100%}.mat-vertical-stepper-header{display:flex;align-items:center;height:24px}.mat-vertical-stepper-header .mat-step-icon{margin-right:12px}[dir=rtl] .mat-vertical-stepper-header .mat-step-icon{margin-right:0;margin-left:12px}.mat-horizontal-stepper-content{outline:0}.mat-horizontal-stepper-content[aria-expanded=false]{height:0;overflow:hidden}.mat-horizontal-content-container{overflow:hidden;padding:0 24px 24px 24px}.cdk-high-contrast-active .mat-horizontal-content-container{outline:solid 1px}.mat-vertical-content-container{margin-left:36px;border:0;position:relative}.cdk-high-contrast-active .mat-vertical-content-container{outline:solid 1px}[dir=rtl] .mat-vertical-content-container{margin-left:0;margin-right:36px}.mat-stepper-vertical-line::before{content:\"\";position:absolute;left:0;border-left-width:1px;border-left-style:solid}[dir=rtl] .mat-stepper-vertical-line::before{left:auto;right:0}.mat-vertical-stepper-content{overflow:hidden;outline:0}.mat-vertical-content{padding:0 24px 24px 24px}.mat-step:last-child .mat-vertical-content-container{border:none}\n"] },] } ]; MatStepper.ctorParameters = () => [ { type: Directionality, decorators: [{ type: Optional }] }, { type: ChangeDetectorRef }, { type: ElementRef }, { type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] } ]; MatStepper.propDecorators = { _stepHeader: [{ type: ViewChildren, args: [MatStepHeader,] }], _steps: [{ type: ContentChildren, args: [MatStep, { descendants: true },] }], _icons: [{ type: ContentChildren, args: [MatStepperIcon, { descendants: true },] }], animationDone: [{ type: Output }], disableRipple: [{ type: Input }], color: [{ type: Input }], labelPosition: [{ type: Input }] }; /** * @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 */ /** Button that moves to the next step in a stepper workflow. */ class MatStepperNext extends CdkStepperNext { } MatStepperNext.decorators = [ { type: Directive, args: [{ selector: 'button[matStepperNext]', host: { 'class': 'mat-stepper-next', '[type]': 'type', }, inputs: ['type'] },] } ]; /** Button that moves to the previous step in a stepper workflow. */ class MatStepperPrevious extends CdkStepperPrevious { } MatStepperPrevious.decorators = [ { type: Directive, args: [{ selector: 'button[matStepperPrevious]', host: { 'class': 'mat-stepper-previous', '[type]': 'type', }, inputs: ['type'] },] } ]; /** * @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 MatStepperModule { } MatStepperModule.decorators = [ { type: NgModule, args: [{ imports: [ MatCommonModule, CommonModule, PortalModule, MatButtonModule, CdkStepperModule, MatIconModule, MatRippleModule, ], exports: [ MatCommonModule, MatStep, MatStepLabel, MatStepper, MatStepperNext, MatStepperPrevious, MatStepHeader, MatStepperIcon, MatStepContent, ], declarations: [ MatHorizontalStepper, MatVerticalStepper, MatStep, MatStepLabel, MatStepper, MatStepperNext, MatStepperPrevious, MatStepHeader, MatStepperIcon, MatStepContent, ], providers: [MAT_STEPPER_INTL_PROVIDER, ErrorStateMatcher], },] } ]; /** * @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 { MAT_STEPPER_INTL_PROVIDER, MAT_STEPPER_INTL_PROVIDER_FACTORY, MatHorizontalStepper, MatStep, MatStepContent, MatStepHeader, MatStepLabel, MatStepper, MatStepperIcon, MatStepperIntl, MatStepperModule, MatStepperNext, MatStepperPrevious, MatVerticalStepper, matStepperAnimations }; //# sourceMappingURL=stepper.js.map