/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/dev-app/progress-bar/progress-bar-demo.ts
45 строк
1 KB
Kristiyan Kostadinov
build: remove explicit OnPush from dev app
18 май 2026, 10:44
18 май 2026, 10:44
40d7c5a
Код
Авторство
О чём код?
/** * @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.dev/license */ import {Component} from '@angular/core'; import {FormsModule} from '@angular/forms'; import {MatButtonModule} from '@angular/material/button'; import {MatButtonToggleModule} from '@angular/material/button-toggle'; import {ThemePalette} from '@angular/material/core'; import {MatProgressBarModule} from '@angular/material/progress-bar'; @Component({ selector: 'progress-bar-demo', templateUrl: 'progress-bar-demo.html', styleUrl: 'progress-bar-demo.css', imports: [FormsModule, MatProgressBarModule, MatButtonModule, MatButtonToggleModule], }) export class ProgressBarDemo { color: ThemePalette = 'primary'; determinateProgressValue: number = 30; determinateAnimationEndValue!: number; bufferAnimationEndValue!: number; bufferProgressValue: number = 30; bufferBufferValue: number = 40; stepDeterminateProgressVal(val: number) { this.determinateProgressValue = this._clampValue(val + this.determinateProgressValue); } stepBufferProgressVal(val: number) { this.bufferProgressValue = this._clampValue(val + this.bufferProgressValue); } stepBufferBufferVal(val: number) { this.bufferBufferValue = this._clampValue(val + this.bufferBufferValue); } private _clampValue(value: number) { return Math.max(0, Math.min(100, value)); } }