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 { coerceNumberProperty } from '@angular/cdk/coercion';
|
---|
9 | import { DOCUMENT } from '@angular/common';
|
---|
10 | import { ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Inject, inject, InjectionToken, Input, NgZone, Optional, Output, ViewChild, ViewEncapsulation, } from '@angular/core';
|
---|
11 | import { mixinColor } from '@angular/material/core';
|
---|
12 | import { ANIMATION_MODULE_TYPE } from '@angular/platform-browser/animations';
|
---|
13 | import { fromEvent, Subscription } from 'rxjs';
|
---|
14 | import { filter } from 'rxjs/operators';
|
---|
15 | // Boilerplate for applying mixins to MatProgressBar.
|
---|
16 | /** @docs-private */
|
---|
17 | const _MatProgressBarBase = mixinColor(class {
|
---|
18 | constructor(_elementRef) {
|
---|
19 | this._elementRef = _elementRef;
|
---|
20 | }
|
---|
21 | }, 'primary');
|
---|
22 | /**
|
---|
23 | * Injection token used to provide the current location to `MatProgressBar`.
|
---|
24 | * Used to handle server-side rendering and to stub out during unit tests.
|
---|
25 | * @docs-private
|
---|
26 | */
|
---|
27 | export const MAT_PROGRESS_BAR_LOCATION = new InjectionToken('mat-progress-bar-location', { providedIn: 'root', factory: MAT_PROGRESS_BAR_LOCATION_FACTORY });
|
---|
28 | /** @docs-private */
|
---|
29 | export function MAT_PROGRESS_BAR_LOCATION_FACTORY() {
|
---|
30 | const _document = inject(DOCUMENT);
|
---|
31 | const _location = _document ? _document.location : null;
|
---|
32 | return {
|
---|
33 | // Note that this needs to be a function, rather than a property, because Angular
|
---|
34 | // will only resolve it once, but we want the current path on each call.
|
---|
35 | getPathname: () => _location ? (_location.pathname + _location.search) : ''
|
---|
36 | };
|
---|
37 | }
|
---|
38 | /** Counter used to generate unique IDs for progress bars. */
|
---|
39 | let progressbarId = 0;
|
---|
40 | /**
|
---|
41 | * `<mat-progress-bar>` component.
|
---|
42 | */
|
---|
43 | export class MatProgressBar extends _MatProgressBarBase {
|
---|
44 | constructor(elementRef, _ngZone, _animationMode,
|
---|
45 | /**
|
---|
46 | * @deprecated `location` parameter to be made required.
|
---|
47 | * @breaking-change 8.0.0
|
---|
48 | */
|
---|
49 | location) {
|
---|
50 | super(elementRef);
|
---|
51 | this._ngZone = _ngZone;
|
---|
52 | this._animationMode = _animationMode;
|
---|
53 | /** Flag that indicates whether NoopAnimations mode is set to true. */
|
---|
54 | this._isNoopAnimation = false;
|
---|
55 | this._value = 0;
|
---|
56 | this._bufferValue = 0;
|
---|
57 | /**
|
---|
58 | * Event emitted when animation of the primary progress bar completes. This event will not
|
---|
59 | * be emitted when animations are disabled, nor will it be emitted for modes with continuous
|
---|
60 | * animations (indeterminate and query).
|
---|
61 | */
|
---|
62 | this.animationEnd = new EventEmitter();
|
---|
63 | /** Reference to animation end subscription to be unsubscribed on destroy. */
|
---|
64 | this._animationEndSubscription = Subscription.EMPTY;
|
---|
65 | /**
|
---|
66 | * Mode of the progress bar.
|
---|
67 | *
|
---|
68 | * Input must be one of these values: determinate, indeterminate, buffer, query, defaults to
|
---|
69 | * 'determinate'.
|
---|
70 | * Mirrored to mode attribute.
|
---|
71 | */
|
---|
72 | this.mode = 'determinate';
|
---|
73 | /** ID of the progress bar. */
|
---|
74 | this.progressbarId = `mat-progress-bar-${progressbarId++}`;
|
---|
75 | // We need to prefix the SVG reference with the current path, otherwise they won't work
|
---|
76 | // in Safari if the page has a `<base>` tag. Note that we need quotes inside the `url()`,
|
---|
77 | // because named route URLs can contain parentheses (see #12338). Also we don't use since
|
---|
78 | // we can't tell the difference between whether
|
---|
79 | // the consumer is using the hash location strategy or not, because `Location` normalizes
|
---|
80 | // both `/#/foo/bar` and `/foo/bar` to the same thing.
|
---|
81 | const path = location ? location.getPathname().split('#')[0] : '';
|
---|
82 | this._rectangleFillValue = `url('${path}#${this.progressbarId}')`;
|
---|
83 | this._isNoopAnimation = _animationMode === 'NoopAnimations';
|
---|
84 | }
|
---|
85 | /** Value of the progress bar. Defaults to zero. Mirrored to aria-valuenow. */
|
---|
86 | get value() { return this._value; }
|
---|
87 | set value(v) {
|
---|
88 | this._value = clamp(coerceNumberProperty(v) || 0);
|
---|
89 | }
|
---|
90 | /** Buffer value of the progress bar. Defaults to zero. */
|
---|
91 | get bufferValue() { return this._bufferValue; }
|
---|
92 | set bufferValue(v) { this._bufferValue = clamp(v || 0); }
|
---|
93 | /** Gets the current transform value for the progress bar's primary indicator. */
|
---|
94 | _primaryTransform() {
|
---|
95 | // We use a 3d transform to work around some rendering issues in iOS Safari. See #19328.
|
---|
96 | const scale = this.value / 100;
|
---|
97 | return { transform: `scale3d(${scale}, 1, 1)` };
|
---|
98 | }
|
---|
99 | /**
|
---|
100 | * Gets the current transform value for the progress bar's buffer indicator. Only used if the
|
---|
101 | * progress mode is set to buffer, otherwise returns an undefined, causing no transformation.
|
---|
102 | */
|
---|
103 | _bufferTransform() {
|
---|
104 | if (this.mode === 'buffer') {
|
---|
105 | // We use a 3d transform to work around some rendering issues in iOS Safari. See #19328.
|
---|
106 | const scale = this.bufferValue / 100;
|
---|
107 | return { transform: `scale3d(${scale}, 1, 1)` };
|
---|
108 | }
|
---|
109 | return null;
|
---|
110 | }
|
---|
111 | ngAfterViewInit() {
|
---|
112 | // Run outside angular so change detection didn't get triggered on every transition end
|
---|
113 | // instead only on the animation that we care about (primary value bar's transitionend)
|
---|
114 | this._ngZone.runOutsideAngular((() => {
|
---|
115 | const element = this._primaryValueBar.nativeElement;
|
---|
116 | this._animationEndSubscription =
|
---|
117 | fromEvent(element, 'transitionend')
|
---|
118 | .pipe(filter(((e) => e.target === element)))
|
---|
119 | .subscribe(() => {
|
---|
120 | if (this.mode === 'determinate' || this.mode === 'buffer') {
|
---|
121 | this._ngZone.run(() => this.animationEnd.next({ value: this.value }));
|
---|
122 | }
|
---|
123 | });
|
---|
124 | }));
|
---|
125 | }
|
---|
126 | ngOnDestroy() {
|
---|
127 | this._animationEndSubscription.unsubscribe();
|
---|
128 | }
|
---|
129 | }
|
---|
130 | MatProgressBar.decorators = [
|
---|
131 | { type: Component, args: [{
|
---|
132 | selector: 'mat-progress-bar',
|
---|
133 | exportAs: 'matProgressBar',
|
---|
134 | host: {
|
---|
135 | 'role': 'progressbar',
|
---|
136 | 'aria-valuemin': '0',
|
---|
137 | 'aria-valuemax': '100',
|
---|
138 | // set tab index to -1 so screen readers will read the aria-label
|
---|
139 | // Note: there is a known issue with JAWS that does not read progressbar aria labels on FireFox
|
---|
140 | 'tabindex': '-1',
|
---|
141 | '[attr.aria-valuenow]': '(mode === "indeterminate" || mode === "query") ? null : value',
|
---|
142 | '[attr.mode]': 'mode',
|
---|
143 | 'class': 'mat-progress-bar',
|
---|
144 | '[class._mat-animation-noopable]': '_isNoopAnimation',
|
---|
145 | },
|
---|
146 | inputs: ['color'],
|
---|
147 | template: "<!--\n All children need to be hidden for screen readers in order to support ChromeVox.\n More context in the issue: https://github.com/angular/components/issues/22165.\n-->\n<div aria-hidden=\"true\">\n <svg width=\"100%\" height=\"4\" focusable=\"false\" class=\"mat-progress-bar-background mat-progress-bar-element\">\n <defs>\n <pattern [id]=\"progressbarId\" x=\"4\" y=\"0\" width=\"8\" height=\"4\" patternUnits=\"userSpaceOnUse\">\n <circle cx=\"2\" cy=\"2\" r=\"2\"/>\n </pattern>\n </defs>\n <rect [attr.fill]=\"_rectangleFillValue\" width=\"100%\" height=\"100%\"/>\n </svg>\n <!--\n The background div is named as such because it appears below the other divs and is not sized based\n on values.\n -->\n <div class=\"mat-progress-bar-buffer mat-progress-bar-element\" [ngStyle]=\"_bufferTransform()\"></div>\n <div class=\"mat-progress-bar-primary mat-progress-bar-fill mat-progress-bar-element\" [ngStyle]=\"_primaryTransform()\" #primaryValueBar></div>\n <div class=\"mat-progress-bar-secondary mat-progress-bar-fill mat-progress-bar-element\"></div>\n</div>\n",
|
---|
148 | changeDetection: ChangeDetectionStrategy.OnPush,
|
---|
149 | encapsulation: ViewEncapsulation.None,
|
---|
150 | styles: [".mat-progress-bar{display:block;height:4px;overflow:hidden;position:relative;transition:opacity 250ms linear;width:100%}._mat-animation-noopable.mat-progress-bar{transition:none;animation:none}.mat-progress-bar .mat-progress-bar-element,.mat-progress-bar .mat-progress-bar-fill::after{height:100%;position:absolute;width:100%}.mat-progress-bar .mat-progress-bar-background{width:calc(100% + 10px)}.cdk-high-contrast-active .mat-progress-bar .mat-progress-bar-background{display:none}.mat-progress-bar .mat-progress-bar-buffer{transform-origin:top left;transition:transform 250ms ease}.cdk-high-contrast-active .mat-progress-bar .mat-progress-bar-buffer{border-top:solid 5px;opacity:.5}.mat-progress-bar .mat-progress-bar-secondary{display:none}.mat-progress-bar .mat-progress-bar-fill{animation:none;transform-origin:top left;transition:transform 250ms ease}.cdk-high-contrast-active .mat-progress-bar .mat-progress-bar-fill{border-top:solid 4px}.mat-progress-bar .mat-progress-bar-fill::after{animation:none;content:\"\";display:inline-block;left:0}.mat-progress-bar[dir=rtl],[dir=rtl] .mat-progress-bar{transform:rotateY(180deg)}.mat-progress-bar[mode=query]{transform:rotateZ(180deg)}.mat-progress-bar[mode=query][dir=rtl],[dir=rtl] .mat-progress-bar[mode=query]{transform:rotateZ(180deg) rotateY(180deg)}.mat-progress-bar[mode=indeterminate] .mat-progress-bar-fill,.mat-progress-bar[mode=query] .mat-progress-bar-fill{transition:none}.mat-progress-bar[mode=indeterminate] .mat-progress-bar-primary,.mat-progress-bar[mode=query] .mat-progress-bar-primary{-webkit-backface-visibility:hidden;backface-visibility:hidden;animation:mat-progress-bar-primary-indeterminate-translate 2000ms infinite linear;left:-145.166611%}.mat-progress-bar[mode=indeterminate] .mat-progress-bar-primary.mat-progress-bar-fill::after,.mat-progress-bar[mode=query] .mat-progress-bar-primary.mat-progress-bar-fill::after{-webkit-backface-visibility:hidden;backface-visibility:hidden;animation:mat-progress-bar-primary-indeterminate-scale 2000ms infinite linear}.mat-progress-bar[mode=indeterminate] .mat-progress-bar-secondary,.mat-progress-bar[mode=query] .mat-progress-bar-secondary{-webkit-backface-visibility:hidden;backface-visibility:hidden;animation:mat-progress-bar-secondary-indeterminate-translate 2000ms infinite linear;left:-54.888891%;display:block}.mat-progress-bar[mode=indeterminate] .mat-progress-bar-secondary.mat-progress-bar-fill::after,.mat-progress-bar[mode=query] .mat-progress-bar-secondary.mat-progress-bar-fill::after{-webkit-backface-visibility:hidden;backface-visibility:hidden;animation:mat-progress-bar-secondary-indeterminate-scale 2000ms infinite linear}.mat-progress-bar[mode=buffer] .mat-progress-bar-background{-webkit-backface-visibility:hidden;backface-visibility:hidden;animation:mat-progress-bar-background-scroll 250ms infinite linear;display:block}.mat-progress-bar._mat-animation-noopable .mat-progress-bar-fill,.mat-progress-bar._mat-animation-noopable .mat-progress-bar-fill::after,.mat-progress-bar._mat-animation-noopable .mat-progress-bar-buffer,.mat-progress-bar._mat-animation-noopable .mat-progress-bar-primary,.mat-progress-bar._mat-animation-noopable .mat-progress-bar-primary.mat-progress-bar-fill::after,.mat-progress-bar._mat-animation-noopable .mat-progress-bar-secondary,.mat-progress-bar._mat-animation-noopable .mat-progress-bar-secondary.mat-progress-bar-fill::after,.mat-progress-bar._mat-animation-noopable .mat-progress-bar-background{animation:none;transition-duration:1ms}@keyframes mat-progress-bar-primary-indeterminate-translate{0%{transform:translateX(0)}20%{animation-timing-function:cubic-bezier(0.5, 0, 0.701732, 0.495819);transform:translateX(0)}59.15%{animation-timing-function:cubic-bezier(0.302435, 0.381352, 0.55, 0.956352);transform:translateX(83.67142%)}100%{transform:translateX(200.611057%)}}@keyframes mat-progress-bar-primary-indeterminate-scale{0%{transform:scaleX(0.08)}36.65%{animation-timing-function:cubic-bezier(0.334731, 0.12482, 0.785844, 1);transform:scaleX(0.08)}69.15%{animation-timing-function:cubic-bezier(0.06, 0.11, 0.6, 1);transform:scaleX(0.661479)}100%{transform:scaleX(0.08)}}@keyframes mat-progress-bar-secondary-indeterminate-translate{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:translateX(0)}25%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:translateX(37.651913%)}48.35%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:translateX(84.386165%)}100%{transform:translateX(160.277782%)}}@keyframes mat-progress-bar-secondary-indeterminate-scale{0%{animation-timing-function:cubic-bezier(0.15, 0, 0.515058, 0.409685);transform:scaleX(0.08)}19.15%{animation-timing-function:cubic-bezier(0.31033, 0.284058, 0.8, 0.733712);transform:scaleX(0.457104)}44.15%{animation-timing-function:cubic-bezier(0.4, 0.627035, 0.6, 0.902026);transform:scaleX(0.72796)}100%{transform:scaleX(0.08)}}@keyframes mat-progress-bar-background-scroll{to{transform:translateX(-8px)}}\n"]
|
---|
151 | },] }
|
---|
152 | ];
|
---|
153 | MatProgressBar.ctorParameters = () => [
|
---|
154 | { type: ElementRef },
|
---|
155 | { type: NgZone },
|
---|
156 | { type: String, decorators: [{ type: Optional }, { type: Inject, args: [ANIMATION_MODULE_TYPE,] }] },
|
---|
157 | { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [MAT_PROGRESS_BAR_LOCATION,] }] }
|
---|
158 | ];
|
---|
159 | MatProgressBar.propDecorators = {
|
---|
160 | value: [{ type: Input }],
|
---|
161 | bufferValue: [{ type: Input }],
|
---|
162 | _primaryValueBar: [{ type: ViewChild, args: ['primaryValueBar',] }],
|
---|
163 | animationEnd: [{ type: Output }],
|
---|
164 | mode: [{ type: Input }]
|
---|
165 | };
|
---|
166 | /** Clamps a value to be between two numbers, by default 0 and 100. */
|
---|
167 | function clamp(v, min = 0, max = 100) {
|
---|
168 | return Math.max(min, Math.min(max, v));
|
---|
169 | }
|
---|
170 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvZ3Jlc3MtYmFyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXM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