@progress/kendo-angular-progressbar 3.1.0-dev.202207260903 → 3.1.0-dev.202208011708
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/kendo-angular-progressbar.umd.js +1 -1
- package/circularprogressbar/circular-progressbar.component.d.ts +13 -9
- package/common/util.d.ts +4 -0
- package/esm2015/chunk/chunk-progressbar.component.js +2 -2
- package/esm2015/circularprogressbar/circular-progressbar.component.js +81 -46
- package/esm2015/common/progressbar-base.js +2 -2
- package/esm2015/common/util.js +6 -0
- package/esm2015/main.js +2 -2
- package/esm2015/package-metadata.js +1 -1
- package/esm2015/progressbar.component.js +2 -2
- package/esm2015/progressbar.module.js +3 -3
- package/fesm2015/kendo-angular-progressbar.js +95 -54
- package/main.d.ts +2 -2
- package/package.json +1 -1
- package/progressbar.module.d.ts +1 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@progress/kendo-licensing"),require("@progress/kendo-angular-l10n"),require("@progress/kendo-angular-common"),require("@angular/common"),require("rxjs")):"function"==typeof define&&define.amd?define("KendoAngularProgressbar",["exports","@angular/core","@progress/kendo-licensing","@progress/kendo-angular-l10n","@progress/kendo-angular-common","@angular/common","rxjs"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoAngularProgressbar={},e.ng.core,e.KendoLicensing,e.KendoAngularL10N,e.KendoAngularCommon,e.ng.common,e.rxjs)}(this,function(e,a,n,t,i,r,o){"use strict";function s(r){if(r&&r.__esModule)return r;var s=Object.create(null);return r&&Object.keys(r).forEach(function(e){var t;"default"!==e&&(t=Object.getOwnPropertyDescriptor(r,e),Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:function(){return r[e]}}))}),s.default=r,Object.freeze(s)}var l=s(a),p=s(t),u=s(r),c=function(e,t){return(c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function g(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}Object.create;Object.create;function h(e,t,r,s){var n,i,a,o,l=1===(n=e.toString().split(".")).length?""+n[0]:n[0]+"."+n[1].substr(0,v);if("boolean"!=typeof s){if("string"!=typeof s.format)return"function"==typeof s.format?s.format(e):l;switch(s.format){case"value":return l;case"percent":return Math.floor((i=e,a=t,o=Math.abs((r-a)/100),Math.abs((i-a)/o)))+"%";default:return l}}return l}function m(e,t,r){return Math.max(Math.min(r,t),e)}function d(e,t,r){return Math.max((r-e)/(t-e),1e-4)}function y(e,t,r){return e[t]&&void 0!==e[t].currentValue?e[t].currentValue:r}function f(e,t){e.forEach(function(e){t[e.method](e.el,e.attr,""+e.attrValue)})}var b={name:"@progress/kendo-angular-progressbar",productName:"Kendo UI for Angular",productCodes:["KENDOUIANGULAR","KENDOUICOMPLETE"],publishDate:1658826162,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning"},v=3,C=(Object.defineProperty(k.prototype,"isHorizontal",{get:function(){return"horizontal"===this.orientation},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isVertical",{get:function(){return"vertical"===this.orientation},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"disabledClass",{get:function(){return this.disabled},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"reverseClass",{get:function(){return this.reverse},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"indeterminateClass",{get:function(){return this.indeterminate},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"dirAttribute",{get:function(){return this.direction},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"ariaMinAttribute",{get:function(){return String(this.min)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"ariaMaxAttribute",{get:function(){return String(this.max)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"ariaValueAttribute",{get:function(){return this.indeterminate?void 0:String(this.displayValue)},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"isCompleted",{get:function(){return this.value===this.max},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"statusWidth",{get:function(){return"horizontal"===this.orientation?100*this._progressRatio:100},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"statusHeight",{get:function(){return"vertical"===this.orientation?100*this._progressRatio:100},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"statusWrapperWidth",{get:function(){return"horizontal"===this.orientation?100/this._progressRatio:100},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"statusWrapperHeight",{get:function(){return"vertical"===this.orientation?100/this._progressRatio:100},enumerable:!1,configurable:!0}),Object.defineProperty(k.prototype,"_progressRatio",{get:function(){return d(this.min,this.max,this.displayValue)},enumerable:!1,configurable:!0}),k.prototype.ngOnChanges=function(e){var t=y(e,"min",this.min),r=y(e,"max",this.max),s=y(e,"value",this.value);if(e.min||e.max||e.value){if(e.min||e.max){var n=t,i=r;if(a.isDevMode&&i<n)throw new Error("The max value should be greater than the min.")}e.value&&(null!=s&&!Number.isNaN(s)||(this.value=t),i=this.displayValue,this.displayValue=m(this.min,this.max,s),this.previousValue=i),this.min=t,this.max=r,this.displayValue=m(this.min,this.max,s)}},k.prototype.ngOnDestroy=function(){this.localizationChangeSubscription&&this.localizationChangeSubscription.unsubscribe()},k);function k(e){var t=this;this.localization=e,this.widgetClasses=!0,this.roleAttribute="progressbar",this.max=100,this.min=0,this.value=0,this.orientation="horizontal",this.disabled=!1,this.reverse=!1,this.indeterminate=!1,this.displayValue=0,this.previousValue=0,n.validatePackage(b),this.localizationChangeSubscription=e.changes.subscribe(function(e){e=e.rtl;t.direction=e?"rtl":"ltr"})}C.ɵfac=l.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:l,type:C,deps:[{token:p.LocalizationService}],target:l.ɵɵFactoryTarget.Component}),C.ɵcmp=l.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:C,selector:"ng-component",inputs:{max:"max",min:"min",value:"value",orientation:"orientation",disabled:"disabled",reverse:"reverse",indeterminate:"indeterminate"},host:{properties:{"class.k-widget":"this.widgetClasses","class.k-progressbar":"this.widgetClasses","class.k-progressbar-horizontal":"this.isHorizontal","class.k-progressbar-vertical":"this.isVertical","class.k-state-disabled":"this.disabledClass","class.k-progressbar-reverse":"this.reverseClass","class.k-progressbar-indeterminate":"this.indeterminateClass","attr.dir":"this.dirAttribute","attr.role":"this.roleAttribute","attr.aria-valuemin":"this.ariaMinAttribute","attr.aria-valuemax":"this.ariaMaxAttribute","attr.aria-valuenow":"this.ariaValueAttribute"}},usesOnChanges:!0,ngImport:l,template:"",isInline:!0}),l.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:l,type:C,decorators:[{type:a.Component,args:[{template:""}]}],ctorParameters:function(){return[{type:p.LocalizationService}]},propDecorators:{widgetClasses:[{type:a.HostBinding,args:["class.k-widget"]},{type:a.HostBinding,args:["class.k-progressbar"]}],isHorizontal:[{type:a.HostBinding,args:["class.k-progressbar-horizontal"]}],isVertical:[{type:a.HostBinding,args:["class.k-progressbar-vertical"]}],disabledClass:[{type:a.HostBinding,args:["class.k-state-disabled"]}],reverseClass:[{type:a.HostBinding,args:["class.k-progressbar-reverse"]}],indeterminateClass:[{type:a.HostBinding,args:["class.k-progressbar-indeterminate"]}],dirAttribute:[{type:a.HostBinding,args:["attr.dir"]}],roleAttribute:[{type:a.HostBinding,args:["attr.role"]}],ariaMinAttribute:[{type:a.HostBinding,args:["attr.aria-valuemin"]}],ariaMaxAttribute:[{type:a.HostBinding,args:["attr.aria-valuemax"]}],ariaValueAttribute:[{type:a.HostBinding,args:["attr.aria-valuenow"]}],max:[{type:a.Input}],min:[{type:a.Input}],value:[{type:a.Input}],orientation:[{type:a.Input}],disabled:[{type:a.Input}],reverse:[{type:a.Input}],indeterminate:[{type:a.Input}]}});g(V,S=C),Object.defineProperty(V.prototype,"showLabel",{get:function(){return"boolean"==typeof this.label?this.label:(this.label&&!this.label.hasOwnProperty("visible")&&(this.label.visible=!0),this.label.visible)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"labelPosition",{get:function(){return"boolean"==typeof this.label?"end":(this.label&&!this.label.hasOwnProperty("position")&&(this.label.position="end"),this.label.position)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isPositionStart",{get:function(){return"start"===this.labelPosition},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isPositionCenter",{get:function(){return"center"===this.labelPosition},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isPositionEnd",{get:function(){return"end"===this.labelPosition},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"formattedLabelValue",{get:function(){return h(this.displayValue,this.min,this.max,this.label)},enumerable:!1,configurable:!0}),V.prototype.ngOnChanges=function(e){var t,r,s,n;S.prototype.ngOnChanges.call(this,e),this.isAnimationInProgress&&(r=e,t=Boolean(r.animation),r=t&&r.animation.currentValue,t&&!r)&&(this.cancelCurrentAnimation=!0),t=e,r=this.animation,s=this.previousValue,n=this.displayValue,r&&"undefined"!=typeof requestAnimationFrame&&t.value&&s!==n&&!e.value.firstChange&&this.startAnimation(this.previousValue)},V.prototype.ngOnDestroy=function(){this.animationFrame&&cancelAnimationFrame(this.animationFrame)},V.prototype.startAnimation=function(s){var n=this,i=(this.isAnimationInProgress=!0,this.progressStatusElement.nativeElement),a=this.progressStatusWrapperElement.nativeElement,o=this.getAnimationOptions(s);this.zone.runOutsideAngular(function(){n.animationFrame&&cancelAnimationFrame(n.animationFrame);function r(){var e=(new Date).getTime()-o.startTime,e=Math.min(e/o.duration,1),t=o.startSize+o.deltaSize*e;n.renderValueChange(i,a,o.property,t,100/t*100),e<1?n.cancelCurrentAnimation?n.resetProgress(i,a,o.property):n.animationFrame=requestAnimationFrame(r):n.stopAnimation(s)}r()})},Object.defineProperty(V.prototype,"animationDuration",{get:function(){return"boolean"==typeof this.animation?400:(this.animation&&!this.animation.hasOwnProperty("duration")&&(this.animation.duration=400),this.animation.duration)},enumerable:!1,configurable:!0}),V.prototype.stopAnimation=function(e){var t=this;i.hasObservers(this.animationEnd)&&this.zone.run(function(){t.animationEnd.emit({from:e,to:t.displayValue})}),this.zone.run(function(){t.isAnimationInProgress=!1})},V.prototype.getAnimationOptions=function(e){var t="horizontal"===this.orientation,e=d(this.min,this.max,e),r=t?100*e:100,e=t?100:100*e,s=t?"width":"height",n=(new Date).getTime(),i=t?this.statusWidth-r:this.statusHeight-e;return{property:s,startTime:n,startSize:t?r:e,deltaSize:i,duration:this.animationDuration*Math.abs(i/100)}},V.prototype.renderValueChange=function(e,t,r,s,n){this.renderer.setStyle(e,r,s+"%"),this.renderer.setStyle(t,r,n+"%")},V.prototype.resetProgress=function(e,t,r){var s=this,n=d(this.min,this.max,this.value);this.renderValueChange(e,t,r,100*n,100/n),this.zone.run(function(){s.cancelCurrentAnimation=!1,s.isAnimationInProgress=!1})};var S,P=V;function V(e,t,r){var s=S.call(this,e)||this;return s.localization=e,s.zone=t,s.renderer=r,s.label=!0,s.animation=!1,s.animationEnd=new a.EventEmitter,s}P.ɵfac=l.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:l,type:P,deps:[{token:p.LocalizationService},{token:l.NgZone},{token:l.Renderer2}],target:l.ɵɵFactoryTarget.Component}),P.ɵcmp=l.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:P,selector:"kendo-progressbar",inputs:{label:"label",progressCssStyle:"progressCssStyle",progressCssClass:"progressCssClass",emptyCssStyle:"emptyCssStyle",emptyCssClass:"emptyCssClass",animation:"animation"},outputs:{animationEnd:"animationEnd"},providers:[t.LocalizationService,{provide:t.L10N_PREFIX,useValue:"kendo.progressbar"}],viewQueries:[{propertyName:"progressStatusElement",first:!0,predicate:["progressStatus"],descendants:!0},{propertyName:"progressStatusWrapperElement",first:!0,predicate:["progressStatusWrap"],descendants:!0}],exportAs:["kendoProgressBar"],usesInheritance:!0,usesOnChanges:!0,ngImport:l,template:'\n <span class="k-progress-status-wrap"\n [class.k-progress-start]="isPositionStart"\n [class.k-progress-center]="isPositionCenter"\n [class.k-progress-end]="isPositionEnd"\n [ngStyle]="emptyCssStyle"\n [ngClass]="emptyCssClass">\n <span *ngIf="showLabel" class="k-progress-status">{{formattedLabelValue}}</span>\n </span>\n <div\n #progressStatus\n class="k-state-selected"\n [class.k-complete]="isCompleted"\n [ngStyle]="progressCssStyle"\n [ngClass]="progressCssClass"\n [style.width.%]="statusWidth"\n [style.height.%]="statusHeight"\n >\n <span\n #progressStatusWrap\n class="k-progress-status-wrap"\n [style.width.%]="statusWrapperWidth"\n [style.height.%]="statusWrapperHeight"\n [class.k-progress-start]="isPositionStart"\n [class.k-progress-center]="isPositionCenter"\n [class.k-progress-end]="isPositionEnd"\n >\n <span *ngIf="showLabel" class="k-progress-status">{{formattedLabelValue}}</span>\n </span>\n </div>\n ',isInline:!0,directives:[{type:u.NgStyle,selector:"[ngStyle]",inputs:["ngStyle"]},{type:u.NgClass,selector:"[ngClass]",inputs:["class","ngClass"]},{type:u.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]}]}),l.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:l,type:P,decorators:[{type:a.Component,args:[{exportAs:"kendoProgressBar",selector:"kendo-progressbar",template:'\n <span class="k-progress-status-wrap"\n [class.k-progress-start]="isPositionStart"\n [class.k-progress-center]="isPositionCenter"\n [class.k-progress-end]="isPositionEnd"\n [ngStyle]="emptyCssStyle"\n [ngClass]="emptyCssClass">\n <span *ngIf="showLabel" class="k-progress-status">{{formattedLabelValue}}</span>\n </span>\n <div\n #progressStatus\n class="k-state-selected"\n [class.k-complete]="isCompleted"\n [ngStyle]="progressCssStyle"\n [ngClass]="progressCssClass"\n [style.width.%]="statusWidth"\n [style.height.%]="statusHeight"\n >\n <span\n #progressStatusWrap\n class="k-progress-status-wrap"\n [style.width.%]="statusWrapperWidth"\n [style.height.%]="statusWrapperHeight"\n [class.k-progress-start]="isPositionStart"\n [class.k-progress-center]="isPositionCenter"\n [class.k-progress-end]="isPositionEnd"\n >\n <span *ngIf="showLabel" class="k-progress-status">{{formattedLabelValue}}</span>\n </span>\n </div>\n ',providers:[t.LocalizationService,{provide:t.L10N_PREFIX,useValue:"kendo.progressbar"}]}]}],ctorParameters:function(){return[{type:p.LocalizationService},{type:l.NgZone},{type:l.Renderer2}]},propDecorators:{label:[{type:a.Input}],progressCssStyle:[{type:a.Input}],progressCssClass:[{type:a.Input}],emptyCssStyle:[{type:a.Input}],emptyCssClass:[{type:a.Input}],animation:[{type:a.Input}],animationEnd:[{type:a.Output}],progressStatusElement:[{type:a.ViewChild,args:["progressStatus",{static:!1}]}],progressStatusWrapperElement:[{type:a.ViewChild,args:["progressStatusWrap",{static:!1}]}]}});g(O,I=C),Object.defineProperty(O.prototype,"chunks",{get:function(){for(var e,t=this.chunkCount,r=Array(t).fill(!1),s=Math.floor(this._progressRatio*t),n=0;n<s;n++)r[n]=!0;return t=this.orientation,e=this.reverse,("vertical"===t&&!e||"horizontal"===t&&e)&&r.reverse(),r},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"chunkSizePercentage",{get:function(){return 100/this.chunkCount},enumerable:!1,configurable:!0}),Object.defineProperty(O.prototype,"orientationStyles",{get:function(){return"horizontal"===this.orientation?(this._orientationStyles.width=this.chunkSizePercentage+"%",this._orientationStyles.height=void 0):(this._orientationStyles.height=this.chunkSizePercentage+"%",this._orientationStyles.width=void 0),this._orientationStyles},enumerable:!1,configurable:!0});var I,C=O;function O(e){var t=I.call(this,e)||this;return t.localization=e,t.chunkCount=5,t._orientationStyles={width:t.chunkSizePercentage+"%"},t}C.ɵfac=l.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:l,type:C,deps:[{token:p.LocalizationService}],target:l.ɵɵFactoryTarget.Component}),C.ɵcmp=l.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:C,selector:"kendo-chunkprogressbar",inputs:{chunkCount:"chunkCount",progressCssStyle:"progressCssStyle",progressCssClass:"progressCssClass",emptyCssStyle:"emptyCssStyle",emptyCssClass:"emptyCssClass"},providers:[t.LocalizationService,{provide:t.L10N_PREFIX,useValue:"kendo.chunkprogressbar"}],exportAs:["kendoChunkProgressBar"],usesInheritance:!0,ngImport:l,template:'\n <ul class="k-reset">\n <li class="k-item" *ngFor="let chunk of chunks; let i = index;"\n [class.k-first]="i === 0"\n [class.k-last]="i === chunkCount - 1"\n [class.k-state-selected]="chunk"\n [ngClass]="chunk ? progressCssClass : emptyCssClass"\n [ngStyle]="chunk ? progressCssStyle : emptyCssStyle"\n [style.width]="orientationStyles.width"\n [style.height]="orientationStyles.height"\n >\n </li>\n </ul>\n ',isInline:!0,directives:[{type:u.NgForOf,selector:"[ngFor][ngForOf]",inputs:["ngForOf","ngForTrackBy","ngForTemplate"]},{type:u.NgClass,selector:"[ngClass]",inputs:["class","ngClass"]},{type:u.NgStyle,selector:"[ngStyle]",inputs:["ngStyle"]}]}),l.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:l,type:C,decorators:[{type:a.Component,args:[{exportAs:"kendoChunkProgressBar",selector:"kendo-chunkprogressbar",template:'\n <ul class="k-reset">\n <li class="k-item" *ngFor="let chunk of chunks; let i = index;"\n [class.k-first]="i === 0"\n [class.k-last]="i === chunkCount - 1"\n [class.k-state-selected]="chunk"\n [ngClass]="chunk ? progressCssClass : emptyCssClass"\n [ngStyle]="chunk ? progressCssStyle : emptyCssStyle"\n [style.width]="orientationStyles.width"\n [style.height]="orientationStyles.height"\n >\n </li>\n </ul>\n ',providers:[t.LocalizationService,{provide:t.L10N_PREFIX,useValue:"kendo.chunkprogressbar"}]}]}],ctorParameters:function(){return[{type:p.LocalizationService}]},propDecorators:{chunkCount:[{type:a.Input}],progressCssStyle:[{type:a.Input}],progressCssClass:[{type:a.Input}],emptyCssStyle:[{type:a.Input}],emptyCssClass:[{type:a.Input}]}});var w=function(e){this.templateRef=e},E=(w.ɵfac=l.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:l,type:w,deps:[{token:l.TemplateRef}],target:l.ɵɵFactoryTarget.Directive}),w.ɵdir=l.ɵɵngDeclareDirective({minVersion:"12.0.0",version:"12.2.16",type:w,selector:"[kendoCircularProgressbarCenterTemplate]",ngImport:l}),l.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:l,type:w,decorators:[{type:a.Directive,args:[{selector:"[kendoCircularProgressbarCenterTemplate]"}]}],ctorParameters:function(){return[{type:l.TemplateRef}]}}),Object.defineProperty(x.prototype,"value",{get:function(){return this._value},set:function(e){e>this.max&&this.handleErrors("value > max"),e<this.min&&this.handleErrors("value < min"),this.previousValue=this.value,this._value=e},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"max",{get:function(){return this._max},set:function(e){e<this.min&&this.handleErrors("max < min"),this._max=e},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"min",{get:function(){return this._min},set:function(e){e>this.max&&this.handleErrors("max < min"),this._min=e},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"indeterminate",{get:function(){return this._indeterminate},set:function(e){this._indeterminate=e},enumerable:!1,configurable:!0}),x.prototype.ngAfterViewInit=function(){this.initProgressArc()},x.prototype.ngOnChanges=function(e){var t=e.value,r=this.progress,s=!e.value.firstChange;t&&r&&s&&(this.animation?this.progressbarAnimation():(t=this.value-this.min,this.internalValue=e.value.currentValue,this.calculateProgress(t))),e.opacity&&this.progress&&f([{method:"setAttribute",el:this.progress.nativeElement,attr:"opacity",attrValue:this.opacity}],this.renderer),e.indeterminate&&!e.indeterminate.firstChange&&this.indeterminateState()},x.prototype.ngOnDestroy=function(){this.subscriptions.unsubscribe()},x.prototype.initProgressArc=function(){var e;this.setStyles(),this.indeterminate?this.indeterminateState():this.animation?this.progressbarAnimation():(e=this.value-this.min,this.calculateProgress(e))},x.prototype.calculateProgress=function(e){this.progressColor&&this.updateProgressColor(e),this.updateCenterTemplate(e+this.min);var t=this.progress.nativeElement,r=this.progress.nativeElement.r.baseVal.value,r=Math.PI*(2*r),e=r-(this.rtl?-1*r:r)*(e/(this.max-this.min));f([{method:"setStyle",el:t,attr:"strokeDasharray",attrValue:r},{method:"setStyle",el:t,attr:"strokeDashoffset",attrValue:e}],this.renderer)},x.prototype.progressbarAnimation=function(){var e=this.internalValue>this.value-this.min,t=this.value>this.previousValue,r=this.internalValue<this.value-this.min,s=this.value<this.previousValue;e&&t||r&&s||(this.calculateProgress(this.internalValue),e=this.internalValue,i.hasObservers(this.animationEnd)&&this.animationEnd.emit({from:e,to:this.internalValue}),t?this.internalValue+=1:--this.internalValue,requestAnimationFrame(this.progressbarAnimation.bind(this)))},x.prototype.setStyles=function(){var e=this.progress.nativeElement,t=this.scale.nativeElement,r=this.element.nativeElement.getBoundingClientRect().width,e=[{method:"setAttribute",el:e,attr:"r",attrValue:r/2-10},{method:"setAttribute",el:e,attr:"cx",attrValue:r/2},{method:"setAttribute",el:e,attr:"cy",attrValue:r/2},{method:"setAttribute",el:e,attr:"opacity",attrValue:this.opacity},{method:"setAttribute",el:t,attr:"r",attrValue:r/2-10},{method:"setAttribute",el:t,attr:"cx",attrValue:r/2},{method:"setAttribute",el:t,attr:"cy",attrValue:r/2}];f(e,this.renderer)},x.prototype.indeterminateState=function(){var e,t,r=this.progress.nativeElement;this.indeterminate?(this.calculateProgress(this.value-this.min),e=this.rtl?{from:360,to:0}:{from:0,to:360},this.renderer.removeClass(r,"k-circular-progressbar-arc"),f([{method:"setStyle",el:r,attr:"transform-origin",attrValue:"center"},{method:"setStyle",el:r,attr:"fill",attrValue:"none"},{method:"setStyle",el:r,attr:"stroke-linecap",attrValue:"round"}],this.renderer),r.innerHTML='<animateTransform attributeName="transform" type="rotate" from="'+e.from+' 0 0" to="'+e.to+' 0 0" dur="1s" repeatCount="indefinite" />'):(this.renderer.addClass(r,"k-circular-progressbar-arc"),t=this.renderer,[{method:"removeStyle",el:r,attr:"transform-origin"},{method:"removeStyle",el:r,attr:"fill"},{method:"removeStyle",el:r,attr:"stroke-linecap"}].forEach(function(e){t[e.method](e.el,e.attr)}),r.innerHTML="",this.animation&&this.progressbarAnimation())},x.prototype.updateCenterTemplate=function(e){this.centerTemplate&&(this.centerTemplateContext.value=e,this.centerTemplateContext.color=this.currentColor,this.cdr.detectChanges(),this.positionLabel())},x.prototype.positionLabel=function(){var e=this.labelElement.nativeElement,t=this.svgWrapper.nativeElement.getBoundingClientRect(),r=t.width,t=t.height,r=r/2-e.offsetWidth/2,t=t/2-e.offsetHeight/2;f([{method:"setStyle",el:e,attr:"left",attrValue:r+"px"},{method:"setStyle",el:e,attr:"top",attrValue:t+"px"}],this.renderer)},Object.defineProperty(x.prototype,"currentColor",{get:function(){return this.progress.nativeElement.style.stroke},enumerable:!1,configurable:!0}),x.prototype.updateProgressColor=function(e){var t=this.progress.nativeElement;if("string"==typeof this.progressColor)this.renderer.setStyle(t,"stroke",this.progressColor);else for(var r=0;r<this.progressColor.length;r++){var s=this.progressColor[r].from,n=this.progressColor[r].to;if(s<=e&&e<n||!s&&e<n){this.renderer.setStyle(t,"stroke",this.progressColor[r].color);break}!n&&s<=e&&this.renderer.setStyle(t,"stroke",this.progressColor[r].color)}},x.prototype.handleErrors=function(e){if(a.isDevMode())switch(e){case"value > max":throw new Error("The value of the Circular Progressbar cannot exceed the max value");case"value < min":throw new Error("The value of the Circular Progressbar cannot be lower than the min value");case"max < min":throw new Error("The min value cannot be higher than the max value")}},x.prototype.setDirection=function(){this.rtl=this.localizationService.rtl,this.element&&this.renderer.setAttribute(this.element.nativeElement,"dir",this.rtl?"rtl":"ltr"),this.labelElement&&this.renderer.setAttribute(this.labelElement.nativeElement,"dir",this.rtl?"rtl":"ltr")},x.prototype.rtlChange=function(){this.element&&this.rtl!==this.localizationService.rtl&&this.setDirection()},x);function x(e,t,r,s){this.renderer=e,this.cdr=t,this.localizationService=r,this.element=s,this.hostClasses=!0,this.WrapperSize="200px",this.animation=!0,this.opacity=1,this.animationEnd=new a.EventEmitter,this.centerTemplateContext={},this._indeterminate=!1,this._max=100,this._min=0,this._value=0,this.internalValue=0,this.subscriptions=new o.Subscription,n.validatePackage(b),this.subscriptions.add(this.localizationService.changes.subscribe(this.rtlChange.bind(this)))}E.ɵfac=l.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:l,type:E,deps:[{token:l.Renderer2},{token:l.ChangeDetectorRef},{token:p.LocalizationService},{token:l.ElementRef}],target:l.ɵɵFactoryTarget.Component}),E.ɵcmp=l.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:E,selector:"kendo-circularprogressbar",inputs:{value:"value",max:"max",min:"min",animation:"animation",opacity:"opacity",indeterminate:"indeterminate",progressColor:"progressColor"},outputs:{animationEnd:"animationEnd"},host:{properties:{"class.k-circular-progressbar":"this.hostClasses","style.width":"this.WrapperSize","style.height":"this.WrapperSize"}},providers:[t.LocalizationService,{provide:t.L10N_PREFIX,useValue:"kendo.circularprogressbar"}],queries:[{propertyName:"centerTemplate",first:!0,predicate:w,descendants:!0}],viewQueries:[{propertyName:"progress",first:!0,predicate:["progress"],descendants:!0},{propertyName:"scale",first:!0,predicate:["scale"],descendants:!0},{propertyName:"labelElement",first:!0,predicate:["label"],descendants:!0},{propertyName:"svgWrapper",first:!0,predicate:["svgWrapper"],descendants:!0}],exportAs:["kendoCircularProgressBar"],usesOnChanges:!0,ngImport:l,template:'\n <div class="k-circular-progressbar-surface">\n <div #svgWrapper>\n <svg #svg>\n <g>\n <circle class="k-circular-progressbar-scale" #scale stroke-width="9.5"></circle>\n <circle class="k-circular-progressbar-arc" #progress stroke-width="9.5"></circle>\n </g>\n </svg>\n <div class="k-circular-progressbar-label" *ngIf="centerTemplate" #label>\n <ng-template [ngTemplateOutlet]="centerTemplate.templateRef" [ngTemplateOutletContext]="centerTemplateContext"></ng-template>\n </div>\n </div>\n </div>\n ',isInline:!0,directives:[{type:u.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]},{type:u.NgTemplateOutlet,selector:"[ngTemplateOutlet]",inputs:["ngTemplateOutletContext","ngTemplateOutlet"]}]}),l.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:l,type:E,decorators:[{type:a.Component,args:[{exportAs:"kendoCircularProgressBar",selector:"kendo-circularprogressbar",template:'\n <div class="k-circular-progressbar-surface">\n <div #svgWrapper>\n <svg #svg>\n <g>\n <circle class="k-circular-progressbar-scale" #scale stroke-width="9.5"></circle>\n <circle class="k-circular-progressbar-arc" #progress stroke-width="9.5"></circle>\n </g>\n </svg>\n <div class="k-circular-progressbar-label" *ngIf="centerTemplate" #label>\n <ng-template [ngTemplateOutlet]="centerTemplate.templateRef" [ngTemplateOutletContext]="centerTemplateContext"></ng-template>\n </div>\n </div>\n </div>\n ',providers:[t.LocalizationService,{provide:t.L10N_PREFIX,useValue:"kendo.circularprogressbar"}]}]}],ctorParameters:function(){return[{type:l.Renderer2},{type:l.ChangeDetectorRef},{type:p.LocalizationService},{type:l.ElementRef}]},propDecorators:{hostClasses:[{type:a.HostBinding,args:["class.k-circular-progressbar"]}],WrapperSize:[{type:a.HostBinding,args:["style.width"]},{type:a.HostBinding,args:["style.height"]}],value:[{type:a.Input}],max:[{type:a.Input}],min:[{type:a.Input}],animation:[{type:a.Input}],opacity:[{type:a.Input}],indeterminate:[{type:a.Input}],progressColor:[{type:a.Input}],animationEnd:[{type:a.Output}],progress:[{type:a.ViewChild,args:["progress"]}],scale:[{type:a.ViewChild,args:["scale"]}],labelElement:[{type:a.ViewChild,args:["label"]}],svgWrapper:[{type:a.ViewChild,args:["svgWrapper"]}],centerTemplate:[{type:a.ContentChild,args:[w]}]}});var u=[P,C,E,w],t=[r.CommonModule,i.ResizeSensorModule],A=function(){};A.ɵfac=l.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:l,type:A,deps:[],target:l.ɵɵFactoryTarget.NgModule}),A.ɵmod=l.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.16",ngImport:l,type:A,declarations:[P,C,E,w],imports:[r.CommonModule,i.ResizeSensorModule],exports:[P,C,E,w]}),A.ɵinj=l.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.16",ngImport:l,type:A,imports:[t]}),l.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:l,type:A,decorators:[{type:a.NgModule,args:[{declarations:u,exports:u,imports:t}]}]}),e.ChunkProgressBarComponent=C,e.CircularProgressBar=E,e.CircularProgressbarCenterTemplateDirective=w,e.ProgressBarComponent=P,e.ProgressBarModule=A,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
5
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@progress/kendo-licensing"),require("@progress/kendo-angular-l10n"),require("@progress/kendo-angular-common"),require("@angular/common"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("KendoAngularProgressbar",["exports","@angular/core","@progress/kendo-licensing","@progress/kendo-angular-l10n","@progress/kendo-angular-common","@angular/common","rxjs","rxjs/operators"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).KendoAngularProgressbar={},e.ng.core,e.KendoLicensing,e.KendoAngularL10N,e.KendoAngularCommon,e.ng.common,e.rxjs,e.rxjs.operators)}(this,function(e,a,i,t,n,r,o,l){"use strict";function s(r){if(r&&r.__esModule)return r;var s=Object.create(null);return r&&Object.keys(r).forEach(function(e){var t;"default"!==e&&(t=Object.getOwnPropertyDescriptor(r,e),Object.defineProperty(s,e,t.get?t:{enumerable:!0,get:function(){return r[e]}}))}),s.default=r,Object.freeze(s)}var p=s(a),u=s(t),c=s(n),h=s(r),g=function(e,t){return(g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}g(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}Object.create;Object.create;function d(e,t,r,s){var n,i,a,o,l=1===(n=e.toString().split(".")).length?""+n[0]:n[0]+"."+n[1].substr(0,S);if("boolean"!=typeof s){if("string"!=typeof s.format)return"function"==typeof s.format?s.format(e):l;switch(s.format){case"value":return l;case"percent":return Math.floor((i=e,a=t,o=Math.abs((r-a)/100),Math.abs((i-a)/o)))+"%";default:return l}}return l}function y(e,t,r){return Math.max(Math.min(r,t),e)}function f(e,t,r){return Math.max((r-e)/(t-e),1e-4)}function b(e,t,r){return e[t]&&void 0!==e[t].currentValue?e[t].currentValue:r}function v(e,t){e.forEach(function(e){t[e.method](e.el,e.attr,""+e.attrValue)})}function C(e){return e.style.width&&e.style.height}var k={name:"@progress/kendo-angular-progressbar",productName:"Kendo UI for Angular",productCodes:["KENDOUIANGULAR","KENDOUICOMPLETE"],publishDate:1659373689,version:"",licensingDocsUrl:"https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning"},S=3,P=(Object.defineProperty(V.prototype,"isHorizontal",{get:function(){return"horizontal"===this.orientation},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isVertical",{get:function(){return"vertical"===this.orientation},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"disabledClass",{get:function(){return this.disabled},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"reverseClass",{get:function(){return this.reverse},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"indeterminateClass",{get:function(){return this.indeterminate},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"dirAttribute",{get:function(){return this.direction},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"ariaMinAttribute",{get:function(){return String(this.min)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"ariaMaxAttribute",{get:function(){return String(this.max)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"ariaValueAttribute",{get:function(){return this.indeterminate?void 0:String(this.displayValue)},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"isCompleted",{get:function(){return this.value===this.max},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"statusWidth",{get:function(){return"horizontal"===this.orientation?100*this._progressRatio:100},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"statusHeight",{get:function(){return"vertical"===this.orientation?100*this._progressRatio:100},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"statusWrapperWidth",{get:function(){return"horizontal"===this.orientation?100/this._progressRatio:100},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"statusWrapperHeight",{get:function(){return"vertical"===this.orientation?100/this._progressRatio:100},enumerable:!1,configurable:!0}),Object.defineProperty(V.prototype,"_progressRatio",{get:function(){return f(this.min,this.max,this.displayValue)},enumerable:!1,configurable:!0}),V.prototype.ngOnChanges=function(e){var t=b(e,"min",this.min),r=b(e,"max",this.max),s=b(e,"value",this.value);if(e.min||e.max||e.value){if(e.min||e.max){var n=t,i=r;if(a.isDevMode&&i<n)throw new Error("The max value should be greater than the min.")}e.value&&(null!=s&&!Number.isNaN(s)||(this.value=t),i=this.displayValue,this.displayValue=y(this.min,this.max,s),this.previousValue=i),this.min=t,this.max=r,this.displayValue=y(this.min,this.max,s)}},V.prototype.ngOnDestroy=function(){this.localizationChangeSubscription&&this.localizationChangeSubscription.unsubscribe()},V);function V(e){var t=this;this.localization=e,this.widgetClasses=!0,this.roleAttribute="progressbar",this.max=100,this.min=0,this.value=0,this.orientation="horizontal",this.disabled=!1,this.reverse=!1,this.indeterminate=!1,this.displayValue=0,this.previousValue=0,i.validatePackage(k),this.localizationChangeSubscription=e.changes.subscribe(function(e){e=e.rtl;t.direction=e?"rtl":"ltr"})}P.ɵfac=p.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:p,type:P,deps:[{token:u.LocalizationService}],target:p.ɵɵFactoryTarget.Component}),P.ɵcmp=p.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:P,selector:"ng-component",inputs:{max:"max",min:"min",value:"value",orientation:"orientation",disabled:"disabled",reverse:"reverse",indeterminate:"indeterminate"},host:{properties:{"class.k-widget":"this.widgetClasses","class.k-progressbar":"this.widgetClasses","class.k-progressbar-horizontal":"this.isHorizontal","class.k-progressbar-vertical":"this.isVertical","class.k-disabled":"this.disabledClass","class.k-progressbar-reverse":"this.reverseClass","class.k-progressbar-indeterminate":"this.indeterminateClass","attr.dir":"this.dirAttribute","attr.role":"this.roleAttribute","attr.aria-valuemin":"this.ariaMinAttribute","attr.aria-valuemax":"this.ariaMaxAttribute","attr.aria-valuenow":"this.ariaValueAttribute"}},usesOnChanges:!0,ngImport:p,template:"",isInline:!0}),p.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:p,type:P,decorators:[{type:a.Component,args:[{template:""}]}],ctorParameters:function(){return[{type:u.LocalizationService}]},propDecorators:{widgetClasses:[{type:a.HostBinding,args:["class.k-widget"]},{type:a.HostBinding,args:["class.k-progressbar"]}],isHorizontal:[{type:a.HostBinding,args:["class.k-progressbar-horizontal"]}],isVertical:[{type:a.HostBinding,args:["class.k-progressbar-vertical"]}],disabledClass:[{type:a.HostBinding,args:["class.k-disabled"]}],reverseClass:[{type:a.HostBinding,args:["class.k-progressbar-reverse"]}],indeterminateClass:[{type:a.HostBinding,args:["class.k-progressbar-indeterminate"]}],dirAttribute:[{type:a.HostBinding,args:["attr.dir"]}],roleAttribute:[{type:a.HostBinding,args:["attr.role"]}],ariaMinAttribute:[{type:a.HostBinding,args:["attr.aria-valuemin"]}],ariaMaxAttribute:[{type:a.HostBinding,args:["attr.aria-valuemax"]}],ariaValueAttribute:[{type:a.HostBinding,args:["attr.aria-valuenow"]}],max:[{type:a.Input}],min:[{type:a.Input}],value:[{type:a.Input}],orientation:[{type:a.Input}],disabled:[{type:a.Input}],reverse:[{type:a.Input}],indeterminate:[{type:a.Input}]}});m(x,I=P),Object.defineProperty(x.prototype,"showLabel",{get:function(){return"boolean"==typeof this.label?this.label:(this.label&&!this.label.hasOwnProperty("visible")&&(this.label.visible=!0),this.label.visible)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"labelPosition",{get:function(){return"boolean"==typeof this.label?"end":(this.label&&!this.label.hasOwnProperty("position")&&(this.label.position="end"),this.label.position)},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isPositionStart",{get:function(){return"start"===this.labelPosition},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isPositionCenter",{get:function(){return"center"===this.labelPosition},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"isPositionEnd",{get:function(){return"end"===this.labelPosition},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"formattedLabelValue",{get:function(){return d(this.displayValue,this.min,this.max,this.label)},enumerable:!1,configurable:!0}),x.prototype.ngOnChanges=function(e){var t,r,s,n;I.prototype.ngOnChanges.call(this,e),this.isAnimationInProgress&&(r=e,t=Boolean(r.animation),r=t&&r.animation.currentValue,t&&!r)&&(this.cancelCurrentAnimation=!0),t=e,r=this.animation,s=this.previousValue,n=this.displayValue,r&&"undefined"!=typeof requestAnimationFrame&&t.value&&s!==n&&!e.value.firstChange&&this.startAnimation(this.previousValue)},x.prototype.ngOnDestroy=function(){this.animationFrame&&cancelAnimationFrame(this.animationFrame)},x.prototype.startAnimation=function(s){var n=this,i=(this.isAnimationInProgress=!0,this.progressStatusElement.nativeElement),a=this.progressStatusWrapperElement.nativeElement,o=this.getAnimationOptions(s);this.zone.runOutsideAngular(function(){n.animationFrame&&cancelAnimationFrame(n.animationFrame);function r(){var e=(new Date).getTime()-o.startTime,e=Math.min(e/o.duration,1),t=o.startSize+o.deltaSize*e;n.renderValueChange(i,a,o.property,t,100/t*100),e<1?n.cancelCurrentAnimation?n.resetProgress(i,a,o.property):n.animationFrame=requestAnimationFrame(r):n.stopAnimation(s)}r()})},Object.defineProperty(x.prototype,"animationDuration",{get:function(){return"boolean"==typeof this.animation?400:(this.animation&&!this.animation.hasOwnProperty("duration")&&(this.animation.duration=400),this.animation.duration)},enumerable:!1,configurable:!0}),x.prototype.stopAnimation=function(e){var t=this;n.hasObservers(this.animationEnd)&&this.zone.run(function(){t.animationEnd.emit({from:e,to:t.displayValue})}),this.zone.run(function(){t.isAnimationInProgress=!1})},x.prototype.getAnimationOptions=function(e){var t="horizontal"===this.orientation,e=f(this.min,this.max,e),r=t?100*e:100,e=t?100:100*e,s=t?"width":"height",n=(new Date).getTime(),i=t?this.statusWidth-r:this.statusHeight-e;return{property:s,startTime:n,startSize:t?r:e,deltaSize:i,duration:this.animationDuration*Math.abs(i/100)}},x.prototype.renderValueChange=function(e,t,r,s,n){this.renderer.setStyle(e,r,s+"%"),this.renderer.setStyle(t,r,n+"%")},x.prototype.resetProgress=function(e,t,r){var s=this,n=f(this.min,this.max,this.value);this.renderValueChange(e,t,r,100*n,100/n),this.zone.run(function(){s.cancelCurrentAnimation=!1,s.isAnimationInProgress=!1})};var I,O=x;function x(e,t,r){var s=I.call(this,e)||this;return s.localization=e,s.zone=t,s.renderer=r,s.label=!0,s.animation=!1,s.animationEnd=new a.EventEmitter,s}O.ɵfac=p.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:p,type:O,deps:[{token:u.LocalizationService},{token:p.NgZone},{token:p.Renderer2}],target:p.ɵɵFactoryTarget.Component}),O.ɵcmp=p.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:O,selector:"kendo-progressbar",inputs:{label:"label",progressCssStyle:"progressCssStyle",progressCssClass:"progressCssClass",emptyCssStyle:"emptyCssStyle",emptyCssClass:"emptyCssClass",animation:"animation"},outputs:{animationEnd:"animationEnd"},providers:[t.LocalizationService,{provide:t.L10N_PREFIX,useValue:"kendo.progressbar"}],viewQueries:[{propertyName:"progressStatusElement",first:!0,predicate:["progressStatus"],descendants:!0},{propertyName:"progressStatusWrapperElement",first:!0,predicate:["progressStatusWrap"],descendants:!0}],exportAs:["kendoProgressBar"],usesInheritance:!0,usesOnChanges:!0,ngImport:p,template:'\n <span class="k-progress-status-wrap"\n [class.k-progress-start]="isPositionStart"\n [class.k-progress-center]="isPositionCenter"\n [class.k-progress-end]="isPositionEnd"\n [ngStyle]="emptyCssStyle"\n [ngClass]="emptyCssClass">\n <span *ngIf="showLabel" class="k-progress-status">{{formattedLabelValue}}</span>\n </span>\n <div\n #progressStatus\n class="k-selected"\n [class.k-complete]="isCompleted"\n [ngStyle]="progressCssStyle"\n [ngClass]="progressCssClass"\n [style.width.%]="statusWidth"\n [style.height.%]="statusHeight"\n >\n <span\n #progressStatusWrap\n class="k-progress-status-wrap"\n [style.width.%]="statusWrapperWidth"\n [style.height.%]="statusWrapperHeight"\n [class.k-progress-start]="isPositionStart"\n [class.k-progress-center]="isPositionCenter"\n [class.k-progress-end]="isPositionEnd"\n >\n <span *ngIf="showLabel" class="k-progress-status">{{formattedLabelValue}}</span>\n </span>\n </div>\n ',isInline:!0,directives:[{type:h.NgStyle,selector:"[ngStyle]",inputs:["ngStyle"]},{type:h.NgClass,selector:"[ngClass]",inputs:["class","ngClass"]},{type:h.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]}]}),p.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:p,type:O,decorators:[{type:a.Component,args:[{exportAs:"kendoProgressBar",selector:"kendo-progressbar",template:'\n <span class="k-progress-status-wrap"\n [class.k-progress-start]="isPositionStart"\n [class.k-progress-center]="isPositionCenter"\n [class.k-progress-end]="isPositionEnd"\n [ngStyle]="emptyCssStyle"\n [ngClass]="emptyCssClass">\n <span *ngIf="showLabel" class="k-progress-status">{{formattedLabelValue}}</span>\n </span>\n <div\n #progressStatus\n class="k-selected"\n [class.k-complete]="isCompleted"\n [ngStyle]="progressCssStyle"\n [ngClass]="progressCssClass"\n [style.width.%]="statusWidth"\n [style.height.%]="statusHeight"\n >\n <span\n #progressStatusWrap\n class="k-progress-status-wrap"\n [style.width.%]="statusWrapperWidth"\n [style.height.%]="statusWrapperHeight"\n [class.k-progress-start]="isPositionStart"\n [class.k-progress-center]="isPositionCenter"\n [class.k-progress-end]="isPositionEnd"\n >\n <span *ngIf="showLabel" class="k-progress-status">{{formattedLabelValue}}</span>\n </span>\n </div>\n ',providers:[t.LocalizationService,{provide:t.L10N_PREFIX,useValue:"kendo.progressbar"}]}]}],ctorParameters:function(){return[{type:u.LocalizationService},{type:p.NgZone},{type:p.Renderer2}]},propDecorators:{label:[{type:a.Input}],progressCssStyle:[{type:a.Input}],progressCssClass:[{type:a.Input}],emptyCssStyle:[{type:a.Input}],emptyCssClass:[{type:a.Input}],animation:[{type:a.Input}],animationEnd:[{type:a.Output}],progressStatusElement:[{type:a.ViewChild,args:["progressStatus",{static:!1}]}],progressStatusWrapperElement:[{type:a.ViewChild,args:["progressStatusWrap",{static:!1}]}]}});m(w,E=P),Object.defineProperty(w.prototype,"chunks",{get:function(){for(var e,t=this.chunkCount,r=Array(t).fill(!1),s=Math.floor(this._progressRatio*t),n=0;n<s;n++)r[n]=!0;return t=this.orientation,e=this.reverse,("vertical"===t&&!e||"horizontal"===t&&e)&&r.reverse(),r},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"chunkSizePercentage",{get:function(){return 100/this.chunkCount},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"orientationStyles",{get:function(){return"horizontal"===this.orientation?(this._orientationStyles.width=this.chunkSizePercentage+"%",this._orientationStyles.height=void 0):(this._orientationStyles.height=this.chunkSizePercentage+"%",this._orientationStyles.width=void 0),this._orientationStyles},enumerable:!1,configurable:!0});var E,P=w;function w(e){var t=E.call(this,e)||this;return t.localization=e,t.chunkCount=5,t._orientationStyles={width:t.chunkSizePercentage+"%"},t}P.ɵfac=p.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:p,type:P,deps:[{token:u.LocalizationService}],target:p.ɵɵFactoryTarget.Component}),P.ɵcmp=p.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:P,selector:"kendo-chunkprogressbar",inputs:{chunkCount:"chunkCount",progressCssStyle:"progressCssStyle",progressCssClass:"progressCssClass",emptyCssStyle:"emptyCssStyle",emptyCssClass:"emptyCssClass"},providers:[t.LocalizationService,{provide:t.L10N_PREFIX,useValue:"kendo.chunkprogressbar"}],exportAs:["kendoChunkProgressBar"],usesInheritance:!0,ngImport:p,template:'\n <ul class="k-reset">\n <li class="k-item" *ngFor="let chunk of chunks; let i = index;"\n [class.k-first]="i === 0"\n [class.k-last]="i === chunkCount - 1"\n [class.k-selected]="chunk"\n [ngClass]="chunk ? progressCssClass : emptyCssClass"\n [ngStyle]="chunk ? progressCssStyle : emptyCssStyle"\n [style.width]="orientationStyles.width"\n [style.height]="orientationStyles.height"\n >\n </li>\n </ul>\n ',isInline:!0,directives:[{type:h.NgForOf,selector:"[ngFor][ngForOf]",inputs:["ngForOf","ngForTrackBy","ngForTemplate"]},{type:h.NgClass,selector:"[ngClass]",inputs:["class","ngClass"]},{type:h.NgStyle,selector:"[ngStyle]",inputs:["ngStyle"]}]}),p.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:p,type:P,decorators:[{type:a.Component,args:[{exportAs:"kendoChunkProgressBar",selector:"kendo-chunkprogressbar",template:'\n <ul class="k-reset">\n <li class="k-item" *ngFor="let chunk of chunks; let i = index;"\n [class.k-first]="i === 0"\n [class.k-last]="i === chunkCount - 1"\n [class.k-selected]="chunk"\n [ngClass]="chunk ? progressCssClass : emptyCssClass"\n [ngStyle]="chunk ? progressCssStyle : emptyCssStyle"\n [style.width]="orientationStyles.width"\n [style.height]="orientationStyles.height"\n >\n </li>\n </ul>\n ',providers:[t.LocalizationService,{provide:t.L10N_PREFIX,useValue:"kendo.chunkprogressbar"}]}]}],ctorParameters:function(){return[{type:u.LocalizationService}]},propDecorators:{chunkCount:[{type:a.Input}],progressCssStyle:[{type:a.Input}],progressCssClass:[{type:a.Input}],emptyCssStyle:[{type:a.Input}],emptyCssClass:[{type:a.Input}]}});var A=function(e){this.templateRef=e},z=(A.ɵfac=p.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:p,type:A,deps:[{token:p.TemplateRef}],target:p.ɵɵFactoryTarget.Directive}),A.ɵdir=p.ɵɵngDeclareDirective({minVersion:"12.0.0",version:"12.2.16",type:A,selector:"[kendoCircularProgressbarCenterTemplate]",ngImport:p}),p.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:p,type:A,decorators:[{type:a.Directive,args:[{selector:"[kendoCircularProgressbarCenterTemplate]"}]}],ctorParameters:function(){return[{type:p.TemplateRef}]}}),Object.defineProperty(T.prototype,"value",{get:function(){return this._value},set:function(e){e>this.max&&this.handleErrors("value > max"),e<this.min&&this.handleErrors("value < min"),this.previousValue=this.value,this._value=e},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"max",{get:function(){return this._max},set:function(e){e<this.min&&this.handleErrors("max < min"),this._max=e},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"min",{get:function(){return this._min},set:function(e){e>this.max&&this.handleErrors("max < min"),this._min=e},enumerable:!1,configurable:!0}),Object.defineProperty(T.prototype,"indeterminate",{get:function(){return this._indeterminate},set:function(e){this._indeterminate=e},enumerable:!1,configurable:!0}),T.prototype.ngAfterViewInit=function(){this.initProgressArc()},T.prototype.ngOnChanges=function(e){var t;n.isChanged("value",e,!0)&&this.progress&&(this.animation?this.progressbarAnimation():(t=this.value-this.min,this.internalValue=e.value.currentValue,this.calculateProgress(t))),e.opacity&&this.progress&&v([{method:"setAttribute",el:this.progress.nativeElement,attr:"opacity",attrValue:this.opacity}],this.renderer),e.indeterminate&&!e.indeterminate.firstChange&&this.indeterminateState()},T.prototype.ngOnDestroy=function(){this.subscriptions.unsubscribe()},T.prototype.onResize=function(e){this.setStyles();var t=this.animation?this.internalValue:this.value;this.calculateProgress(t),this.updateCenterTemplate(t)},T.prototype.initProgressArc=function(){var e;this.setStyles(),this.indeterminate?this.indeterminateState():this.animation?this.progressbarAnimation():(e=this.value-this.min,this.calculateProgress(e))},T.prototype.calculateProgress=function(e){var t=this,r=(this.progressColor&&this.updateProgressColor(e),this.zone.onStable.pipe(l.take(1)).subscribe(function(){t.updateCenterTemplate(e+t.min)}),this.progress.nativeElement),s=this.progress.nativeElement.r.baseVal.value,s=Math.PI*(2*s),n=s-(this.rtl?-1*s:s)*(e/(this.max-this.min));v([{method:"setStyle",el:r,attr:"strokeDasharray",attrValue:s},{method:"setStyle",el:r,attr:"strokeDashoffset",attrValue:n}],this.renderer)},T.prototype.progressbarAnimation=function(){var e=this.internalValue>this.value-this.min,t=this.value>=this.previousValue,r=this.internalValue<this.value-this.min,s=this.value<=this.previousValue;e&&t||r&&s||(this.calculateProgress(this.internalValue),e=this.internalValue,n.hasObservers(this.animationEnd)&&this.animationEnd.emit({from:e,to:this.internalValue}),t?this.internalValue+=1:--this.internalValue,requestAnimationFrame(this.progressbarAnimation.bind(this)))},T.prototype.setStyles=function(){var e=this.progress.nativeElement,t=this.scale.nativeElement,r=this.surface.nativeElement,s=this.element.nativeElement,n=s.getBoundingClientRect().width,s=(C(s)||(n=200,v([{method:"setStyle",el:r,attr:"width",attrValue:"200px"},{method:"setStyle",el:r,attr:"height",attrValue:"200px"}],this.renderer)),[{method:"setAttribute",el:e,attr:"r",attrValue:n/2-10},{method:"setAttribute",el:e,attr:"cx",attrValue:n/2},{method:"setAttribute",el:e,attr:"cy",attrValue:n/2},{method:"setAttribute",el:e,attr:"opacity",attrValue:this.opacity},{method:"setAttribute",el:t,attr:"r",attrValue:n/2-10},{method:"setAttribute",el:t,attr:"cx",attrValue:n/2},{method:"setAttribute",el:t,attr:"cy",attrValue:n/2}]);v(s,this.renderer)},T.prototype.indeterminateState=function(){var e,t,r,s=this.progress.nativeElement;this.indeterminate?(this.calculateProgress(this.value-this.min),e=this.rtl?{from:360,to:0}:{from:0,to:360},t=void 0,t=[{method:"setStyle",el:s,attr:"transform-origin",attrValue:"center"},{method:"setStyle",el:s,attr:"fill",attrValue:"none"},{method:"setStyle",el:s,attr:"stroke-linecap",attrValue:"round"},{method:"setStyle",el:s,attr:"stroke",attrValue:(t=this.progressColor?t:getComputedStyle(s).stroke)||this.currentColor}],v(t,this.renderer),this.renderer.removeClass(s,"k-circular-progressbar-arc"),s.innerHTML='<animateTransform attributeName="transform" type="rotate" from="'+e.from+' 0 0" to="'+e.to+' 0 0" dur="1s" repeatCount="indefinite" />'):(this.renderer.addClass(s,"k-circular-progressbar-arc"),r=this.renderer,[{method:"removeStyle",el:s,attr:"transform-origin"},{method:"removeStyle",el:s,attr:"fill"},{method:"removeStyle",el:s,attr:"stroke-linecap"}].forEach(function(e){r[e.method](e.el,e.attr)}),s.innerHTML="",this.animation&&this.progressbarAnimation())},T.prototype.updateCenterTemplate=function(e){this.centerTemplate&&(this.centerTemplateContext.value=e,this.centerTemplateContext.color=this.currentColor,this.cdr.detectChanges(),this.positionLabel())},T.prototype.positionLabel=function(){var e=this.labelElement.nativeElement,t=this.element.nativeElement,r=this.surface.nativeElement,t=(r=C(t)?(s=(t=t.getBoundingClientRect()).width,t.height):(s=(t=r.getBoundingClientRect()).width,t.height),s/2-e.offsetWidth/2),s=r/2-e.offsetHeight/2;v([{method:"setStyle",el:e,attr:"left",attrValue:t+"px"},{method:"setStyle",el:e,attr:"top",attrValue:s+"px"}],this.renderer)},Object.defineProperty(T.prototype,"currentColor",{get:function(){return this.progress.nativeElement.style.stroke},enumerable:!1,configurable:!0}),T.prototype.updateProgressColor=function(e){var t=this.progress.nativeElement;if("string"==typeof this.progressColor)this.renderer.setStyle(t,"stroke",this.progressColor);else for(var r=0;r<this.progressColor.length;r++){var s=this.progressColor[r].from,n=this.progressColor[r].to;if(s<=e&&e<=n||!s&&e<=n){this.renderer.setStyle(t,"stroke",this.progressColor[r].color);break}!n&&s<=e&&this.renderer.setStyle(t,"stroke",this.progressColor[r].color)}},T.prototype.handleErrors=function(e){if(a.isDevMode())switch(e){case"value > max":throw new Error("The value of the CircularProgressbar cannot exceed the max value");case"value < min":throw new Error("The value of the CircularProgressbar cannot be lower than the min value");case"max < min":throw new Error("The min value cannot be higher than the max value")}},T.prototype.setDirection=function(){this.rtl=this.localizationService.rtl,this.element&&this.renderer.setAttribute(this.element.nativeElement,"dir",this.rtl?"rtl":"ltr"),this.labelElement&&this.renderer.setAttribute(this.labelElement.nativeElement,"dir",this.rtl?"rtl":"ltr")},T.prototype.rtlChange=function(){this.element&&this.rtl!==this.localizationService.rtl&&this.setDirection()},T);function T(e,t,r,s,n){this.renderer=e,this.cdr=t,this.localizationService=r,this.element=s,this.zone=n,this.hostClasses=!0,this.animation=!1,this.opacity=1,this.animationEnd=new a.EventEmitter,this.centerTemplateContext={},this._indeterminate=!1,this._max=100,this._min=0,this._value=0,this.internalValue=0,this.subscriptions=new o.Subscription,i.validatePackage(k),this.subscriptions.add(this.localizationService.changes.subscribe(this.rtlChange.bind(this)))}z.ɵfac=p.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:p,type:z,deps:[{token:p.Renderer2},{token:p.ChangeDetectorRef},{token:u.LocalizationService},{token:p.ElementRef},{token:p.NgZone}],target:p.ɵɵFactoryTarget.Component}),z.ɵcmp=p.ɵɵngDeclareComponent({minVersion:"12.0.0",version:"12.2.16",type:z,selector:"kendo-circularprogressbar",inputs:{value:"value",max:"max",min:"min",animation:"animation",opacity:"opacity",indeterminate:"indeterminate",progressColor:"progressColor"},outputs:{animationEnd:"animationEnd"},host:{properties:{"class.k-circular-progressbar":"this.hostClasses"}},providers:[t.LocalizationService,{provide:t.L10N_PREFIX,useValue:"kendo.circularprogressbar"}],queries:[{propertyName:"centerTemplate",first:!0,predicate:A,descendants:!0}],viewQueries:[{propertyName:"progress",first:!0,predicate:["progress"],descendants:!0},{propertyName:"scale",first:!0,predicate:["scale"],descendants:!0},{propertyName:"labelElement",first:!0,predicate:["label"],descendants:!0},{propertyName:"surface",first:!0,predicate:["surface"],descendants:!0}],exportAs:["kendoCircularProgressBar"],usesOnChanges:!0,ngImport:p,template:'\n <div #surface class="k-circular-progressbar-surface">\n <div>\n <svg #svg>\n <g>\n <circle class="k-circular-progressbar-scale" #scale stroke-width="9.5"></circle>\n <circle class="k-circular-progressbar-arc" #progress stroke-width="9.5"></circle>\n </g>\n </svg>\n <div class="k-circular-progressbar-label" *ngIf="centerTemplate" #label>\n <ng-template [ngTemplateOutlet]="centerTemplate.templateRef" [ngTemplateOutletContext]="centerTemplateContext"></ng-template>\n </div>\n </div>\n </div>\n <kendo-resize-sensor (resize)="onResize($event)"></kendo-resize-sensor>\n ',isInline:!0,components:[{type:c.ResizeSensorComponent,selector:"kendo-resize-sensor",inputs:["rateLimit"],outputs:["resize"]}],directives:[{type:h.NgIf,selector:"[ngIf]",inputs:["ngIf","ngIfThen","ngIfElse"]},{type:h.NgTemplateOutlet,selector:"[ngTemplateOutlet]",inputs:["ngTemplateOutletContext","ngTemplateOutlet"]}]}),p.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:p,type:z,decorators:[{type:a.Component,args:[{exportAs:"kendoCircularProgressBar",selector:"kendo-circularprogressbar",template:'\n <div #surface class="k-circular-progressbar-surface">\n <div>\n <svg #svg>\n <g>\n <circle class="k-circular-progressbar-scale" #scale stroke-width="9.5"></circle>\n <circle class="k-circular-progressbar-arc" #progress stroke-width="9.5"></circle>\n </g>\n </svg>\n <div class="k-circular-progressbar-label" *ngIf="centerTemplate" #label>\n <ng-template [ngTemplateOutlet]="centerTemplate.templateRef" [ngTemplateOutletContext]="centerTemplateContext"></ng-template>\n </div>\n </div>\n </div>\n <kendo-resize-sensor (resize)="onResize($event)"></kendo-resize-sensor>\n ',providers:[t.LocalizationService,{provide:t.L10N_PREFIX,useValue:"kendo.circularprogressbar"}]}]}],ctorParameters:function(){return[{type:p.Renderer2},{type:p.ChangeDetectorRef},{type:u.LocalizationService},{type:p.ElementRef},{type:p.NgZone}]},propDecorators:{hostClasses:[{type:a.HostBinding,args:["class.k-circular-progressbar"]}],value:[{type:a.Input}],max:[{type:a.Input}],min:[{type:a.Input}],animation:[{type:a.Input}],opacity:[{type:a.Input}],indeterminate:[{type:a.Input}],progressColor:[{type:a.Input}],animationEnd:[{type:a.Output}],progress:[{type:a.ViewChild,args:["progress"]}],scale:[{type:a.ViewChild,args:["scale"]}],labelElement:[{type:a.ViewChild,args:["label"]}],surface:[{type:a.ViewChild,args:["surface"]}],centerTemplate:[{type:a.ContentChild,args:[A]}]}});c=[O,P,z,A],h=[r.CommonModule,n.ResizeSensorModule],t=function(){};t.ɵfac=p.ɵɵngDeclareFactory({minVersion:"12.0.0",version:"12.2.16",ngImport:p,type:t,deps:[],target:p.ɵɵFactoryTarget.NgModule}),t.ɵmod=p.ɵɵngDeclareNgModule({minVersion:"12.0.0",version:"12.2.16",ngImport:p,type:t,declarations:[O,P,z,A],imports:[r.CommonModule,n.ResizeSensorModule],exports:[O,P,z,A]}),t.ɵinj=p.ɵɵngDeclareInjector({minVersion:"12.0.0",version:"12.2.16",ngImport:p,type:t,imports:[h]}),p.ɵɵngDeclareClassMetadata({minVersion:"12.0.0",version:"12.2.16",ngImport:p,type:t,decorators:[{type:a.NgModule,args:[{declarations:c,exports:c,imports:h}]}]}),e.ChunkProgressBarComponent=P,e.CircularProgressBarComponent=z,e.CircularProgressbarCenterTemplateDirective=A,e.ProgressBarComponent=O,e.ProgressBarModule=t,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, OnChanges, OnDestroy, Renderer2, SimpleChanges } from '@angular/core';
|
|
5
|
+
import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, NgZone, OnChanges, OnDestroy, Renderer2, SimpleChanges } from '@angular/core';
|
|
6
6
|
import { LocalizationService } from '@progress/kendo-angular-l10n';
|
|
7
7
|
import { AnimationEndEvent } from '../types/animation-end-event';
|
|
8
8
|
import { CircularProgressbarCenterTemplateDirective } from './center-template.directive';
|
|
@@ -14,7 +14,7 @@ import * as i0 from "@angular/core";
|
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* ```ts-preview
|
|
17
|
-
* _@Component({
|
|
17
|
+
* _@Component({
|
|
18
18
|
* selector: 'my-app',
|
|
19
19
|
* template: `
|
|
20
20
|
* <kendo-circularprogressbar [value]="value"></kendo-circularprogressbar>
|
|
@@ -25,13 +25,13 @@ import * as i0 from "@angular/core";
|
|
|
25
25
|
* }
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
|
-
export declare class
|
|
28
|
+
export declare class CircularProgressBarComponent implements AfterViewInit, OnChanges, OnDestroy {
|
|
29
29
|
private renderer;
|
|
30
30
|
private cdr;
|
|
31
31
|
private localizationService;
|
|
32
32
|
private element;
|
|
33
|
+
private zone;
|
|
33
34
|
hostClasses: boolean;
|
|
34
|
-
WrapperSize: string;
|
|
35
35
|
/**
|
|
36
36
|
* Sets the default value of the Circular Progressbar between `min` and `max`.
|
|
37
37
|
*
|
|
@@ -56,7 +56,7 @@ export declare class CircularProgressBar implements AfterViewInit, OnChanges, On
|
|
|
56
56
|
/**
|
|
57
57
|
* Indicates whether an animation will be played on value changes.
|
|
58
58
|
*
|
|
59
|
-
* @default
|
|
59
|
+
* @default false
|
|
60
60
|
*/
|
|
61
61
|
animation: boolean;
|
|
62
62
|
/**
|
|
@@ -81,7 +81,7 @@ export declare class CircularProgressBar implements AfterViewInit, OnChanges, On
|
|
|
81
81
|
progress: ElementRef;
|
|
82
82
|
scale: ElementRef;
|
|
83
83
|
labelElement: ElementRef;
|
|
84
|
-
|
|
84
|
+
surface: ElementRef;
|
|
85
85
|
centerTemplate: CircularProgressbarCenterTemplateDirective;
|
|
86
86
|
centerTemplateContext: CenterTemplateContext;
|
|
87
87
|
private _indeterminate;
|
|
@@ -92,10 +92,14 @@ export declare class CircularProgressBar implements AfterViewInit, OnChanges, On
|
|
|
92
92
|
private internalValue;
|
|
93
93
|
private rtl;
|
|
94
94
|
private subscriptions;
|
|
95
|
-
constructor(renderer: Renderer2, cdr: ChangeDetectorRef, localizationService: LocalizationService, element: ElementRef);
|
|
95
|
+
constructor(renderer: Renderer2, cdr: ChangeDetectorRef, localizationService: LocalizationService, element: ElementRef, zone: NgZone);
|
|
96
96
|
ngAfterViewInit(): void;
|
|
97
97
|
ngOnChanges(changes: SimpleChanges): void;
|
|
98
98
|
ngOnDestroy(): void;
|
|
99
|
+
/**
|
|
100
|
+
* @hidden
|
|
101
|
+
*/
|
|
102
|
+
onResize(_event?: any): void;
|
|
99
103
|
private initProgressArc;
|
|
100
104
|
private calculateProgress;
|
|
101
105
|
private progressbarAnimation;
|
|
@@ -108,6 +112,6 @@ export declare class CircularProgressBar implements AfterViewInit, OnChanges, On
|
|
|
108
112
|
private handleErrors;
|
|
109
113
|
private setDirection;
|
|
110
114
|
private rtlChange;
|
|
111
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<
|
|
112
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<
|
|
115
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CircularProgressBarComponent, never>;
|
|
116
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CircularProgressBarComponent, "kendo-circularprogressbar", ["kendoCircularProgressBar"], { "value": "value"; "max": "max"; "min": "min"; "animation": "animation"; "opacity": "opacity"; "indeterminate": "indeterminate"; "progressColor": "progressColor"; }, { "animationEnd": "animationEnd"; }, ["centerTemplate"], never>;
|
|
113
117
|
}
|
package/common/util.d.ts
CHANGED
|
@@ -44,3 +44,7 @@ export declare const setProgressBarStyles: (props: any, renderer: Renderer2) =>
|
|
|
44
44
|
* @hidden
|
|
45
45
|
*/
|
|
46
46
|
export declare const removeProgressBarStyles: (props: any, renderer: Renderer2) => void;
|
|
47
|
+
/**
|
|
48
|
+
* @hidden
|
|
49
|
+
*/
|
|
50
|
+
export declare const hasElementSize: (element: any) => boolean;
|
|
@@ -90,7 +90,7 @@ ChunkProgressBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.
|
|
|
90
90
|
<li class="k-item" *ngFor="let chunk of chunks; let i = index;"
|
|
91
91
|
[class.k-first]="i === 0"
|
|
92
92
|
[class.k-last]="i === chunkCount - 1"
|
|
93
|
-
[class.k-
|
|
93
|
+
[class.k-selected]="chunk"
|
|
94
94
|
[ngClass]="chunk ? progressCssClass : emptyCssClass"
|
|
95
95
|
[ngStyle]="chunk ? progressCssStyle : emptyCssStyle"
|
|
96
96
|
[style.width]="orientationStyles.width"
|
|
@@ -109,7 +109,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
109
109
|
<li class="k-item" *ngFor="let chunk of chunks; let i = index;"
|
|
110
110
|
[class.k-first]="i === 0"
|
|
111
111
|
[class.k-last]="i === chunkCount - 1"
|
|
112
|
-
[class.k-
|
|
112
|
+
[class.k-selected]="chunk"
|
|
113
113
|
[ngClass]="chunk ? progressCssClass : emptyCssClass"
|
|
114
114
|
[ngStyle]="chunk ? progressCssStyle : emptyCssStyle"
|
|
115
115
|
[style.width]="orientationStyles.width"
|
|
@@ -3,22 +3,25 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { Component, ContentChild, EventEmitter, HostBinding, Input, isDevMode, Output, ViewChild } from '@angular/core';
|
|
6
|
-
import { hasObservers } from '@progress/kendo-angular-common';
|
|
6
|
+
import { hasObservers, isChanged } from '@progress/kendo-angular-common';
|
|
7
7
|
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
8
8
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
9
9
|
import { Subscription } from 'rxjs';
|
|
10
|
-
import {
|
|
10
|
+
import { take } from 'rxjs/operators';
|
|
11
|
+
import { hasElementSize, removeProgressBarStyles, setProgressBarStyles } from '../common/util';
|
|
11
12
|
import { packageMetadata } from '../package-metadata';
|
|
12
13
|
import { CircularProgressbarCenterTemplateDirective } from './center-template.directive';
|
|
13
14
|
import * as i0 from "@angular/core";
|
|
14
15
|
import * as i1 from "@progress/kendo-angular-l10n";
|
|
15
|
-
import * as i2 from "@angular
|
|
16
|
+
import * as i2 from "@progress/kendo-angular-common";
|
|
17
|
+
import * as i3 from "@angular/common";
|
|
18
|
+
const DEFAULT_SURFACE_SIZE = 200;
|
|
16
19
|
/**
|
|
17
20
|
* Represents the [Kendo UI Circular ProgressBar component for Angular]({% slug circular_progressbar %}).
|
|
18
21
|
*
|
|
19
22
|
* @example
|
|
20
23
|
* ```ts-preview
|
|
21
|
-
* _@Component({
|
|
24
|
+
* _@Component({
|
|
22
25
|
* selector: 'my-app',
|
|
23
26
|
* template: `
|
|
24
27
|
* <kendo-circularprogressbar [value]="value"></kendo-circularprogressbar>
|
|
@@ -29,20 +32,20 @@ import * as i2 from "@angular/common";
|
|
|
29
32
|
* }
|
|
30
33
|
* ```
|
|
31
34
|
*/
|
|
32
|
-
export class
|
|
33
|
-
constructor(renderer, cdr, localizationService, element) {
|
|
35
|
+
export class CircularProgressBarComponent {
|
|
36
|
+
constructor(renderer, cdr, localizationService, element, zone) {
|
|
34
37
|
this.renderer = renderer;
|
|
35
38
|
this.cdr = cdr;
|
|
36
39
|
this.localizationService = localizationService;
|
|
37
40
|
this.element = element;
|
|
41
|
+
this.zone = zone;
|
|
38
42
|
this.hostClasses = true;
|
|
39
|
-
this.WrapperSize = '200px';
|
|
40
43
|
/**
|
|
41
44
|
* Indicates whether an animation will be played on value changes.
|
|
42
45
|
*
|
|
43
|
-
* @default
|
|
46
|
+
* @default false
|
|
44
47
|
*/
|
|
45
|
-
this.animation =
|
|
48
|
+
this.animation = false;
|
|
46
49
|
/**
|
|
47
50
|
* The opacity of the value arc.
|
|
48
51
|
* @default 1
|
|
@@ -122,10 +125,8 @@ export class CircularProgressBar {
|
|
|
122
125
|
this.initProgressArc();
|
|
123
126
|
}
|
|
124
127
|
ngOnChanges(changes) {
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
const isValueSecondChange = !changes.value.firstChange;
|
|
128
|
-
if (isValueChanged && isProgressArcCreated && isValueSecondChange) {
|
|
128
|
+
const skipFirstChange = true;
|
|
129
|
+
if (isChanged('value', changes, skipFirstChange) && this.progress) {
|
|
129
130
|
if (this.animation) {
|
|
130
131
|
this.progressbarAnimation();
|
|
131
132
|
}
|
|
@@ -145,6 +146,15 @@ export class CircularProgressBar {
|
|
|
145
146
|
ngOnDestroy() {
|
|
146
147
|
this.subscriptions.unsubscribe();
|
|
147
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* @hidden
|
|
151
|
+
*/
|
|
152
|
+
onResize(_event) {
|
|
153
|
+
this.setStyles();
|
|
154
|
+
const value = this.animation ? this.internalValue : this.value;
|
|
155
|
+
this.calculateProgress(value);
|
|
156
|
+
this.updateCenterTemplate(value);
|
|
157
|
+
}
|
|
148
158
|
initProgressArc() {
|
|
149
159
|
this.setStyles();
|
|
150
160
|
if (this.indeterminate) {
|
|
@@ -164,7 +174,10 @@ export class CircularProgressBar {
|
|
|
164
174
|
if (this.progressColor) {
|
|
165
175
|
this.updateProgressColor(value);
|
|
166
176
|
}
|
|
167
|
-
|
|
177
|
+
// needed when we have *ngIf inside the template to render different content depending on some condition
|
|
178
|
+
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
179
|
+
this.updateCenterTemplate(value + this.min);
|
|
180
|
+
});
|
|
168
181
|
const progressArc = this.progress.nativeElement;
|
|
169
182
|
const radius = this.progress.nativeElement.r.baseVal.value;
|
|
170
183
|
const circumference = Math.PI * (radius * 2);
|
|
@@ -179,11 +192,11 @@ export class CircularProgressBar {
|
|
|
179
192
|
progressbarAnimation() {
|
|
180
193
|
const forwardProgress = {
|
|
181
194
|
isOngoing: this.internalValue > this.value - this.min,
|
|
182
|
-
isPositive: this.value
|
|
195
|
+
isPositive: this.value >= this.previousValue
|
|
183
196
|
};
|
|
184
197
|
const backwardProgress = {
|
|
185
198
|
isOngoing: this.internalValue < this.value - this.min,
|
|
186
|
-
isNegative: this.value
|
|
199
|
+
isNegative: this.value <= this.previousValue
|
|
187
200
|
};
|
|
188
201
|
if (forwardProgress.isOngoing && forwardProgress.isPositive ||
|
|
189
202
|
backwardProgress.isOngoing && backwardProgress.isNegative) {
|
|
@@ -204,8 +217,18 @@ export class CircularProgressBar {
|
|
|
204
217
|
setStyles() {
|
|
205
218
|
const progressArc = this.progress.nativeElement;
|
|
206
219
|
const scale = this.scale.nativeElement;
|
|
220
|
+
const surface = this.surface.nativeElement;
|
|
207
221
|
const element = this.element.nativeElement;
|
|
208
|
-
|
|
222
|
+
let elWidth = element.getBoundingClientRect().width;
|
|
223
|
+
;
|
|
224
|
+
if (!hasElementSize(element)) {
|
|
225
|
+
const surfaceSize = [
|
|
226
|
+
{ method: 'setStyle', el: surface, attr: 'width', attrValue: `${DEFAULT_SURFACE_SIZE}px` },
|
|
227
|
+
{ method: 'setStyle', el: surface, attr: 'height', attrValue: `${DEFAULT_SURFACE_SIZE}px` }
|
|
228
|
+
];
|
|
229
|
+
elWidth = DEFAULT_SURFACE_SIZE;
|
|
230
|
+
setProgressBarStyles(surfaceSize, this.renderer);
|
|
231
|
+
}
|
|
209
232
|
const attributesArray = [
|
|
210
233
|
{ method: 'setAttribute', el: progressArc, attr: 'r', attrValue: (elWidth / 2) - 10 },
|
|
211
234
|
{ method: 'setAttribute', el: progressArc, attr: 'cx', attrValue: (elWidth / 2) },
|
|
@@ -223,16 +246,21 @@ export class CircularProgressBar {
|
|
|
223
246
|
// the indeterminate state wont work as the `k-circular-progressbar-arc` has a transform: rotate(-90deg) which is
|
|
224
247
|
// interfering with the svg animation as the animateTransform brings its own transform: rotate()
|
|
225
248
|
// This will be like this until the themes release a new version, bringing a new class `k-circular-progressbar-indeterminate-arc`
|
|
226
|
-
// containing only the necassery CSS styles and we will switch between them when the state of the progressbar is switched.
|
|
249
|
+
// containing only the necassery CSS styles and we will switch between them when the state of the progressbar is switched.
|
|
227
250
|
this.calculateProgress(this.value - this.min);
|
|
228
251
|
const rotate = this.rtl ? { from: 360, to: 0 } : { from: 0, to: 360 };
|
|
229
|
-
|
|
252
|
+
let color;
|
|
253
|
+
if (!this.progressColor) {
|
|
254
|
+
color = getComputedStyle(progressArc).stroke;
|
|
255
|
+
}
|
|
230
256
|
const indeterminateStyles = [
|
|
231
257
|
{ method: 'setStyle', el: progressArc, attr: 'transform-origin', attrValue: 'center' },
|
|
232
258
|
{ method: 'setStyle', el: progressArc, attr: 'fill', attrValue: 'none' },
|
|
233
|
-
{ method: 'setStyle', el: progressArc, attr: 'stroke-linecap', attrValue: 'round' }
|
|
259
|
+
{ method: 'setStyle', el: progressArc, attr: 'stroke-linecap', attrValue: 'round' },
|
|
260
|
+
{ method: 'setStyle', el: progressArc, attr: 'stroke', attrValue: color ? color : this.currentColor }
|
|
234
261
|
];
|
|
235
262
|
setProgressBarStyles(indeterminateStyles, this.renderer);
|
|
263
|
+
this.renderer.removeClass(progressArc, 'k-circular-progressbar-arc');
|
|
236
264
|
progressArc.innerHTML = `<animateTransform attributeName="transform" type="rotate" from="${rotate.from} 0 0" to="${rotate.to} 0 0" dur="1s" repeatCount="indefinite" />`;
|
|
237
265
|
}
|
|
238
266
|
else {
|
|
@@ -260,11 +288,22 @@ export class CircularProgressBar {
|
|
|
260
288
|
}
|
|
261
289
|
positionLabel() {
|
|
262
290
|
const labelEl = this.labelElement.nativeElement;
|
|
263
|
-
const
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
291
|
+
const element = this.element.nativeElement;
|
|
292
|
+
const surface = this.surface.nativeElement;
|
|
293
|
+
let elWidth;
|
|
294
|
+
let elHeight;
|
|
295
|
+
if (!hasElementSize(element)) {
|
|
296
|
+
const surfaceSize = surface.getBoundingClientRect();
|
|
297
|
+
elWidth = surfaceSize.width;
|
|
298
|
+
elHeight = surfaceSize.height;
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
const elementSize = element.getBoundingClientRect();
|
|
302
|
+
elWidth = elementSize.width;
|
|
303
|
+
elHeight = elementSize.height;
|
|
304
|
+
}
|
|
305
|
+
const left = (elWidth / 2) - (labelEl.offsetWidth / 2);
|
|
306
|
+
const top = (elHeight / 2) - (labelEl.offsetHeight / 2);
|
|
268
307
|
const labelCalculations = [
|
|
269
308
|
{ method: 'setStyle', el: labelEl, attr: 'left', attrValue: `${left}px` },
|
|
270
309
|
{ method: 'setStyle', el: labelEl, attr: 'top', attrValue: `${top}px` }
|
|
@@ -284,7 +323,7 @@ export class CircularProgressBar {
|
|
|
284
323
|
for (let i = 0; i < this.progressColor.length; i++) {
|
|
285
324
|
let from = this.progressColor[i].from;
|
|
286
325
|
let to = this.progressColor[i].to;
|
|
287
|
-
if (value >= from && value
|
|
326
|
+
if (value >= from && value <= to || (!from && value <= to)) {
|
|
288
327
|
this.renderer.setStyle(progressArc, 'stroke', this.progressColor[i].color);
|
|
289
328
|
break;
|
|
290
329
|
}
|
|
@@ -298,9 +337,9 @@ export class CircularProgressBar {
|
|
|
298
337
|
if (isDevMode()) {
|
|
299
338
|
switch (type) {
|
|
300
339
|
case 'value > max':
|
|
301
|
-
throw new Error('The value of the
|
|
340
|
+
throw new Error('The value of the CircularProgressbar cannot exceed the max value');
|
|
302
341
|
case 'value < min':
|
|
303
|
-
throw new Error('The value of the
|
|
342
|
+
throw new Error('The value of the CircularProgressbar cannot be lower than the min value');
|
|
304
343
|
case 'max < min':
|
|
305
344
|
throw new Error('The min value cannot be higher than the max value');
|
|
306
345
|
default:
|
|
@@ -322,16 +361,16 @@ export class CircularProgressBar {
|
|
|
322
361
|
}
|
|
323
362
|
}
|
|
324
363
|
}
|
|
325
|
-
|
|
326
|
-
|
|
364
|
+
CircularProgressBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CircularProgressBarComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i1.LocalizationService }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
365
|
+
CircularProgressBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: CircularProgressBarComponent, selector: "kendo-circularprogressbar", inputs: { value: "value", max: "max", min: "min", animation: "animation", opacity: "opacity", indeterminate: "indeterminate", progressColor: "progressColor" }, outputs: { animationEnd: "animationEnd" }, host: { properties: { "class.k-circular-progressbar": "this.hostClasses" } }, providers: [
|
|
327
366
|
LocalizationService,
|
|
328
367
|
{
|
|
329
368
|
provide: L10N_PREFIX,
|
|
330
369
|
useValue: 'kendo.circularprogressbar'
|
|
331
370
|
}
|
|
332
|
-
], queries: [{ propertyName: "centerTemplate", first: true, predicate: CircularProgressbarCenterTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "progress", first: true, predicate: ["progress"], descendants: true }, { propertyName: "scale", first: true, predicate: ["scale"], descendants: true }, { propertyName: "labelElement", first: true, predicate: ["label"], descendants: true }, { propertyName: "
|
|
333
|
-
<div class="k-circular-progressbar-surface">
|
|
334
|
-
<div
|
|
371
|
+
], queries: [{ propertyName: "centerTemplate", first: true, predicate: CircularProgressbarCenterTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "progress", first: true, predicate: ["progress"], descendants: true }, { propertyName: "scale", first: true, predicate: ["scale"], descendants: true }, { propertyName: "labelElement", first: true, predicate: ["label"], descendants: true }, { propertyName: "surface", first: true, predicate: ["surface"], descendants: true }], exportAs: ["kendoCircularProgressBar"], usesOnChanges: true, ngImport: i0, template: `
|
|
372
|
+
<div #surface class="k-circular-progressbar-surface">
|
|
373
|
+
<div>
|
|
335
374
|
<svg #svg>
|
|
336
375
|
<g>
|
|
337
376
|
<circle class="k-circular-progressbar-scale" #scale stroke-width="9.5"></circle>
|
|
@@ -343,15 +382,16 @@ CircularProgressBar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ve
|
|
|
343
382
|
</div>
|
|
344
383
|
</div>
|
|
345
384
|
</div>
|
|
346
|
-
|
|
347
|
-
|
|
385
|
+
<kendo-resize-sensor (resize)="onResize($event)"></kendo-resize-sensor>
|
|
386
|
+
`, isInline: true, components: [{ type: i2.ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
387
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CircularProgressBarComponent, decorators: [{
|
|
348
388
|
type: Component,
|
|
349
389
|
args: [{
|
|
350
390
|
exportAs: 'kendoCircularProgressBar',
|
|
351
391
|
selector: 'kendo-circularprogressbar',
|
|
352
392
|
template: `
|
|
353
|
-
<div class="k-circular-progressbar-surface">
|
|
354
|
-
<div
|
|
393
|
+
<div #surface class="k-circular-progressbar-surface">
|
|
394
|
+
<div>
|
|
355
395
|
<svg #svg>
|
|
356
396
|
<g>
|
|
357
397
|
<circle class="k-circular-progressbar-scale" #scale stroke-width="9.5"></circle>
|
|
@@ -363,6 +403,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
363
403
|
</div>
|
|
364
404
|
</div>
|
|
365
405
|
</div>
|
|
406
|
+
<kendo-resize-sensor (resize)="onResize($event)"></kendo-resize-sensor>
|
|
366
407
|
`, providers: [
|
|
367
408
|
LocalizationService,
|
|
368
409
|
{
|
|
@@ -371,15 +412,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
371
412
|
}
|
|
372
413
|
]
|
|
373
414
|
}]
|
|
374
|
-
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }, { type: i0.ElementRef }]; }, propDecorators: { hostClasses: [{
|
|
415
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { hostClasses: [{
|
|
375
416
|
type: HostBinding,
|
|
376
417
|
args: ['class.k-circular-progressbar']
|
|
377
|
-
}], WrapperSize: [{
|
|
378
|
-
type: HostBinding,
|
|
379
|
-
args: ['style.width']
|
|
380
|
-
}, {
|
|
381
|
-
type: HostBinding,
|
|
382
|
-
args: ['style.height']
|
|
383
418
|
}], value: [{
|
|
384
419
|
type: Input
|
|
385
420
|
}], max: [{
|
|
@@ -405,9 +440,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
405
440
|
}], labelElement: [{
|
|
406
441
|
type: ViewChild,
|
|
407
442
|
args: ["label"]
|
|
408
|
-
}],
|
|
443
|
+
}], surface: [{
|
|
409
444
|
type: ViewChild,
|
|
410
|
-
args: ["
|
|
445
|
+
args: ["surface"]
|
|
411
446
|
}], centerTemplate: [{
|
|
412
447
|
type: ContentChild,
|
|
413
448
|
args: [CircularProgressbarCenterTemplateDirective]
|
|
@@ -159,7 +159,7 @@ export class ProgressBarBase {
|
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
ProgressBarBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarBase, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
162
|
-
ProgressBarBase.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ProgressBarBase, selector: "ng-component", inputs: { max: "max", min: "min", value: "value", orientation: "orientation", disabled: "disabled", reverse: "reverse", indeterminate: "indeterminate" }, host: { properties: { "class.k-widget": "this.widgetClasses", "class.k-progressbar": "this.widgetClasses", "class.k-progressbar-horizontal": "this.isHorizontal", "class.k-progressbar-vertical": "this.isVertical", "class.k-
|
|
162
|
+
ProgressBarBase.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ProgressBarBase, selector: "ng-component", inputs: { max: "max", min: "min", value: "value", orientation: "orientation", disabled: "disabled", reverse: "reverse", indeterminate: "indeterminate" }, host: { properties: { "class.k-widget": "this.widgetClasses", "class.k-progressbar": "this.widgetClasses", "class.k-progressbar-horizontal": "this.isHorizontal", "class.k-progressbar-vertical": "this.isVertical", "class.k-disabled": "this.disabledClass", "class.k-progressbar-reverse": "this.reverseClass", "class.k-progressbar-indeterminate": "this.indeterminateClass", "attr.dir": "this.dirAttribute", "attr.role": "this.roleAttribute", "attr.aria-valuemin": "this.ariaMinAttribute", "attr.aria-valuemax": "this.ariaMaxAttribute", "attr.aria-valuenow": "this.ariaValueAttribute" } }, usesOnChanges: true, ngImport: i0, template: '', isInline: true });
|
|
163
163
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarBase, decorators: [{
|
|
164
164
|
type: Component,
|
|
165
165
|
args: [{
|
|
@@ -179,7 +179,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
179
179
|
args: ['class.k-progressbar-vertical']
|
|
180
180
|
}], disabledClass: [{
|
|
181
181
|
type: HostBinding,
|
|
182
|
-
args: ['class.k-
|
|
182
|
+
args: ['class.k-disabled']
|
|
183
183
|
}], reverseClass: [{
|
|
184
184
|
type: HostBinding,
|
|
185
185
|
args: ['class.k-progressbar-reverse']
|
package/esm2015/common/util.js
CHANGED
package/esm2015/main.js
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
export { ProgressBarComponent } from './progressbar.component';
|
|
6
6
|
export { ChunkProgressBarComponent } from './chunk/chunk-progressbar.component';
|
|
7
|
-
export {
|
|
8
|
-
export { CircularProgressbarCenterTemplateDirective } from './circularprogressbar/center-template.directive';
|
|
7
|
+
export { CircularProgressBarComponent } from './circularprogressbar/circular-progressbar.component';
|
|
9
8
|
export { ProgressBarModule } from './progressbar.module';
|
|
9
|
+
export { CircularProgressbarCenterTemplateDirective } from './circularprogressbar/center-template.directive';
|
|
@@ -9,7 +9,7 @@ export const packageMetadata = {
|
|
|
9
9
|
name: '@progress/kendo-angular-progressbar',
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
12
|
-
publishDate:
|
|
12
|
+
publishDate: 1659373689,
|
|
13
13
|
version: '',
|
|
14
14
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
15
15
|
};
|
|
@@ -234,7 +234,7 @@ ProgressBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
|
|
|
234
234
|
</span>
|
|
235
235
|
<div
|
|
236
236
|
#progressStatus
|
|
237
|
-
class="k-
|
|
237
|
+
class="k-selected"
|
|
238
238
|
[class.k-complete]="isCompleted"
|
|
239
239
|
[ngStyle]="progressCssStyle"
|
|
240
240
|
[ngClass]="progressCssClass"
|
|
@@ -270,7 +270,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
270
270
|
</span>
|
|
271
271
|
<div
|
|
272
272
|
#progressStatus
|
|
273
|
-
class="k-
|
|
273
|
+
class="k-selected"
|
|
274
274
|
[class.k-complete]="isCompleted"
|
|
275
275
|
[ngStyle]="progressCssStyle"
|
|
276
276
|
[ngClass]="progressCssClass"
|
|
@@ -6,11 +6,11 @@ import { ChunkProgressBarComponent } from './chunk/chunk-progressbar.component';
|
|
|
6
6
|
import { NgModule } from '@angular/core';
|
|
7
7
|
import { CommonModule } from '@angular/common';
|
|
8
8
|
import { ProgressBarComponent } from './progressbar.component';
|
|
9
|
-
import { CircularProgressBar } from './circularprogressbar/circular-progressbar.component';
|
|
10
9
|
import { ResizeSensorModule } from '@progress/kendo-angular-common';
|
|
10
|
+
import { CircularProgressBarComponent } from './circularprogressbar/circular-progressbar.component';
|
|
11
11
|
import { CircularProgressbarCenterTemplateDirective } from './circularprogressbar/center-template.directive';
|
|
12
12
|
import * as i0 from "@angular/core";
|
|
13
|
-
const COMPONENT_DIRECTIVES = [ProgressBarComponent, ChunkProgressBarComponent,
|
|
13
|
+
const COMPONENT_DIRECTIVES = [ProgressBarComponent, ChunkProgressBarComponent, CircularProgressBarComponent, CircularProgressbarCenterTemplateDirective];
|
|
14
14
|
const MODULES = [CommonModule, ResizeSensorModule];
|
|
15
15
|
/**
|
|
16
16
|
* Represents the [NgModule]({{ site.data.urls.angular['ngmodules'] }})
|
|
@@ -46,7 +46,7 @@ const MODULES = [CommonModule, ResizeSensorModule];
|
|
|
46
46
|
export class ProgressBarModule {
|
|
47
47
|
}
|
|
48
48
|
ProgressBarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
49
|
-
ProgressBarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, declarations: [ProgressBarComponent, ChunkProgressBarComponent,
|
|
49
|
+
ProgressBarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, declarations: [ProgressBarComponent, ChunkProgressBarComponent, CircularProgressBarComponent, CircularProgressbarCenterTemplateDirective], imports: [CommonModule, ResizeSensorModule], exports: [ProgressBarComponent, ChunkProgressBarComponent, CircularProgressBarComponent, CircularProgressbarCenterTemplateDirective] });
|
|
50
50
|
ProgressBarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, imports: [MODULES] });
|
|
51
51
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, decorators: [{
|
|
52
52
|
type: NgModule,
|
|
@@ -7,10 +7,12 @@ import { isDevMode, Component, HostBinding, Input, EventEmitter, Output, ViewChi
|
|
|
7
7
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
8
8
|
import * as i1 from '@progress/kendo-angular-l10n';
|
|
9
9
|
import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
|
|
10
|
-
import
|
|
10
|
+
import * as i2$1 from '@progress/kendo-angular-common';
|
|
11
|
+
import { hasObservers, isChanged, ResizeSensorModule } from '@progress/kendo-angular-common';
|
|
11
12
|
import * as i2 from '@angular/common';
|
|
12
13
|
import { CommonModule } from '@angular/common';
|
|
13
14
|
import { Subscription } from 'rxjs';
|
|
15
|
+
import { take } from 'rxjs/operators';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* @hidden
|
|
@@ -19,7 +21,7 @@ const packageMetadata = {
|
|
|
19
21
|
name: '@progress/kendo-angular-progressbar',
|
|
20
22
|
productName: 'Kendo UI for Angular',
|
|
21
23
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
22
|
-
publishDate:
|
|
24
|
+
publishDate: 1659373689,
|
|
23
25
|
version: '',
|
|
24
26
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning'
|
|
25
27
|
};
|
|
@@ -128,6 +130,12 @@ const removeProgressBarStyles = (props, renderer) => {
|
|
|
128
130
|
renderer[prop.method](prop.el, prop.attr);
|
|
129
131
|
});
|
|
130
132
|
};
|
|
133
|
+
/**
|
|
134
|
+
* @hidden
|
|
135
|
+
*/
|
|
136
|
+
const hasElementSize = (element) => {
|
|
137
|
+
return element.style.width && element.style.height;
|
|
138
|
+
};
|
|
131
139
|
|
|
132
140
|
/**
|
|
133
141
|
* @hidden
|
|
@@ -280,7 +288,7 @@ class ProgressBarBase {
|
|
|
280
288
|
}
|
|
281
289
|
}
|
|
282
290
|
ProgressBarBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarBase, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
283
|
-
ProgressBarBase.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ProgressBarBase, selector: "ng-component", inputs: { max: "max", min: "min", value: "value", orientation: "orientation", disabled: "disabled", reverse: "reverse", indeterminate: "indeterminate" }, host: { properties: { "class.k-widget": "this.widgetClasses", "class.k-progressbar": "this.widgetClasses", "class.k-progressbar-horizontal": "this.isHorizontal", "class.k-progressbar-vertical": "this.isVertical", "class.k-
|
|
291
|
+
ProgressBarBase.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: ProgressBarBase, selector: "ng-component", inputs: { max: "max", min: "min", value: "value", orientation: "orientation", disabled: "disabled", reverse: "reverse", indeterminate: "indeterminate" }, host: { properties: { "class.k-widget": "this.widgetClasses", "class.k-progressbar": "this.widgetClasses", "class.k-progressbar-horizontal": "this.isHorizontal", "class.k-progressbar-vertical": "this.isVertical", "class.k-disabled": "this.disabledClass", "class.k-progressbar-reverse": "this.reverseClass", "class.k-progressbar-indeterminate": "this.indeterminateClass", "attr.dir": "this.dirAttribute", "attr.role": "this.roleAttribute", "attr.aria-valuemin": "this.ariaMinAttribute", "attr.aria-valuemax": "this.ariaMaxAttribute", "attr.aria-valuenow": "this.ariaValueAttribute" } }, usesOnChanges: true, ngImport: i0, template: '', isInline: true });
|
|
284
292
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarBase, decorators: [{
|
|
285
293
|
type: Component,
|
|
286
294
|
args: [{
|
|
@@ -300,7 +308,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
300
308
|
args: ['class.k-progressbar-vertical']
|
|
301
309
|
}], disabledClass: [{
|
|
302
310
|
type: HostBinding,
|
|
303
|
-
args: ['class.k-
|
|
311
|
+
args: ['class.k-disabled']
|
|
304
312
|
}], reverseClass: [{
|
|
305
313
|
type: HostBinding,
|
|
306
314
|
args: ['class.k-progressbar-reverse']
|
|
@@ -562,7 +570,7 @@ ProgressBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
|
|
|
562
570
|
</span>
|
|
563
571
|
<div
|
|
564
572
|
#progressStatus
|
|
565
|
-
class="k-
|
|
573
|
+
class="k-selected"
|
|
566
574
|
[class.k-complete]="isCompleted"
|
|
567
575
|
[ngStyle]="progressCssStyle"
|
|
568
576
|
[ngClass]="progressCssClass"
|
|
@@ -598,7 +606,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
598
606
|
</span>
|
|
599
607
|
<div
|
|
600
608
|
#progressStatus
|
|
601
|
-
class="k-
|
|
609
|
+
class="k-selected"
|
|
602
610
|
[class.k-complete]="isCompleted"
|
|
603
611
|
[ngStyle]="progressCssStyle"
|
|
604
612
|
[ngClass]="progressCssClass"
|
|
@@ -729,7 +737,7 @@ ChunkProgressBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.
|
|
|
729
737
|
<li class="k-item" *ngFor="let chunk of chunks; let i = index;"
|
|
730
738
|
[class.k-first]="i === 0"
|
|
731
739
|
[class.k-last]="i === chunkCount - 1"
|
|
732
|
-
[class.k-
|
|
740
|
+
[class.k-selected]="chunk"
|
|
733
741
|
[ngClass]="chunk ? progressCssClass : emptyCssClass"
|
|
734
742
|
[ngStyle]="chunk ? progressCssStyle : emptyCssStyle"
|
|
735
743
|
[style.width]="orientationStyles.width"
|
|
@@ -748,7 +756,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
748
756
|
<li class="k-item" *ngFor="let chunk of chunks; let i = index;"
|
|
749
757
|
[class.k-first]="i === 0"
|
|
750
758
|
[class.k-last]="i === chunkCount - 1"
|
|
751
|
-
[class.k-
|
|
759
|
+
[class.k-selected]="chunk"
|
|
752
760
|
[ngClass]="chunk ? progressCssClass : emptyCssClass"
|
|
753
761
|
[ngStyle]="chunk ? progressCssStyle : emptyCssStyle"
|
|
754
762
|
[style.width]="orientationStyles.width"
|
|
@@ -794,12 +802,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
794
802
|
}]
|
|
795
803
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
|
796
804
|
|
|
805
|
+
const DEFAULT_SURFACE_SIZE = 200;
|
|
797
806
|
/**
|
|
798
807
|
* Represents the [Kendo UI Circular ProgressBar component for Angular]({% slug circular_progressbar %}).
|
|
799
808
|
*
|
|
800
809
|
* @example
|
|
801
810
|
* ```ts-preview
|
|
802
|
-
* _@Component({
|
|
811
|
+
* _@Component({
|
|
803
812
|
* selector: 'my-app',
|
|
804
813
|
* template: `
|
|
805
814
|
* <kendo-circularprogressbar [value]="value"></kendo-circularprogressbar>
|
|
@@ -810,20 +819,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
810
819
|
* }
|
|
811
820
|
* ```
|
|
812
821
|
*/
|
|
813
|
-
class
|
|
814
|
-
constructor(renderer, cdr, localizationService, element) {
|
|
822
|
+
class CircularProgressBarComponent {
|
|
823
|
+
constructor(renderer, cdr, localizationService, element, zone) {
|
|
815
824
|
this.renderer = renderer;
|
|
816
825
|
this.cdr = cdr;
|
|
817
826
|
this.localizationService = localizationService;
|
|
818
827
|
this.element = element;
|
|
828
|
+
this.zone = zone;
|
|
819
829
|
this.hostClasses = true;
|
|
820
|
-
this.WrapperSize = '200px';
|
|
821
830
|
/**
|
|
822
831
|
* Indicates whether an animation will be played on value changes.
|
|
823
832
|
*
|
|
824
|
-
* @default
|
|
833
|
+
* @default false
|
|
825
834
|
*/
|
|
826
|
-
this.animation =
|
|
835
|
+
this.animation = false;
|
|
827
836
|
/**
|
|
828
837
|
* The opacity of the value arc.
|
|
829
838
|
* @default 1
|
|
@@ -903,10 +912,8 @@ class CircularProgressBar {
|
|
|
903
912
|
this.initProgressArc();
|
|
904
913
|
}
|
|
905
914
|
ngOnChanges(changes) {
|
|
906
|
-
const
|
|
907
|
-
|
|
908
|
-
const isValueSecondChange = !changes.value.firstChange;
|
|
909
|
-
if (isValueChanged && isProgressArcCreated && isValueSecondChange) {
|
|
915
|
+
const skipFirstChange = true;
|
|
916
|
+
if (isChanged('value', changes, skipFirstChange) && this.progress) {
|
|
910
917
|
if (this.animation) {
|
|
911
918
|
this.progressbarAnimation();
|
|
912
919
|
}
|
|
@@ -926,6 +933,15 @@ class CircularProgressBar {
|
|
|
926
933
|
ngOnDestroy() {
|
|
927
934
|
this.subscriptions.unsubscribe();
|
|
928
935
|
}
|
|
936
|
+
/**
|
|
937
|
+
* @hidden
|
|
938
|
+
*/
|
|
939
|
+
onResize(_event) {
|
|
940
|
+
this.setStyles();
|
|
941
|
+
const value = this.animation ? this.internalValue : this.value;
|
|
942
|
+
this.calculateProgress(value);
|
|
943
|
+
this.updateCenterTemplate(value);
|
|
944
|
+
}
|
|
929
945
|
initProgressArc() {
|
|
930
946
|
this.setStyles();
|
|
931
947
|
if (this.indeterminate) {
|
|
@@ -945,7 +961,10 @@ class CircularProgressBar {
|
|
|
945
961
|
if (this.progressColor) {
|
|
946
962
|
this.updateProgressColor(value);
|
|
947
963
|
}
|
|
948
|
-
|
|
964
|
+
// needed when we have *ngIf inside the template to render different content depending on some condition
|
|
965
|
+
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
966
|
+
this.updateCenterTemplate(value + this.min);
|
|
967
|
+
});
|
|
949
968
|
const progressArc = this.progress.nativeElement;
|
|
950
969
|
const radius = this.progress.nativeElement.r.baseVal.value;
|
|
951
970
|
const circumference = Math.PI * (radius * 2);
|
|
@@ -960,11 +979,11 @@ class CircularProgressBar {
|
|
|
960
979
|
progressbarAnimation() {
|
|
961
980
|
const forwardProgress = {
|
|
962
981
|
isOngoing: this.internalValue > this.value - this.min,
|
|
963
|
-
isPositive: this.value
|
|
982
|
+
isPositive: this.value >= this.previousValue
|
|
964
983
|
};
|
|
965
984
|
const backwardProgress = {
|
|
966
985
|
isOngoing: this.internalValue < this.value - this.min,
|
|
967
|
-
isNegative: this.value
|
|
986
|
+
isNegative: this.value <= this.previousValue
|
|
968
987
|
};
|
|
969
988
|
if (forwardProgress.isOngoing && forwardProgress.isPositive ||
|
|
970
989
|
backwardProgress.isOngoing && backwardProgress.isNegative) {
|
|
@@ -985,8 +1004,18 @@ class CircularProgressBar {
|
|
|
985
1004
|
setStyles() {
|
|
986
1005
|
const progressArc = this.progress.nativeElement;
|
|
987
1006
|
const scale = this.scale.nativeElement;
|
|
1007
|
+
const surface = this.surface.nativeElement;
|
|
988
1008
|
const element = this.element.nativeElement;
|
|
989
|
-
|
|
1009
|
+
let elWidth = element.getBoundingClientRect().width;
|
|
1010
|
+
;
|
|
1011
|
+
if (!hasElementSize(element)) {
|
|
1012
|
+
const surfaceSize = [
|
|
1013
|
+
{ method: 'setStyle', el: surface, attr: 'width', attrValue: `${DEFAULT_SURFACE_SIZE}px` },
|
|
1014
|
+
{ method: 'setStyle', el: surface, attr: 'height', attrValue: `${DEFAULT_SURFACE_SIZE}px` }
|
|
1015
|
+
];
|
|
1016
|
+
elWidth = DEFAULT_SURFACE_SIZE;
|
|
1017
|
+
setProgressBarStyles(surfaceSize, this.renderer);
|
|
1018
|
+
}
|
|
990
1019
|
const attributesArray = [
|
|
991
1020
|
{ method: 'setAttribute', el: progressArc, attr: 'r', attrValue: (elWidth / 2) - 10 },
|
|
992
1021
|
{ method: 'setAttribute', el: progressArc, attr: 'cx', attrValue: (elWidth / 2) },
|
|
@@ -1004,16 +1033,21 @@ class CircularProgressBar {
|
|
|
1004
1033
|
// the indeterminate state wont work as the `k-circular-progressbar-arc` has a transform: rotate(-90deg) which is
|
|
1005
1034
|
// interfering with the svg animation as the animateTransform brings its own transform: rotate()
|
|
1006
1035
|
// This will be like this until the themes release a new version, bringing a new class `k-circular-progressbar-indeterminate-arc`
|
|
1007
|
-
// containing only the necassery CSS styles and we will switch between them when the state of the progressbar is switched.
|
|
1036
|
+
// containing only the necassery CSS styles and we will switch between them when the state of the progressbar is switched.
|
|
1008
1037
|
this.calculateProgress(this.value - this.min);
|
|
1009
1038
|
const rotate = this.rtl ? { from: 360, to: 0 } : { from: 0, to: 360 };
|
|
1010
|
-
|
|
1039
|
+
let color;
|
|
1040
|
+
if (!this.progressColor) {
|
|
1041
|
+
color = getComputedStyle(progressArc).stroke;
|
|
1042
|
+
}
|
|
1011
1043
|
const indeterminateStyles = [
|
|
1012
1044
|
{ method: 'setStyle', el: progressArc, attr: 'transform-origin', attrValue: 'center' },
|
|
1013
1045
|
{ method: 'setStyle', el: progressArc, attr: 'fill', attrValue: 'none' },
|
|
1014
|
-
{ method: 'setStyle', el: progressArc, attr: 'stroke-linecap', attrValue: 'round' }
|
|
1046
|
+
{ method: 'setStyle', el: progressArc, attr: 'stroke-linecap', attrValue: 'round' },
|
|
1047
|
+
{ method: 'setStyle', el: progressArc, attr: 'stroke', attrValue: color ? color : this.currentColor }
|
|
1015
1048
|
];
|
|
1016
1049
|
setProgressBarStyles(indeterminateStyles, this.renderer);
|
|
1050
|
+
this.renderer.removeClass(progressArc, 'k-circular-progressbar-arc');
|
|
1017
1051
|
progressArc.innerHTML = `<animateTransform attributeName="transform" type="rotate" from="${rotate.from} 0 0" to="${rotate.to} 0 0" dur="1s" repeatCount="indefinite" />`;
|
|
1018
1052
|
}
|
|
1019
1053
|
else {
|
|
@@ -1041,11 +1075,22 @@ class CircularProgressBar {
|
|
|
1041
1075
|
}
|
|
1042
1076
|
positionLabel() {
|
|
1043
1077
|
const labelEl = this.labelElement.nativeElement;
|
|
1044
|
-
const
|
|
1045
|
-
const
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1078
|
+
const element = this.element.nativeElement;
|
|
1079
|
+
const surface = this.surface.nativeElement;
|
|
1080
|
+
let elWidth;
|
|
1081
|
+
let elHeight;
|
|
1082
|
+
if (!hasElementSize(element)) {
|
|
1083
|
+
const surfaceSize = surface.getBoundingClientRect();
|
|
1084
|
+
elWidth = surfaceSize.width;
|
|
1085
|
+
elHeight = surfaceSize.height;
|
|
1086
|
+
}
|
|
1087
|
+
else {
|
|
1088
|
+
const elementSize = element.getBoundingClientRect();
|
|
1089
|
+
elWidth = elementSize.width;
|
|
1090
|
+
elHeight = elementSize.height;
|
|
1091
|
+
}
|
|
1092
|
+
const left = (elWidth / 2) - (labelEl.offsetWidth / 2);
|
|
1093
|
+
const top = (elHeight / 2) - (labelEl.offsetHeight / 2);
|
|
1049
1094
|
const labelCalculations = [
|
|
1050
1095
|
{ method: 'setStyle', el: labelEl, attr: 'left', attrValue: `${left}px` },
|
|
1051
1096
|
{ method: 'setStyle', el: labelEl, attr: 'top', attrValue: `${top}px` }
|
|
@@ -1065,7 +1110,7 @@ class CircularProgressBar {
|
|
|
1065
1110
|
for (let i = 0; i < this.progressColor.length; i++) {
|
|
1066
1111
|
let from = this.progressColor[i].from;
|
|
1067
1112
|
let to = this.progressColor[i].to;
|
|
1068
|
-
if (value >= from && value
|
|
1113
|
+
if (value >= from && value <= to || (!from && value <= to)) {
|
|
1069
1114
|
this.renderer.setStyle(progressArc, 'stroke', this.progressColor[i].color);
|
|
1070
1115
|
break;
|
|
1071
1116
|
}
|
|
@@ -1079,9 +1124,9 @@ class CircularProgressBar {
|
|
|
1079
1124
|
if (isDevMode()) {
|
|
1080
1125
|
switch (type) {
|
|
1081
1126
|
case 'value > max':
|
|
1082
|
-
throw new Error('The value of the
|
|
1127
|
+
throw new Error('The value of the CircularProgressbar cannot exceed the max value');
|
|
1083
1128
|
case 'value < min':
|
|
1084
|
-
throw new Error('The value of the
|
|
1129
|
+
throw new Error('The value of the CircularProgressbar cannot be lower than the min value');
|
|
1085
1130
|
case 'max < min':
|
|
1086
1131
|
throw new Error('The min value cannot be higher than the max value');
|
|
1087
1132
|
default:
|
|
@@ -1103,16 +1148,16 @@ class CircularProgressBar {
|
|
|
1103
1148
|
}
|
|
1104
1149
|
}
|
|
1105
1150
|
}
|
|
1106
|
-
|
|
1107
|
-
|
|
1151
|
+
CircularProgressBarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CircularProgressBarComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i1.LocalizationService }, { token: i0.ElementRef }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
1152
|
+
CircularProgressBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: CircularProgressBarComponent, selector: "kendo-circularprogressbar", inputs: { value: "value", max: "max", min: "min", animation: "animation", opacity: "opacity", indeterminate: "indeterminate", progressColor: "progressColor" }, outputs: { animationEnd: "animationEnd" }, host: { properties: { "class.k-circular-progressbar": "this.hostClasses" } }, providers: [
|
|
1108
1153
|
LocalizationService,
|
|
1109
1154
|
{
|
|
1110
1155
|
provide: L10N_PREFIX,
|
|
1111
1156
|
useValue: 'kendo.circularprogressbar'
|
|
1112
1157
|
}
|
|
1113
|
-
], queries: [{ propertyName: "centerTemplate", first: true, predicate: CircularProgressbarCenterTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "progress", first: true, predicate: ["progress"], descendants: true }, { propertyName: "scale", first: true, predicate: ["scale"], descendants: true }, { propertyName: "labelElement", first: true, predicate: ["label"], descendants: true }, { propertyName: "
|
|
1114
|
-
<div class="k-circular-progressbar-surface">
|
|
1115
|
-
<div
|
|
1158
|
+
], queries: [{ propertyName: "centerTemplate", first: true, predicate: CircularProgressbarCenterTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "progress", first: true, predicate: ["progress"], descendants: true }, { propertyName: "scale", first: true, predicate: ["scale"], descendants: true }, { propertyName: "labelElement", first: true, predicate: ["label"], descendants: true }, { propertyName: "surface", first: true, predicate: ["surface"], descendants: true }], exportAs: ["kendoCircularProgressBar"], usesOnChanges: true, ngImport: i0, template: `
|
|
1159
|
+
<div #surface class="k-circular-progressbar-surface">
|
|
1160
|
+
<div>
|
|
1116
1161
|
<svg #svg>
|
|
1117
1162
|
<g>
|
|
1118
1163
|
<circle class="k-circular-progressbar-scale" #scale stroke-width="9.5"></circle>
|
|
@@ -1124,15 +1169,16 @@ CircularProgressBar.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", ve
|
|
|
1124
1169
|
</div>
|
|
1125
1170
|
</div>
|
|
1126
1171
|
</div>
|
|
1127
|
-
|
|
1128
|
-
|
|
1172
|
+
<kendo-resize-sensor (resize)="onResize($event)"></kendo-resize-sensor>
|
|
1173
|
+
`, isInline: true, components: [{ type: i2$1.ResizeSensorComponent, selector: "kendo-resize-sensor", inputs: ["rateLimit"], outputs: ["resize"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }] });
|
|
1174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CircularProgressBarComponent, decorators: [{
|
|
1129
1175
|
type: Component,
|
|
1130
1176
|
args: [{
|
|
1131
1177
|
exportAs: 'kendoCircularProgressBar',
|
|
1132
1178
|
selector: 'kendo-circularprogressbar',
|
|
1133
1179
|
template: `
|
|
1134
|
-
<div class="k-circular-progressbar-surface">
|
|
1135
|
-
<div
|
|
1180
|
+
<div #surface class="k-circular-progressbar-surface">
|
|
1181
|
+
<div>
|
|
1136
1182
|
<svg #svg>
|
|
1137
1183
|
<g>
|
|
1138
1184
|
<circle class="k-circular-progressbar-scale" #scale stroke-width="9.5"></circle>
|
|
@@ -1144,6 +1190,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1144
1190
|
</div>
|
|
1145
1191
|
</div>
|
|
1146
1192
|
</div>
|
|
1193
|
+
<kendo-resize-sensor (resize)="onResize($event)"></kendo-resize-sensor>
|
|
1147
1194
|
`, providers: [
|
|
1148
1195
|
LocalizationService,
|
|
1149
1196
|
{
|
|
@@ -1152,15 +1199,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1152
1199
|
}
|
|
1153
1200
|
]
|
|
1154
1201
|
}]
|
|
1155
|
-
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }, { type: i0.ElementRef }]; }, propDecorators: { hostClasses: [{
|
|
1202
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { hostClasses: [{
|
|
1156
1203
|
type: HostBinding,
|
|
1157
1204
|
args: ['class.k-circular-progressbar']
|
|
1158
|
-
}], WrapperSize: [{
|
|
1159
|
-
type: HostBinding,
|
|
1160
|
-
args: ['style.width']
|
|
1161
|
-
}, {
|
|
1162
|
-
type: HostBinding,
|
|
1163
|
-
args: ['style.height']
|
|
1164
1205
|
}], value: [{
|
|
1165
1206
|
type: Input
|
|
1166
1207
|
}], max: [{
|
|
@@ -1186,15 +1227,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1186
1227
|
}], labelElement: [{
|
|
1187
1228
|
type: ViewChild,
|
|
1188
1229
|
args: ["label"]
|
|
1189
|
-
}],
|
|
1230
|
+
}], surface: [{
|
|
1190
1231
|
type: ViewChild,
|
|
1191
|
-
args: ["
|
|
1232
|
+
args: ["surface"]
|
|
1192
1233
|
}], centerTemplate: [{
|
|
1193
1234
|
type: ContentChild,
|
|
1194
1235
|
args: [CircularProgressbarCenterTemplateDirective]
|
|
1195
1236
|
}] } });
|
|
1196
1237
|
|
|
1197
|
-
const COMPONENT_DIRECTIVES = [ProgressBarComponent, ChunkProgressBarComponent,
|
|
1238
|
+
const COMPONENT_DIRECTIVES = [ProgressBarComponent, ChunkProgressBarComponent, CircularProgressBarComponent, CircularProgressbarCenterTemplateDirective];
|
|
1198
1239
|
const MODULES = [CommonModule, ResizeSensorModule];
|
|
1199
1240
|
/**
|
|
1200
1241
|
* Represents the [NgModule]({{ site.data.urls.angular['ngmodules'] }})
|
|
@@ -1230,7 +1271,7 @@ const MODULES = [CommonModule, ResizeSensorModule];
|
|
|
1230
1271
|
class ProgressBarModule {
|
|
1231
1272
|
}
|
|
1232
1273
|
ProgressBarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1233
|
-
ProgressBarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, declarations: [ProgressBarComponent, ChunkProgressBarComponent,
|
|
1274
|
+
ProgressBarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, declarations: [ProgressBarComponent, ChunkProgressBarComponent, CircularProgressBarComponent, CircularProgressbarCenterTemplateDirective], imports: [CommonModule, ResizeSensorModule], exports: [ProgressBarComponent, ChunkProgressBarComponent, CircularProgressBarComponent, CircularProgressbarCenterTemplateDirective] });
|
|
1234
1275
|
ProgressBarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, imports: [MODULES] });
|
|
1235
1276
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, decorators: [{
|
|
1236
1277
|
type: NgModule,
|
|
@@ -1245,5 +1286,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
1245
1286
|
* Generated bundle index. Do not edit.
|
|
1246
1287
|
*/
|
|
1247
1288
|
|
|
1248
|
-
export { ChunkProgressBarComponent,
|
|
1289
|
+
export { ChunkProgressBarComponent, CircularProgressBarComponent, CircularProgressbarCenterTemplateDirective, ProgressBarComponent, ProgressBarModule };
|
|
1249
1290
|
|
package/main.d.ts
CHANGED
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
export { ProgressBarComponent } from './progressbar.component';
|
|
6
6
|
export { ChunkProgressBarComponent } from './chunk/chunk-progressbar.component';
|
|
7
|
-
export {
|
|
8
|
-
export { CircularProgressbarCenterTemplateDirective } from './circularprogressbar/center-template.directive';
|
|
7
|
+
export { CircularProgressBarComponent } from './circularprogressbar/circular-progressbar.component';
|
|
9
8
|
export { ProgressBarOrientation } from './types/progressbar-orientation';
|
|
10
9
|
export { LabelSettings } from './types/label-settings.interface';
|
|
11
10
|
export { LabelPosition } from './types/label-position';
|
|
@@ -13,4 +12,5 @@ export { LabelFn } from './types/label-fn-type';
|
|
|
13
12
|
export { LabelType } from './types/label-type';
|
|
14
13
|
export { ProgressBarAnimation } from './types/progressbar-animation.interface';
|
|
15
14
|
export { ProgressBarModule } from './progressbar.module';
|
|
15
|
+
export { CircularProgressbarCenterTemplateDirective } from './circularprogressbar/center-template.directive';
|
|
16
16
|
export { ProgressColor } from './circularprogressbar/models/circular-progressbar-progress-color-interface';
|
package/package.json
CHANGED
package/progressbar.module.d.ts
CHANGED
|
@@ -42,6 +42,6 @@ import * as i6 from "@progress/kendo-angular-common";
|
|
|
42
42
|
*/
|
|
43
43
|
export declare class ProgressBarModule {
|
|
44
44
|
static ɵfac: i0.ɵɵFactoryDeclaration<ProgressBarModule, never>;
|
|
45
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<ProgressBarModule, [typeof i1.ProgressBarComponent, typeof i2.ChunkProgressBarComponent, typeof i3.
|
|
45
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<ProgressBarModule, [typeof i1.ProgressBarComponent, typeof i2.ChunkProgressBarComponent, typeof i3.CircularProgressBarComponent, typeof i4.CircularProgressbarCenterTemplateDirective], [typeof i5.CommonModule, typeof i6.ResizeSensorModule], [typeof i1.ProgressBarComponent, typeof i2.ChunkProgressBarComponent, typeof i3.CircularProgressBarComponent, typeof i4.CircularProgressbarCenterTemplateDirective]>;
|
|
46
46
|
static ɵinj: i0.ɵɵInjectorDeclaration<ProgressBarModule>;
|
|
47
47
|
}
|