UNPKG

@ng-bootstrap/ng-bootstrap

Version:
1 lines 9.91 kB
{"version":3,"file":"ng-bootstrap-ng-bootstrap-progressbar.mjs","sources":["../../../src/progressbar/progressbar-config.ts","../../../src/progressbar/progressbar.ts","../../../src/progressbar/progressbar.module.ts","../../../src/progressbar/ng-bootstrap-ng-bootstrap-progressbar.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\n\n/**\n * A configuration service for the [`NgbProgressbar`](#/components/progressbar/api#NgbProgressbar) component.\n *\n * You can inject this service, typically in your root component, and customize the values of its properties in\n * order to provide default values for all the progress bars used in the application.\n */\n@Injectable({ providedIn: 'root' })\nexport class NgbProgressbarConfig {\n\tmax = 100;\n\tanimated = false;\n\tariaLabel = 'progress bar';\n\tstriped = false;\n\ttextType: string;\n\ttype: string;\n\tshowValue = false;\n\theight: string;\n}\n","import { ChangeDetectionStrategy, Component, inject, Input, ViewEncapsulation } from '@angular/core';\nimport { getValueInRange, isNumber } from './_ngb-ngbootstrap-utilities.mjs';\nimport { NgbProgressbarConfig } from './progressbar-config';\nimport { PercentPipe } from '@angular/common';\n\n/**\n * A directive that provides feedback on the progress of a workflow or an action.\n */\n@Component({\n\tselector: 'ngb-progressbar',\n\timports: [PercentPipe],\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\tencapsulation: ViewEncapsulation.None,\n\thost: {\n\t\tclass: 'progress',\n\t\trole: 'progressbar',\n\t\t'[attr.aria-valuenow]': 'getValue()',\n\t\t'aria-valuemin': '0',\n\t\t'[attr.aria-valuemax]': 'max',\n\t\t'[attr.aria-label]': 'ariaLabel',\n\t\t'[style.width.%]': 'stacked ? getPercentValue() : null',\n\t\t'[style.height]': 'height',\n\t},\n\ttemplate: `\n\t\t<div\n\t\t\tclass=\"progress-bar{{ type ? (textType ? ' bg-' + type : ' text-bg-' + type) : '' }}{{\n\t\t\t\ttextType ? ' text-' + textType : ''\n\t\t\t}}\"\n\t\t\t[class.progress-bar-animated]=\"animated\"\n\t\t\t[class.progress-bar-striped]=\"striped\"\n\t\t\t[style.width.%]=\"!stacked ? getPercentValue() : null\"\n\t\t>\n\t\t\t@if (showValue) {\n\t\t\t\t<span i18n=\"@@ngb.progressbar.value\">{{ getValue() / max | percent }}</span>\n\t\t\t}\n\t\t\t<ng-content />\n\t\t</div>\n\t`,\n})\nexport class NgbProgressbar {\n\tprivate _config = inject(NgbProgressbarConfig);\n\tpublic stacked = inject(NgbProgressbarStacked, { optional: true });\n\tprivate _max: number;\n\n\t/**\n\t * The maximal value to be displayed in the progress bar.\n\t *\n\t * Should be a positive number. Will default to 100 otherwise.\n\t */\n\t@Input()\n\tset max(max: number) {\n\t\tthis._max = !isNumber(max) || max <= 0 ? 100 : max;\n\t}\n\n\tget max(): number {\n\t\treturn this._max;\n\t}\n\n\t/**\n\t * If `true`, the stripes on the progress bar are animated.\n\t *\n\t * Takes effect only for browsers supporting CSS3 animations, and if `striped` is `true`.\n\t */\n\t@Input() animated = this._config.animated;\n\n\t/**\n\t * The accessible progress bar name.\n\t *\n\t * @since 13.1.0\n\t */\n\t@Input() ariaLabel = this._config.ariaLabel;\n\n\t/**\n\t * If `true`, the progress bars will be displayed as striped.\n\t */\n\t@Input() striped = this._config.striped;\n\n\t/**\n\t * If `true`, the current percentage will be shown in the `xx%` format.\n\t */\n\t@Input() showValue = this._config.showValue;\n\n\t/**\n\t * Optional text variant type of the progress bar.\n\t *\n\t * Supports types based on Bootstrap background color variants, like:\n\t * `\"success\"`, `\"info\"`, `\"warning\"`, `\"danger\"`, `\"primary\"`, `\"secondary\"`, `\"dark\"` and so on.\n\t *\n\t * @since 5.2.0\n\t */\n\t@Input() textType = this._config.textType;\n\n\t/**\n\t * The type of the progress bar.\n\t *\n\t * Supports types based on Bootstrap background color variants, like:\n\t * `\"success\"`, `\"info\"`, `\"warning\"`, `\"danger\"`, `\"primary\"`, `\"secondary\"`, `\"dark\"` and so on.\n\t */\n\t@Input() type = this._config.type;\n\n\t/**\n\t * The current value for the progress bar.\n\t *\n\t * Should be in the `[0, max]` range.\n\t */\n\t@Input({ required: true }) value = 0;\n\n\t/**\n\t * The height of the progress bar.\n\t *\n\t * Accepts any valid CSS height values, ex. `\"2rem\"`\n\t */\n\t@Input() height = this._config.height;\n\n\tconstructor() {\n\t\tthis.max = this._config.max;\n\t}\n\n\tgetValue() {\n\t\treturn getValueInRange(this.value, this.max);\n\t}\n\n\tgetPercentValue() {\n\t\treturn (100 * this.getValue()) / this.max;\n\t}\n}\n\n/**\n * A directive that allow to stack progress bars.\n *\n * @since 16.0.0\n */\n@Component({\n\tselector: 'ngb-progressbar-stacked',\n\tchangeDetection: ChangeDetectionStrategy.OnPush,\n\tencapsulation: ViewEncapsulation.None,\n\thost: {\n\t\tclass: 'progress-stacked',\n\t},\n\ttemplate: `<ng-content></ng-content>`,\n})\nexport class NgbProgressbarStacked {}\n","import { NgModule } from '@angular/core';\n\nimport { NgbProgressbar, NgbProgressbarStacked } from './progressbar';\n\nexport { NgbProgressbar, NgbProgressbarStacked } from './progressbar';\nexport { NgbProgressbarConfig } from './progressbar-config';\n\n@NgModule({\n\timports: [NgbProgressbar, NgbProgressbarStacked],\n\texports: [NgbProgressbar, NgbProgressbarStacked],\n})\nexport class NgbProgressbarModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;AAEA;;;;;AAKG;MAEU,oBAAoB,CAAA;AADjC,IAAA,WAAA,GAAA;QAEC,IAAA,CAAA,GAAG,GAAG,GAAG;QACT,IAAA,CAAA,QAAQ,GAAG,KAAK;QAChB,IAAA,CAAA,SAAS,GAAG,cAAc;QAC1B,IAAA,CAAA,OAAO,GAAG,KAAK;QAGf,IAAA,CAAA,SAAS,GAAG,KAAK;AAEjB,IAAA;8GATY,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAApB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,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