UNPKG

primeng

Version:

PrimeNG is an open source UI library for Angular featuring a rich set of 80+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with PrimeB

347 lines (335 loc) 13.4 kB
import * as i1 from '@angular/common'; import { CommonModule } from '@angular/common'; import * as i0 from '@angular/core'; import { Injectable, inject, booleanAttribute, numberAttribute, ContentChildren, ContentChild, Input, ViewEncapsulation, ChangeDetectionStrategy, Component, NgModule } from '@angular/core'; import { SharedModule, PrimeTemplate } from 'primeng/api'; import { BaseComponent } from 'primeng/basecomponent'; import { BaseStyle } from 'primeng/base'; const theme = ({ dt }) => ` .p-progressbar { position: relative; overflow: hidden; height: ${dt('progressbar.height')}; background: ${dt('progressbar.background')}; border-radius: ${dt('progressbar.border.radius')}; } .p-progressbar-value { margin: 0; background: ${dt('progressbar.value.background')}; } .p-progressbar-label { color: ${dt('progressbar.label.color')}; font-size: ${dt('progressbar.label.font.size')}; font-weight: ${dt('progressbar.label.font.weight')}; } .p-progressbar-determinate .p-progressbar-value { height: 100%; width: 0%; position: absolute; display: none; display: flex; align-items: center; justify-content: center; overflow: hidden; transition: width 1s ease-in-out; } .p-progressbar-determinate .p-progressbar-label { display: inline-flex; } .p-progressbar-indeterminate .p-progressbar-value::before { content: ""; position: absolute; background: inherit; top: 0; inset-inline-start: 0; bottom: 0; will-change: inset-inline-start, inset-inline-end; animation: p-progressbar-indeterminate-anim 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite; } .p-progressbar-indeterminate .p-progressbar-value::after { content: ""; position: absolute; background: inherit; top: 0; inset-inline-start: 0; bottom: 0; will-change: inset-inline-start, inset-inline-end; animation: p-progressbar-indeterminate-anim-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite; animation-delay: 1.15s; } @-webkit-keyframes p-progressbar-indeterminate-anim { 0% { inset-inline-start: -35%; inset-inline-end: 100%; } 60% { inset-inline-start: 100%; inset-inline-end: -90%; } 100% { inset-inline-start: 100%; inset-inline-end: -90%; } } @keyframes p-progressbar-indeterminate-anim { 0% { inset-inline-start: -35%; inset-inline-end: 100%; } 60% { inset-inline-start: 100%; inset-inline-end: -90%; } 100% { inset-inline-start: 100%; inset-inline-end: -90%; } } @-webkit-keyframes p-progressbar-indeterminate-anim-short { 0% { inset-inline-start: -200%; inset-inline-end: 100%; } 60% { inset-inline-start: 107%; inset-inline-end: -8%; } 100% { inset-inline-start: 107%; inset-inline-end: -8%; } } @keyframes p-progressbar-indeterminate-anim-short { 0% { inset-inline-start: -200%; inset-inline-end: 100%; } 60% { inset-inline-start: 107%; inset-inline-end: -8%; } 100% { inset-inline-start: 107%; inset-inline-end: -8%; } } `; const classes = { root: ({ instance }) => [ 'p-progressbar p-component', { 'p-progressbar-determinate': instance.determinate, 'p-progressbar-indeterminate': instance.indeterminate } ], value: 'p-progressbar-value', label: 'p-progressbar-label' }; class ProgressBarStyle extends BaseStyle { name = 'progressbar'; theme = theme; classes = classes; static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ProgressBarStyle, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ProgressBarStyle }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ProgressBarStyle, decorators: [{ type: Injectable }] }); /** * * ProgressBar is a process status indicator. * * [Live Demo](https://www.primeng.org/progressbar) * * @module progressbarstyle * */ var ProgressBarClasses; (function (ProgressBarClasses) { /** * Class name of the root element */ ProgressBarClasses["root"] = "p-progressbar"; /** * Class name of the value element */ ProgressBarClasses["value"] = "p-progressbar-value"; /** * Class name of the label element */ ProgressBarClasses["label"] = "p-progressbar-label"; })(ProgressBarClasses || (ProgressBarClasses = {})); /** * ProgressBar is a process status indicator. * @group Components */ class ProgressBar extends BaseComponent { /** * Current value of the progress. * @group Props */ value; /** * Whether to display the progress bar value. * @group Props */ showValue = true; /** * Style class of the element. * @group Props */ styleClass; /** * Style class of the value element. * @group Props */ valueStyleClass; /** * Inline style of the element. * @group Props */ style; /** * Unit sign appended to the value. * @group Props */ unit = '%'; /** * Defines the mode of the progress * @group Props */ mode = 'determinate'; /** * Color for the background of the progress. * @group Props */ color; /** * Template of the content. * @group templates */ contentTemplate; _componentStyle = inject(ProgressBarStyle); templates; _contentTemplate; ngAfterContentInit() { this.templates?.forEach((item) => { switch (item.getType()) { case 'content': this._contentTemplate = item.template; break; default: this._contentTemplate = item.template; } }); } static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ProgressBar, deps: null, target: i0.ɵɵFactoryTarget.Component }); static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.2.5", type: ProgressBar, isStandalone: true, selector: "p-progressBar, p-progressbar, p-progress-bar", inputs: { value: ["value", "value", numberAttribute], showValue: ["showValue", "showValue", booleanAttribute], styleClass: "styleClass", valueStyleClass: "valueStyleClass", style: "style", unit: "unit", mode: "mode", color: "color" }, providers: [ProgressBarStyle], queries: [{ propertyName: "contentTemplate", first: true, predicate: ["content"] }, { propertyName: "templates", predicate: PrimeTemplate }], usesInheritance: true, ngImport: i0, template: ` <div role="progressbar" [class]="styleClass" [ngStyle]="style" [attr.aria-valuemin]="0" [attr.aria-valuenow]="value" [attr.aria-valuemax]="100" [attr.data-pc-name]="'progressbar'" [attr.data-pc-section]="'root'" [ngClass]="{ 'p-progressbar p-component': true, 'p-progressbar-determinate': mode === 'determinate', 'p-progressbar-indeterminate': mode === 'indeterminate' }" [attr.aria-label]="value + unit" > <div *ngIf="mode === 'determinate'" [ngClass]="'p-progressbar-value p-progressbar-value-animate'" [class]="valueStyleClass" [style.width]="value + '%'" style="display:flex" [style.background]="color" [attr.data-pc-section]="'value'"> <div class="p-progressbar-label"> <div *ngIf="showValue && !contentTemplate && !_contentTemplate" [style.display]="value != null && value !== 0 ? 'flex' : 'none'" [attr.data-pc-section]="'label'">{{ value }}{{ unit }}</div> <ng-container *ngTemplateOutlet="contentTemplate || _contentTemplate; context: { $implicit: value }"></ng-container> </div> </div> <div *ngIf="mode === 'indeterminate'" [ngClass]="'p-progressbar-indeterminate-container'" [class]="valueStyleClass" [attr.data-pc-section]="'container'"> <div class="p-progressbar-value p-progressbar-value-animate" [style.background]="color" [attr.data-pc-section]="'value'"></div> </div> </div> `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: SharedModule }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ProgressBar, decorators: [{ type: Component, args: [{ selector: 'p-progressBar, p-progressbar, p-progress-bar', standalone: true, imports: [CommonModule, SharedModule], template: ` <div role="progressbar" [class]="styleClass" [ngStyle]="style" [attr.aria-valuemin]="0" [attr.aria-valuenow]="value" [attr.aria-valuemax]="100" [attr.data-pc-name]="'progressbar'" [attr.data-pc-section]="'root'" [ngClass]="{ 'p-progressbar p-component': true, 'p-progressbar-determinate': mode === 'determinate', 'p-progressbar-indeterminate': mode === 'indeterminate' }" [attr.aria-label]="value + unit" > <div *ngIf="mode === 'determinate'" [ngClass]="'p-progressbar-value p-progressbar-value-animate'" [class]="valueStyleClass" [style.width]="value + '%'" style="display:flex" [style.background]="color" [attr.data-pc-section]="'value'"> <div class="p-progressbar-label"> <div *ngIf="showValue && !contentTemplate && !_contentTemplate" [style.display]="value != null && value !== 0 ? 'flex' : 'none'" [attr.data-pc-section]="'label'">{{ value }}{{ unit }}</div> <ng-container *ngTemplateOutlet="contentTemplate || _contentTemplate; context: { $implicit: value }"></ng-container> </div> </div> <div *ngIf="mode === 'indeterminate'" [ngClass]="'p-progressbar-indeterminate-container'" [class]="valueStyleClass" [attr.data-pc-section]="'container'"> <div class="p-progressbar-value p-progressbar-value-animate" [style.background]="color" [attr.data-pc-section]="'value'"></div> </div> </div> `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [ProgressBarStyle] }] }], propDecorators: { value: [{ type: Input, args: [{ transform: numberAttribute }] }], showValue: [{ type: Input, args: [{ transform: booleanAttribute }] }], styleClass: [{ type: Input }], valueStyleClass: [{ type: Input }], style: [{ type: Input }], unit: [{ type: Input }], mode: [{ type: Input }], color: [{ type: Input }], contentTemplate: [{ type: ContentChild, args: ['content', { descendants: false }] }], templates: [{ type: ContentChildren, args: [PrimeTemplate] }] } }); class ProgressBarModule { static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ProgressBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.5", ngImport: i0, type: ProgressBarModule, imports: [ProgressBar, SharedModule], exports: [ProgressBar, SharedModule] }); static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ProgressBarModule, imports: [ProgressBar, SharedModule, SharedModule] }); } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ProgressBarModule, decorators: [{ type: NgModule, args: [{ imports: [ProgressBar, SharedModule], exports: [ProgressBar, SharedModule] }] }] }); /** * Generated bundle index. Do not edit. */ export { ProgressBar, ProgressBarClasses, ProgressBarModule, ProgressBarStyle }; //# sourceMappingURL=primeng-progressbar.mjs.map