@progress/kendo-angular-progressbar 3.0.0 → 3.1.0-dev.202208010920
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/center-template.directive.d.ts +15 -0
- package/circularprogressbar/circular-progressbar.component.d.ts +118 -0
- package/circularprogressbar/models/center-template-context.interface.d.ts +17 -0
- package/circularprogressbar/models/circular-progressbar-progress-color-interface.d.ts +21 -0
- package/common/util.d.ts +9 -1
- package/esm2015/chunk/chunk-progressbar.component.js +2 -2
- package/esm2015/circularprogressbar/center-template.directive.js +22 -0
- package/esm2015/circularprogressbar/circular-progressbar.component.js +433 -0
- package/esm2015/circularprogressbar/models/center-template-context.interface.js +5 -0
- package/esm2015/circularprogressbar/models/circular-progressbar-progress-color-interface.js +8 -0
- package/esm2015/common/progressbar-base.js +2 -2
- package/esm2015/common/util.js +16 -0
- package/esm2015/main.js +2 -0
- package/esm2015/package-metadata.js +1 -1
- package/esm2015/progressbar.component.js +2 -2
- package/esm2015/progressbar.module.js +6 -3
- package/fesm2015/kendo-angular-progressbar.js +466 -13
- package/main.d.ts +3 -0
- package/package.json +6 -5
- package/progressbar.module.d.ts +5 -2
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
|
-
import { isDevMode, Component, HostBinding, Input, EventEmitter, Output, ViewChild, NgModule } from '@angular/core';
|
|
6
|
+
import { isDevMode, Component, HostBinding, Input, EventEmitter, Output, ViewChild, Directive, ContentChild, NgModule } from '@angular/core';
|
|
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';
|
|
14
|
+
import { Subscription, take } from 'rxjs';
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* @hidden
|
|
@@ -18,7 +20,7 @@ const packageMetadata = {
|
|
|
18
20
|
name: '@progress/kendo-angular-progressbar',
|
|
19
21
|
productName: 'Kendo UI for Angular',
|
|
20
22
|
productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
|
|
21
|
-
publishDate:
|
|
23
|
+
publishDate: 1659345594,
|
|
22
24
|
version: '',
|
|
23
25
|
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'
|
|
24
26
|
};
|
|
@@ -111,6 +113,22 @@ const stopCurrentAnimation = (changes) => {
|
|
|
111
113
|
const hasAnimation = isAnimationChanged && changes.animation.currentValue;
|
|
112
114
|
return isAnimationChanged && !hasAnimation;
|
|
113
115
|
};
|
|
116
|
+
/**
|
|
117
|
+
* @hidden
|
|
118
|
+
*/
|
|
119
|
+
const setProgressBarStyles = (props, renderer) => {
|
|
120
|
+
props.forEach(prop => {
|
|
121
|
+
renderer[prop.method](prop.el, prop.attr, `${prop.attrValue}`);
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* @hidden
|
|
126
|
+
*/
|
|
127
|
+
const removeProgressBarStyles = (props, renderer) => {
|
|
128
|
+
props.forEach(prop => {
|
|
129
|
+
renderer[prop.method](prop.el, prop.attr);
|
|
130
|
+
});
|
|
131
|
+
};
|
|
114
132
|
|
|
115
133
|
/**
|
|
116
134
|
* @hidden
|
|
@@ -263,7 +281,7 @@ class ProgressBarBase {
|
|
|
263
281
|
}
|
|
264
282
|
}
|
|
265
283
|
ProgressBarBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarBase, deps: [{ token: i1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
266
|
-
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-
|
|
284
|
+
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 });
|
|
267
285
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarBase, decorators: [{
|
|
268
286
|
type: Component,
|
|
269
287
|
args: [{
|
|
@@ -283,7 +301,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
283
301
|
args: ['class.k-progressbar-vertical']
|
|
284
302
|
}], disabledClass: [{
|
|
285
303
|
type: HostBinding,
|
|
286
|
-
args: ['class.k-
|
|
304
|
+
args: ['class.k-disabled']
|
|
287
305
|
}], reverseClass: [{
|
|
288
306
|
type: HostBinding,
|
|
289
307
|
args: ['class.k-progressbar-reverse']
|
|
@@ -545,7 +563,7 @@ ProgressBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
|
|
|
545
563
|
</span>
|
|
546
564
|
<div
|
|
547
565
|
#progressStatus
|
|
548
|
-
class="k-
|
|
566
|
+
class="k-selected"
|
|
549
567
|
[class.k-complete]="isCompleted"
|
|
550
568
|
[ngStyle]="progressCssStyle"
|
|
551
569
|
[ngClass]="progressCssClass"
|
|
@@ -581,7 +599,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
581
599
|
</span>
|
|
582
600
|
<div
|
|
583
601
|
#progressStatus
|
|
584
|
-
class="k-
|
|
602
|
+
class="k-selected"
|
|
585
603
|
[class.k-complete]="isCompleted"
|
|
586
604
|
[ngStyle]="progressCssStyle"
|
|
587
605
|
[ngClass]="progressCssClass"
|
|
@@ -712,7 +730,7 @@ ChunkProgressBarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.
|
|
|
712
730
|
<li class="k-item" *ngFor="let chunk of chunks; let i = index;"
|
|
713
731
|
[class.k-first]="i === 0"
|
|
714
732
|
[class.k-last]="i === chunkCount - 1"
|
|
715
|
-
[class.k-
|
|
733
|
+
[class.k-selected]="chunk"
|
|
716
734
|
[ngClass]="chunk ? progressCssClass : emptyCssClass"
|
|
717
735
|
[ngStyle]="chunk ? progressCssStyle : emptyCssStyle"
|
|
718
736
|
[style.width]="orientationStyles.width"
|
|
@@ -731,7 +749,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
731
749
|
<li class="k-item" *ngFor="let chunk of chunks; let i = index;"
|
|
732
750
|
[class.k-first]="i === 0"
|
|
733
751
|
[class.k-last]="i === chunkCount - 1"
|
|
734
|
-
[class.k-
|
|
752
|
+
[class.k-selected]="chunk"
|
|
735
753
|
[ngClass]="chunk ? progressCssClass : emptyCssClass"
|
|
736
754
|
[ngStyle]="chunk ? progressCssStyle : emptyCssStyle"
|
|
737
755
|
[style.width]="orientationStyles.width"
|
|
@@ -760,8 +778,443 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
760
778
|
type: Input
|
|
761
779
|
}] } });
|
|
762
780
|
|
|
763
|
-
|
|
764
|
-
|
|
781
|
+
/**
|
|
782
|
+
* A directive that selects a template within the <kendo-circularprogessbar> component which will be used for the center template. ([see example]({% slug %})).
|
|
783
|
+
*/
|
|
784
|
+
class CircularProgressbarCenterTemplateDirective {
|
|
785
|
+
constructor(templateRef) {
|
|
786
|
+
this.templateRef = templateRef;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
CircularProgressbarCenterTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CircularProgressbarCenterTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
790
|
+
CircularProgressbarCenterTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.16", type: CircularProgressbarCenterTemplateDirective, selector: "[kendoCircularProgressbarCenterTemplate]", ngImport: i0 });
|
|
791
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CircularProgressbarCenterTemplateDirective, decorators: [{
|
|
792
|
+
type: Directive,
|
|
793
|
+
args: [{
|
|
794
|
+
selector: '[kendoCircularProgressbarCenterTemplate]'
|
|
795
|
+
}]
|
|
796
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; } });
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* Represents the [Kendo UI Circular ProgressBar component for Angular]({% slug circular_progressbar %}).
|
|
800
|
+
*
|
|
801
|
+
* @example
|
|
802
|
+
* ```ts-preview
|
|
803
|
+
* _@Component({don’t
|
|
804
|
+
* selector: 'my-app',
|
|
805
|
+
* template: `
|
|
806
|
+
* <kendo-circularprogressbar [value]="value"></kendo-circularprogressbar>
|
|
807
|
+
* `
|
|
808
|
+
* })
|
|
809
|
+
* class AppComponent {
|
|
810
|
+
* public value: number = 50;
|
|
811
|
+
* }
|
|
812
|
+
* ```
|
|
813
|
+
*/
|
|
814
|
+
class CircularProgressBarComponent {
|
|
815
|
+
constructor(renderer, cdr, localizationService, element, zone) {
|
|
816
|
+
this.renderer = renderer;
|
|
817
|
+
this.cdr = cdr;
|
|
818
|
+
this.localizationService = localizationService;
|
|
819
|
+
this.element = element;
|
|
820
|
+
this.zone = zone;
|
|
821
|
+
this.hostClasses = true;
|
|
822
|
+
this.WrapperSize = '200px';
|
|
823
|
+
/**
|
|
824
|
+
* Indicates whether an animation will be played on value changes.
|
|
825
|
+
*
|
|
826
|
+
* @default false
|
|
827
|
+
*/
|
|
828
|
+
this.animation = false;
|
|
829
|
+
/**
|
|
830
|
+
* The opacity of the value arc.
|
|
831
|
+
* @default 1
|
|
832
|
+
*/
|
|
833
|
+
this.opacity = 1;
|
|
834
|
+
/**
|
|
835
|
+
* Fires when the animation which indicates the latest value change is completed.
|
|
836
|
+
*/
|
|
837
|
+
this.animationEnd = new EventEmitter();
|
|
838
|
+
this.centerTemplateContext = {};
|
|
839
|
+
this._indeterminate = false;
|
|
840
|
+
this._max = 100;
|
|
841
|
+
this._min = 0;
|
|
842
|
+
this._value = 0;
|
|
843
|
+
this.internalValue = 0;
|
|
844
|
+
this.subscriptions = new Subscription();
|
|
845
|
+
validatePackage(packageMetadata);
|
|
846
|
+
this.subscriptions.add(this.localizationService.changes.subscribe(this.rtlChange.bind(this)));
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* Sets the default value of the Circular Progressbar between `min` and `max`.
|
|
850
|
+
*
|
|
851
|
+
* @default 0
|
|
852
|
+
*/
|
|
853
|
+
set value(value) {
|
|
854
|
+
if (value > this.max) {
|
|
855
|
+
this.handleErrors('value > max');
|
|
856
|
+
}
|
|
857
|
+
if (value < this.min) {
|
|
858
|
+
this.handleErrors('value < min');
|
|
859
|
+
}
|
|
860
|
+
this.previousValue = this.value;
|
|
861
|
+
this._value = value;
|
|
862
|
+
}
|
|
863
|
+
get value() {
|
|
864
|
+
return this._value;
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* The maximum value which the Circular Progressbar can accept.
|
|
868
|
+
*
|
|
869
|
+
* @default 100
|
|
870
|
+
*/
|
|
871
|
+
set max(max) {
|
|
872
|
+
if (max < this.min) {
|
|
873
|
+
this.handleErrors('max < min');
|
|
874
|
+
}
|
|
875
|
+
this._max = max;
|
|
876
|
+
}
|
|
877
|
+
get max() {
|
|
878
|
+
return this._max;
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* The minimum value which the Circular Progressbar can accept.
|
|
882
|
+
*
|
|
883
|
+
* @default 0
|
|
884
|
+
*/
|
|
885
|
+
set min(min) {
|
|
886
|
+
if (min > this.max) {
|
|
887
|
+
this.handleErrors('max < min');
|
|
888
|
+
}
|
|
889
|
+
this._min = min;
|
|
890
|
+
}
|
|
891
|
+
get min() {
|
|
892
|
+
return this._min;
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Puts the Circular ProgressBar in indeterminate state.
|
|
896
|
+
* @default false
|
|
897
|
+
*/
|
|
898
|
+
set indeterminate(indeterminate) {
|
|
899
|
+
this._indeterminate = indeterminate;
|
|
900
|
+
}
|
|
901
|
+
get indeterminate() {
|
|
902
|
+
return this._indeterminate;
|
|
903
|
+
}
|
|
904
|
+
ngAfterViewInit() {
|
|
905
|
+
this.initProgressArc();
|
|
906
|
+
}
|
|
907
|
+
ngOnChanges(changes) {
|
|
908
|
+
const skipFirstChange = true;
|
|
909
|
+
if (isChanged('value', changes, skipFirstChange) && this.progress) {
|
|
910
|
+
if (this.animation) {
|
|
911
|
+
this.progressbarAnimation();
|
|
912
|
+
}
|
|
913
|
+
else {
|
|
914
|
+
const value = this.value - this.min;
|
|
915
|
+
this.internalValue = changes.value.currentValue;
|
|
916
|
+
this.calculateProgress(value);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
if (changes.opacity && this.progress) {
|
|
920
|
+
setProgressBarStyles([{ method: 'setAttribute', el: this.progress.nativeElement, attr: 'opacity', attrValue: this.opacity }], this.renderer);
|
|
921
|
+
}
|
|
922
|
+
if (changes.indeterminate && !changes.indeterminate.firstChange) {
|
|
923
|
+
this.indeterminateState();
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
ngOnDestroy() {
|
|
927
|
+
this.subscriptions.unsubscribe();
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* @hidden
|
|
931
|
+
*/
|
|
932
|
+
onResize(_event) {
|
|
933
|
+
this.setStyles();
|
|
934
|
+
const value = this.animation ? this.internalValue : this.value;
|
|
935
|
+
this.calculateProgress(value);
|
|
936
|
+
this.updateCenterTemplate(value);
|
|
937
|
+
}
|
|
938
|
+
initProgressArc() {
|
|
939
|
+
this.setStyles();
|
|
940
|
+
if (this.indeterminate) {
|
|
941
|
+
this.indeterminateState();
|
|
942
|
+
}
|
|
943
|
+
else {
|
|
944
|
+
if (!this.animation) {
|
|
945
|
+
const value = this.value - this.min;
|
|
946
|
+
this.calculateProgress(value);
|
|
947
|
+
}
|
|
948
|
+
else {
|
|
949
|
+
this.progressbarAnimation();
|
|
950
|
+
}
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
calculateProgress(value) {
|
|
954
|
+
if (this.progressColor) {
|
|
955
|
+
this.updateProgressColor(value);
|
|
956
|
+
}
|
|
957
|
+
// needed when we have *ngIf inside the template to render different content depending on some condition
|
|
958
|
+
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
959
|
+
this.updateCenterTemplate(value + this.min);
|
|
960
|
+
});
|
|
961
|
+
const progressArc = this.progress.nativeElement;
|
|
962
|
+
const radius = this.progress.nativeElement.r.baseVal.value;
|
|
963
|
+
const circumference = Math.PI * (radius * 2);
|
|
964
|
+
const dir = this.rtl ? circumference * -1 : circumference;
|
|
965
|
+
const strokeDashOffest = circumference - dir * (value / (this.max - this.min));
|
|
966
|
+
const progressCalculations = [
|
|
967
|
+
{ method: 'setStyle', el: progressArc, attr: 'strokeDasharray', attrValue: circumference },
|
|
968
|
+
{ method: 'setStyle', el: progressArc, attr: 'strokeDashoffset', attrValue: strokeDashOffest }
|
|
969
|
+
];
|
|
970
|
+
setProgressBarStyles(progressCalculations, this.renderer);
|
|
971
|
+
}
|
|
972
|
+
progressbarAnimation() {
|
|
973
|
+
const forwardProgress = {
|
|
974
|
+
isOngoing: this.internalValue > this.value - this.min,
|
|
975
|
+
isPositive: this.value >= this.previousValue
|
|
976
|
+
};
|
|
977
|
+
const backwardProgress = {
|
|
978
|
+
isOngoing: this.internalValue < this.value - this.min,
|
|
979
|
+
isNegative: this.value <= this.previousValue
|
|
980
|
+
};
|
|
981
|
+
if (forwardProgress.isOngoing && forwardProgress.isPositive ||
|
|
982
|
+
backwardProgress.isOngoing && backwardProgress.isNegative) {
|
|
983
|
+
return;
|
|
984
|
+
}
|
|
985
|
+
this.calculateProgress(this.internalValue);
|
|
986
|
+
const from = this.internalValue;
|
|
987
|
+
if (hasObservers(this.animationEnd)) {
|
|
988
|
+
this.animationEnd.emit({
|
|
989
|
+
from: from,
|
|
990
|
+
to: this.internalValue
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
// eslint-disable-next-line no-unused-expressions
|
|
994
|
+
forwardProgress.isPositive ? this.internalValue += 1 : this.internalValue -= 1;
|
|
995
|
+
requestAnimationFrame(this.progressbarAnimation.bind(this));
|
|
996
|
+
}
|
|
997
|
+
setStyles() {
|
|
998
|
+
const progressArc = this.progress.nativeElement;
|
|
999
|
+
const scale = this.scale.nativeElement;
|
|
1000
|
+
const element = this.element.nativeElement;
|
|
1001
|
+
const elWidth = element.getBoundingClientRect().width;
|
|
1002
|
+
const attributesArray = [
|
|
1003
|
+
{ method: 'setAttribute', el: progressArc, attr: 'r', attrValue: (elWidth / 2) - 10 },
|
|
1004
|
+
{ method: 'setAttribute', el: progressArc, attr: 'cx', attrValue: (elWidth / 2) },
|
|
1005
|
+
{ method: 'setAttribute', el: progressArc, attr: 'cy', attrValue: (elWidth / 2) },
|
|
1006
|
+
{ method: 'setAttribute', el: progressArc, attr: 'opacity', attrValue: this.opacity },
|
|
1007
|
+
{ method: 'setAttribute', el: scale, attr: 'r', attrValue: (elWidth / 2) - 10 },
|
|
1008
|
+
{ method: 'setAttribute', el: scale, attr: 'cx', attrValue: (elWidth / 2) },
|
|
1009
|
+
{ method: 'setAttribute', el: scale, attr: 'cy', attrValue: (elWidth / 2) }
|
|
1010
|
+
];
|
|
1011
|
+
setProgressBarStyles(attributesArray, this.renderer);
|
|
1012
|
+
}
|
|
1013
|
+
indeterminateState() {
|
|
1014
|
+
const progressArc = this.progress.nativeElement;
|
|
1015
|
+
if (this.indeterminate) {
|
|
1016
|
+
// the indeterminate state wont work as the `k-circular-progressbar-arc` has a transform: rotate(-90deg) which is
|
|
1017
|
+
// interfering with the svg animation as the animateTransform brings its own transform: rotate()
|
|
1018
|
+
// This will be like this until the themes release a new version, bringing a new class `k-circular-progressbar-indeterminate-arc`
|
|
1019
|
+
// containing only the necassery CSS styles and we will switch between them when the state of the progressbar is switched.
|
|
1020
|
+
this.calculateProgress(this.value - this.min);
|
|
1021
|
+
const rotate = this.rtl ? { from: 360, to: 0 } : { from: 0, to: 360 };
|
|
1022
|
+
let color;
|
|
1023
|
+
if (!this.progressColor) {
|
|
1024
|
+
color = getComputedStyle(progressArc).stroke;
|
|
1025
|
+
}
|
|
1026
|
+
const indeterminateStyles = [
|
|
1027
|
+
{ method: 'setStyle', el: progressArc, attr: 'transform-origin', attrValue: 'center' },
|
|
1028
|
+
{ method: 'setStyle', el: progressArc, attr: 'fill', attrValue: 'none' },
|
|
1029
|
+
{ method: 'setStyle', el: progressArc, attr: 'stroke-linecap', attrValue: 'round' },
|
|
1030
|
+
{ method: 'setStyle', el: progressArc, attr: 'stroke', attrValue: color ? color : this.currentColor }
|
|
1031
|
+
];
|
|
1032
|
+
setProgressBarStyles(indeterminateStyles, this.renderer);
|
|
1033
|
+
this.renderer.removeClass(progressArc, 'k-circular-progressbar-arc');
|
|
1034
|
+
progressArc.innerHTML = `<animateTransform attributeName="transform" type="rotate" from="${rotate.from} 0 0" to="${rotate.to} 0 0" dur="1s" repeatCount="indefinite" />`;
|
|
1035
|
+
}
|
|
1036
|
+
else {
|
|
1037
|
+
this.renderer.addClass(progressArc, 'k-circular-progressbar-arc');
|
|
1038
|
+
const removeIndeterminateStyles = [
|
|
1039
|
+
{ method: 'removeStyle', el: progressArc, attr: 'transform-origin' },
|
|
1040
|
+
{ method: 'removeStyle', el: progressArc, attr: 'fill' },
|
|
1041
|
+
{ method: 'removeStyle', el: progressArc, attr: 'stroke-linecap' }
|
|
1042
|
+
];
|
|
1043
|
+
removeProgressBarStyles(removeIndeterminateStyles, this.renderer);
|
|
1044
|
+
progressArc.innerHTML = '';
|
|
1045
|
+
if (this.animation) {
|
|
1046
|
+
this.progressbarAnimation();
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
updateCenterTemplate(value) {
|
|
1051
|
+
if (!this.centerTemplate) {
|
|
1052
|
+
return;
|
|
1053
|
+
}
|
|
1054
|
+
this.centerTemplateContext.value = value;
|
|
1055
|
+
this.centerTemplateContext.color = this.currentColor;
|
|
1056
|
+
this.cdr.detectChanges();
|
|
1057
|
+
this.positionLabel();
|
|
1058
|
+
}
|
|
1059
|
+
positionLabel() {
|
|
1060
|
+
const labelEl = this.labelElement.nativeElement;
|
|
1061
|
+
const elementRect = this.element.nativeElement.getBoundingClientRect();
|
|
1062
|
+
const elWidth = elementRect.width;
|
|
1063
|
+
const elHeight = elementRect.height;
|
|
1064
|
+
const left = (elWidth / 2) - (labelEl.offsetWidth / 2);
|
|
1065
|
+
const top = (elHeight / 2) - (labelEl.offsetHeight / 2);
|
|
1066
|
+
const labelCalculations = [
|
|
1067
|
+
{ method: 'setStyle', el: labelEl, attr: 'left', attrValue: `${left}px` },
|
|
1068
|
+
{ method: 'setStyle', el: labelEl, attr: 'top', attrValue: `${top}px` }
|
|
1069
|
+
];
|
|
1070
|
+
setProgressBarStyles(labelCalculations, this.renderer);
|
|
1071
|
+
}
|
|
1072
|
+
get currentColor() {
|
|
1073
|
+
const currentColor = this.progress.nativeElement.style.stroke;
|
|
1074
|
+
return currentColor;
|
|
1075
|
+
}
|
|
1076
|
+
updateProgressColor(value) {
|
|
1077
|
+
const progressArc = this.progress.nativeElement;
|
|
1078
|
+
if (typeof this.progressColor === 'string') {
|
|
1079
|
+
this.renderer.setStyle(progressArc, 'stroke', this.progressColor);
|
|
1080
|
+
}
|
|
1081
|
+
else {
|
|
1082
|
+
for (let i = 0; i < this.progressColor.length; i++) {
|
|
1083
|
+
let from = this.progressColor[i].from;
|
|
1084
|
+
let to = this.progressColor[i].to;
|
|
1085
|
+
if (value >= from && value <= to || (!from && value <= to)) {
|
|
1086
|
+
this.renderer.setStyle(progressArc, 'stroke', this.progressColor[i].color);
|
|
1087
|
+
break;
|
|
1088
|
+
}
|
|
1089
|
+
if (!to && value >= from) {
|
|
1090
|
+
this.renderer.setStyle(progressArc, 'stroke', this.progressColor[i].color);
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
handleErrors(type) {
|
|
1096
|
+
if (isDevMode()) {
|
|
1097
|
+
switch (type) {
|
|
1098
|
+
case 'value > max':
|
|
1099
|
+
throw new Error('The value of the CircularProgressbar cannot exceed the max value');
|
|
1100
|
+
case 'value < min':
|
|
1101
|
+
throw new Error('The value of the CircularProgressbar cannot be lower than the min value');
|
|
1102
|
+
case 'max < min':
|
|
1103
|
+
throw new Error('The min value cannot be higher than the max value');
|
|
1104
|
+
default:
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
setDirection() {
|
|
1109
|
+
this.rtl = this.localizationService.rtl;
|
|
1110
|
+
if (this.element) {
|
|
1111
|
+
this.renderer.setAttribute(this.element.nativeElement, 'dir', this.rtl ? 'rtl' : 'ltr');
|
|
1112
|
+
}
|
|
1113
|
+
if (this.labelElement) {
|
|
1114
|
+
this.renderer.setAttribute(this.labelElement.nativeElement, 'dir', this.rtl ? 'rtl' : 'ltr');
|
|
1115
|
+
}
|
|
1116
|
+
}
|
|
1117
|
+
rtlChange() {
|
|
1118
|
+
if (this.element && this.rtl !== this.localizationService.rtl) {
|
|
1119
|
+
this.setDirection();
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
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 });
|
|
1124
|
+
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", "style.width": "this.WrapperSize", "style.height": "this.WrapperSize" } }, providers: [
|
|
1125
|
+
LocalizationService,
|
|
1126
|
+
{
|
|
1127
|
+
provide: L10N_PREFIX,
|
|
1128
|
+
useValue: 'kendo.circularprogressbar'
|
|
1129
|
+
}
|
|
1130
|
+
], 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: "svgWrapper", first: true, predicate: ["svgWrapper"], descendants: true }], exportAs: ["kendoCircularProgressBar"], usesOnChanges: true, ngImport: i0, template: `
|
|
1131
|
+
<div class="k-circular-progressbar-surface">
|
|
1132
|
+
<div #svgWrapper>
|
|
1133
|
+
<svg #svg>
|
|
1134
|
+
<g>
|
|
1135
|
+
<circle class="k-circular-progressbar-scale" #scale stroke-width="9.5"></circle>
|
|
1136
|
+
<circle class="k-circular-progressbar-arc" #progress stroke-width="9.5"></circle>
|
|
1137
|
+
</g>
|
|
1138
|
+
</svg>
|
|
1139
|
+
<div class="k-circular-progressbar-label" *ngIf="centerTemplate" #label>
|
|
1140
|
+
<ng-template [ngTemplateOutlet]="centerTemplate.templateRef" [ngTemplateOutletContext]="centerTemplateContext"></ng-template>
|
|
1141
|
+
</div>
|
|
1142
|
+
</div>
|
|
1143
|
+
</div>
|
|
1144
|
+
<kendo-resize-sensor (resize)="onResize($event)"></kendo-resize-sensor>
|
|
1145
|
+
`, 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"] }] });
|
|
1146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CircularProgressBarComponent, decorators: [{
|
|
1147
|
+
type: Component,
|
|
1148
|
+
args: [{
|
|
1149
|
+
exportAs: 'kendoCircularProgressBar',
|
|
1150
|
+
selector: 'kendo-circularprogressbar',
|
|
1151
|
+
template: `
|
|
1152
|
+
<div class="k-circular-progressbar-surface">
|
|
1153
|
+
<div #svgWrapper>
|
|
1154
|
+
<svg #svg>
|
|
1155
|
+
<g>
|
|
1156
|
+
<circle class="k-circular-progressbar-scale" #scale stroke-width="9.5"></circle>
|
|
1157
|
+
<circle class="k-circular-progressbar-arc" #progress stroke-width="9.5"></circle>
|
|
1158
|
+
</g>
|
|
1159
|
+
</svg>
|
|
1160
|
+
<div class="k-circular-progressbar-label" *ngIf="centerTemplate" #label>
|
|
1161
|
+
<ng-template [ngTemplateOutlet]="centerTemplate.templateRef" [ngTemplateOutletContext]="centerTemplateContext"></ng-template>
|
|
1162
|
+
</div>
|
|
1163
|
+
</div>
|
|
1164
|
+
</div>
|
|
1165
|
+
<kendo-resize-sensor (resize)="onResize($event)"></kendo-resize-sensor>
|
|
1166
|
+
`, providers: [
|
|
1167
|
+
LocalizationService,
|
|
1168
|
+
{
|
|
1169
|
+
provide: L10N_PREFIX,
|
|
1170
|
+
useValue: 'kendo.circularprogressbar'
|
|
1171
|
+
}
|
|
1172
|
+
]
|
|
1173
|
+
}]
|
|
1174
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { hostClasses: [{
|
|
1175
|
+
type: HostBinding,
|
|
1176
|
+
args: ['class.k-circular-progressbar']
|
|
1177
|
+
}], WrapperSize: [{
|
|
1178
|
+
type: HostBinding,
|
|
1179
|
+
args: ['style.width']
|
|
1180
|
+
}, {
|
|
1181
|
+
type: HostBinding,
|
|
1182
|
+
args: ['style.height']
|
|
1183
|
+
}], value: [{
|
|
1184
|
+
type: Input
|
|
1185
|
+
}], max: [{
|
|
1186
|
+
type: Input
|
|
1187
|
+
}], min: [{
|
|
1188
|
+
type: Input
|
|
1189
|
+
}], animation: [{
|
|
1190
|
+
type: Input
|
|
1191
|
+
}], opacity: [{
|
|
1192
|
+
type: Input
|
|
1193
|
+
}], indeterminate: [{
|
|
1194
|
+
type: Input
|
|
1195
|
+
}], progressColor: [{
|
|
1196
|
+
type: Input
|
|
1197
|
+
}], animationEnd: [{
|
|
1198
|
+
type: Output
|
|
1199
|
+
}], progress: [{
|
|
1200
|
+
type: ViewChild,
|
|
1201
|
+
args: ['progress']
|
|
1202
|
+
}], scale: [{
|
|
1203
|
+
type: ViewChild,
|
|
1204
|
+
args: ['scale']
|
|
1205
|
+
}], labelElement: [{
|
|
1206
|
+
type: ViewChild,
|
|
1207
|
+
args: ["label"]
|
|
1208
|
+
}], svgWrapper: [{
|
|
1209
|
+
type: ViewChild,
|
|
1210
|
+
args: ["svgWrapper"]
|
|
1211
|
+
}], centerTemplate: [{
|
|
1212
|
+
type: ContentChild,
|
|
1213
|
+
args: [CircularProgressbarCenterTemplateDirective]
|
|
1214
|
+
}] } });
|
|
1215
|
+
|
|
1216
|
+
const COMPONENT_DIRECTIVES = [ProgressBarComponent, ChunkProgressBarComponent, CircularProgressBarComponent, CircularProgressbarCenterTemplateDirective];
|
|
1217
|
+
const MODULES = [CommonModule, ResizeSensorModule];
|
|
765
1218
|
/**
|
|
766
1219
|
* Represents the [NgModule]({{ site.data.urls.angular['ngmodules'] }})
|
|
767
1220
|
* definition for the ProgressBar components.
|
|
@@ -796,7 +1249,7 @@ const MODULES = [CommonModule];
|
|
|
796
1249
|
class ProgressBarModule {
|
|
797
1250
|
}
|
|
798
1251
|
ProgressBarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
799
|
-
ProgressBarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, declarations: [ProgressBarComponent, ChunkProgressBarComponent], imports: [CommonModule], exports: [ProgressBarComponent, ChunkProgressBarComponent] });
|
|
1252
|
+
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] });
|
|
800
1253
|
ProgressBarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, imports: [MODULES] });
|
|
801
1254
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, decorators: [{
|
|
802
1255
|
type: NgModule,
|
|
@@ -811,5 +1264,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImpo
|
|
|
811
1264
|
* Generated bundle index. Do not edit.
|
|
812
1265
|
*/
|
|
813
1266
|
|
|
814
|
-
export { ChunkProgressBarComponent, ProgressBarComponent, ProgressBarModule };
|
|
1267
|
+
export { ChunkProgressBarComponent, CircularProgressBarComponent, CircularProgressbarCenterTemplateDirective, ProgressBarComponent, ProgressBarModule };
|
|
815
1268
|
|
package/main.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*-------------------------------------------------------------------------------------------*/
|
|
5
5
|
export { ProgressBarComponent } from './progressbar.component';
|
|
6
6
|
export { ChunkProgressBarComponent } from './chunk/chunk-progressbar.component';
|
|
7
|
+
export { CircularProgressBarComponent } from './circularprogressbar/circular-progressbar.component';
|
|
7
8
|
export { ProgressBarOrientation } from './types/progressbar-orientation';
|
|
8
9
|
export { LabelSettings } from './types/label-settings.interface';
|
|
9
10
|
export { LabelPosition } from './types/label-position';
|
|
@@ -11,3 +12,5 @@ export { LabelFn } from './types/label-fn-type';
|
|
|
11
12
|
export { LabelType } from './types/label-type';
|
|
12
13
|
export { ProgressBarAnimation } from './types/progressbar-animation.interface';
|
|
13
14
|
export { ProgressBarModule } from './progressbar.module';
|
|
15
|
+
export { CircularProgressbarCenterTemplateDirective } from './circularprogressbar/center-template.directive';
|
|
16
|
+
export { ProgressColor } from './circularprogressbar/models/circular-progressbar-progress-color-interface';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@progress/kendo-angular-progressbar",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.1.0-dev.202208010920",
|
|
4
4
|
"description": "Kendo UI Angular component starter template",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "Progress",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@progress/kendo-schematics": "^3.0.0",
|
|
26
|
+
"@progress/kendo-charts": "^1.18.0",
|
|
26
27
|
"tslib": "^2.3.1"
|
|
27
28
|
},
|
|
28
29
|
"peerDependencies": {
|
|
@@ -65,11 +66,11 @@
|
|
|
65
66
|
"fallbackTags": {
|
|
66
67
|
"dev": "latest"
|
|
67
68
|
},
|
|
68
|
-
"analyzeCommits": "@
|
|
69
|
+
"analyzeCommits": "@progress/semantic-prerelease/analyzeCommits",
|
|
69
70
|
"generateNotes": "@progress/kendo-angular-tasks/lib/generateNotes",
|
|
70
|
-
"getLastRelease": "@
|
|
71
|
-
"verifyConditions": "@
|
|
72
|
-
"verifyRelease": "@
|
|
71
|
+
"getLastRelease": "@progress/semantic-prerelease/getLastRelease",
|
|
72
|
+
"verifyConditions": "@progress/semantic-prerelease/verifyConditions",
|
|
73
|
+
"verifyRelease": "@progress/semantic-prerelease/verifyRelease"
|
|
73
74
|
},
|
|
74
75
|
"main": "bundles/kendo-angular-progressbar.umd.js",
|
|
75
76
|
"module": "fesm2015/kendo-angular-progressbar.js",
|
package/progressbar.module.d.ts
CHANGED
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
import * as i1 from "./progressbar.component";
|
|
7
7
|
import * as i2 from "./chunk/chunk-progressbar.component";
|
|
8
|
-
import * as i3 from "
|
|
8
|
+
import * as i3 from "./circularprogressbar/circular-progressbar.component";
|
|
9
|
+
import * as i4 from "./circularprogressbar/center-template.directive";
|
|
10
|
+
import * as i5 from "@angular/common";
|
|
11
|
+
import * as i6 from "@progress/kendo-angular-common";
|
|
9
12
|
/**
|
|
10
13
|
* Represents the [NgModule]({{ site.data.urls.angular['ngmodules'] }})
|
|
11
14
|
* definition for the ProgressBar components.
|
|
@@ -39,6 +42,6 @@ import * as i3 from "@angular/common";
|
|
|
39
42
|
*/
|
|
40
43
|
export declare class ProgressBarModule {
|
|
41
44
|
static ɵfac: i0.ɵɵFactoryDeclaration<ProgressBarModule, never>;
|
|
42
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<ProgressBarModule, [typeof i1.ProgressBarComponent, typeof i2.ChunkProgressBarComponent], [typeof
|
|
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]>;
|
|
43
46
|
static ɵinj: i0.ɵɵInjectorDeclaration<ProgressBarModule>;
|
|
44
47
|
}
|