@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
|
@@ -0,0 +1,433 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Component, ContentChild, EventEmitter, HostBinding, Input, isDevMode, Output, ViewChild } from '@angular/core';
|
|
6
|
+
import { hasObservers, isChanged } from '@progress/kendo-angular-common';
|
|
7
|
+
import { L10N_PREFIX, LocalizationService } from '@progress/kendo-angular-l10n';
|
|
8
|
+
import { validatePackage } from '@progress/kendo-licensing';
|
|
9
|
+
import { Subscription, take } from 'rxjs';
|
|
10
|
+
import { removeProgressBarStyles, setProgressBarStyles } from '../common/util';
|
|
11
|
+
import { packageMetadata } from '../package-metadata';
|
|
12
|
+
import { CircularProgressbarCenterTemplateDirective } from './center-template.directive';
|
|
13
|
+
import * as i0 from "@angular/core";
|
|
14
|
+
import * as i1 from "@progress/kendo-angular-l10n";
|
|
15
|
+
import * as i2 from "@progress/kendo-angular-common";
|
|
16
|
+
import * as i3 from "@angular/common";
|
|
17
|
+
/**
|
|
18
|
+
* Represents the [Kendo UI Circular ProgressBar component for Angular]({% slug circular_progressbar %}).
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts-preview
|
|
22
|
+
* _@Component({don’t
|
|
23
|
+
* selector: 'my-app',
|
|
24
|
+
* template: `
|
|
25
|
+
* <kendo-circularprogressbar [value]="value"></kendo-circularprogressbar>
|
|
26
|
+
* `
|
|
27
|
+
* })
|
|
28
|
+
* class AppComponent {
|
|
29
|
+
* public value: number = 50;
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export class CircularProgressBarComponent {
|
|
34
|
+
constructor(renderer, cdr, localizationService, element, zone) {
|
|
35
|
+
this.renderer = renderer;
|
|
36
|
+
this.cdr = cdr;
|
|
37
|
+
this.localizationService = localizationService;
|
|
38
|
+
this.element = element;
|
|
39
|
+
this.zone = zone;
|
|
40
|
+
this.hostClasses = true;
|
|
41
|
+
this.WrapperSize = '200px';
|
|
42
|
+
/**
|
|
43
|
+
* Indicates whether an animation will be played on value changes.
|
|
44
|
+
*
|
|
45
|
+
* @default false
|
|
46
|
+
*/
|
|
47
|
+
this.animation = false;
|
|
48
|
+
/**
|
|
49
|
+
* The opacity of the value arc.
|
|
50
|
+
* @default 1
|
|
51
|
+
*/
|
|
52
|
+
this.opacity = 1;
|
|
53
|
+
/**
|
|
54
|
+
* Fires when the animation which indicates the latest value change is completed.
|
|
55
|
+
*/
|
|
56
|
+
this.animationEnd = new EventEmitter();
|
|
57
|
+
this.centerTemplateContext = {};
|
|
58
|
+
this._indeterminate = false;
|
|
59
|
+
this._max = 100;
|
|
60
|
+
this._min = 0;
|
|
61
|
+
this._value = 0;
|
|
62
|
+
this.internalValue = 0;
|
|
63
|
+
this.subscriptions = new Subscription();
|
|
64
|
+
validatePackage(packageMetadata);
|
|
65
|
+
this.subscriptions.add(this.localizationService.changes.subscribe(this.rtlChange.bind(this)));
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Sets the default value of the Circular Progressbar between `min` and `max`.
|
|
69
|
+
*
|
|
70
|
+
* @default 0
|
|
71
|
+
*/
|
|
72
|
+
set value(value) {
|
|
73
|
+
if (value > this.max) {
|
|
74
|
+
this.handleErrors('value > max');
|
|
75
|
+
}
|
|
76
|
+
if (value < this.min) {
|
|
77
|
+
this.handleErrors('value < min');
|
|
78
|
+
}
|
|
79
|
+
this.previousValue = this.value;
|
|
80
|
+
this._value = value;
|
|
81
|
+
}
|
|
82
|
+
get value() {
|
|
83
|
+
return this._value;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The maximum value which the Circular Progressbar can accept.
|
|
87
|
+
*
|
|
88
|
+
* @default 100
|
|
89
|
+
*/
|
|
90
|
+
set max(max) {
|
|
91
|
+
if (max < this.min) {
|
|
92
|
+
this.handleErrors('max < min');
|
|
93
|
+
}
|
|
94
|
+
this._max = max;
|
|
95
|
+
}
|
|
96
|
+
get max() {
|
|
97
|
+
return this._max;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The minimum value which the Circular Progressbar can accept.
|
|
101
|
+
*
|
|
102
|
+
* @default 0
|
|
103
|
+
*/
|
|
104
|
+
set min(min) {
|
|
105
|
+
if (min > this.max) {
|
|
106
|
+
this.handleErrors('max < min');
|
|
107
|
+
}
|
|
108
|
+
this._min = min;
|
|
109
|
+
}
|
|
110
|
+
get min() {
|
|
111
|
+
return this._min;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Puts the Circular ProgressBar in indeterminate state.
|
|
115
|
+
* @default false
|
|
116
|
+
*/
|
|
117
|
+
set indeterminate(indeterminate) {
|
|
118
|
+
this._indeterminate = indeterminate;
|
|
119
|
+
}
|
|
120
|
+
get indeterminate() {
|
|
121
|
+
return this._indeterminate;
|
|
122
|
+
}
|
|
123
|
+
ngAfterViewInit() {
|
|
124
|
+
this.initProgressArc();
|
|
125
|
+
}
|
|
126
|
+
ngOnChanges(changes) {
|
|
127
|
+
const skipFirstChange = true;
|
|
128
|
+
if (isChanged('value', changes, skipFirstChange) && this.progress) {
|
|
129
|
+
if (this.animation) {
|
|
130
|
+
this.progressbarAnimation();
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
const value = this.value - this.min;
|
|
134
|
+
this.internalValue = changes.value.currentValue;
|
|
135
|
+
this.calculateProgress(value);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (changes.opacity && this.progress) {
|
|
139
|
+
setProgressBarStyles([{ method: 'setAttribute', el: this.progress.nativeElement, attr: 'opacity', attrValue: this.opacity }], this.renderer);
|
|
140
|
+
}
|
|
141
|
+
if (changes.indeterminate && !changes.indeterminate.firstChange) {
|
|
142
|
+
this.indeterminateState();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
ngOnDestroy() {
|
|
146
|
+
this.subscriptions.unsubscribe();
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @hidden
|
|
150
|
+
*/
|
|
151
|
+
onResize(_event) {
|
|
152
|
+
this.setStyles();
|
|
153
|
+
const value = this.animation ? this.internalValue : this.value;
|
|
154
|
+
this.calculateProgress(value);
|
|
155
|
+
this.updateCenterTemplate(value);
|
|
156
|
+
}
|
|
157
|
+
initProgressArc() {
|
|
158
|
+
this.setStyles();
|
|
159
|
+
if (this.indeterminate) {
|
|
160
|
+
this.indeterminateState();
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
if (!this.animation) {
|
|
164
|
+
const value = this.value - this.min;
|
|
165
|
+
this.calculateProgress(value);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
this.progressbarAnimation();
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
calculateProgress(value) {
|
|
173
|
+
if (this.progressColor) {
|
|
174
|
+
this.updateProgressColor(value);
|
|
175
|
+
}
|
|
176
|
+
// needed when we have *ngIf inside the template to render different content depending on some condition
|
|
177
|
+
this.zone.onStable.pipe(take(1)).subscribe(() => {
|
|
178
|
+
this.updateCenterTemplate(value + this.min);
|
|
179
|
+
});
|
|
180
|
+
const progressArc = this.progress.nativeElement;
|
|
181
|
+
const radius = this.progress.nativeElement.r.baseVal.value;
|
|
182
|
+
const circumference = Math.PI * (radius * 2);
|
|
183
|
+
const dir = this.rtl ? circumference * -1 : circumference;
|
|
184
|
+
const strokeDashOffest = circumference - dir * (value / (this.max - this.min));
|
|
185
|
+
const progressCalculations = [
|
|
186
|
+
{ method: 'setStyle', el: progressArc, attr: 'strokeDasharray', attrValue: circumference },
|
|
187
|
+
{ method: 'setStyle', el: progressArc, attr: 'strokeDashoffset', attrValue: strokeDashOffest }
|
|
188
|
+
];
|
|
189
|
+
setProgressBarStyles(progressCalculations, this.renderer);
|
|
190
|
+
}
|
|
191
|
+
progressbarAnimation() {
|
|
192
|
+
const forwardProgress = {
|
|
193
|
+
isOngoing: this.internalValue > this.value - this.min,
|
|
194
|
+
isPositive: this.value >= this.previousValue
|
|
195
|
+
};
|
|
196
|
+
const backwardProgress = {
|
|
197
|
+
isOngoing: this.internalValue < this.value - this.min,
|
|
198
|
+
isNegative: this.value <= this.previousValue
|
|
199
|
+
};
|
|
200
|
+
if (forwardProgress.isOngoing && forwardProgress.isPositive ||
|
|
201
|
+
backwardProgress.isOngoing && backwardProgress.isNegative) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
this.calculateProgress(this.internalValue);
|
|
205
|
+
const from = this.internalValue;
|
|
206
|
+
if (hasObservers(this.animationEnd)) {
|
|
207
|
+
this.animationEnd.emit({
|
|
208
|
+
from: from,
|
|
209
|
+
to: this.internalValue
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
// eslint-disable-next-line no-unused-expressions
|
|
213
|
+
forwardProgress.isPositive ? this.internalValue += 1 : this.internalValue -= 1;
|
|
214
|
+
requestAnimationFrame(this.progressbarAnimation.bind(this));
|
|
215
|
+
}
|
|
216
|
+
setStyles() {
|
|
217
|
+
const progressArc = this.progress.nativeElement;
|
|
218
|
+
const scale = this.scale.nativeElement;
|
|
219
|
+
const element = this.element.nativeElement;
|
|
220
|
+
const elWidth = element.getBoundingClientRect().width;
|
|
221
|
+
const attributesArray = [
|
|
222
|
+
{ method: 'setAttribute', el: progressArc, attr: 'r', attrValue: (elWidth / 2) - 10 },
|
|
223
|
+
{ method: 'setAttribute', el: progressArc, attr: 'cx', attrValue: (elWidth / 2) },
|
|
224
|
+
{ method: 'setAttribute', el: progressArc, attr: 'cy', attrValue: (elWidth / 2) },
|
|
225
|
+
{ method: 'setAttribute', el: progressArc, attr: 'opacity', attrValue: this.opacity },
|
|
226
|
+
{ method: 'setAttribute', el: scale, attr: 'r', attrValue: (elWidth / 2) - 10 },
|
|
227
|
+
{ method: 'setAttribute', el: scale, attr: 'cx', attrValue: (elWidth / 2) },
|
|
228
|
+
{ method: 'setAttribute', el: scale, attr: 'cy', attrValue: (elWidth / 2) }
|
|
229
|
+
];
|
|
230
|
+
setProgressBarStyles(attributesArray, this.renderer);
|
|
231
|
+
}
|
|
232
|
+
indeterminateState() {
|
|
233
|
+
const progressArc = this.progress.nativeElement;
|
|
234
|
+
if (this.indeterminate) {
|
|
235
|
+
// the indeterminate state wont work as the `k-circular-progressbar-arc` has a transform: rotate(-90deg) which is
|
|
236
|
+
// interfering with the svg animation as the animateTransform brings its own transform: rotate()
|
|
237
|
+
// This will be like this until the themes release a new version, bringing a new class `k-circular-progressbar-indeterminate-arc`
|
|
238
|
+
// containing only the necassery CSS styles and we will switch between them when the state of the progressbar is switched.
|
|
239
|
+
this.calculateProgress(this.value - this.min);
|
|
240
|
+
const rotate = this.rtl ? { from: 360, to: 0 } : { from: 0, to: 360 };
|
|
241
|
+
let color;
|
|
242
|
+
if (!this.progressColor) {
|
|
243
|
+
color = getComputedStyle(progressArc).stroke;
|
|
244
|
+
}
|
|
245
|
+
const indeterminateStyles = [
|
|
246
|
+
{ method: 'setStyle', el: progressArc, attr: 'transform-origin', attrValue: 'center' },
|
|
247
|
+
{ method: 'setStyle', el: progressArc, attr: 'fill', attrValue: 'none' },
|
|
248
|
+
{ method: 'setStyle', el: progressArc, attr: 'stroke-linecap', attrValue: 'round' },
|
|
249
|
+
{ method: 'setStyle', el: progressArc, attr: 'stroke', attrValue: color ? color : this.currentColor }
|
|
250
|
+
];
|
|
251
|
+
setProgressBarStyles(indeterminateStyles, this.renderer);
|
|
252
|
+
this.renderer.removeClass(progressArc, 'k-circular-progressbar-arc');
|
|
253
|
+
progressArc.innerHTML = `<animateTransform attributeName="transform" type="rotate" from="${rotate.from} 0 0" to="${rotate.to} 0 0" dur="1s" repeatCount="indefinite" />`;
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
this.renderer.addClass(progressArc, 'k-circular-progressbar-arc');
|
|
257
|
+
const removeIndeterminateStyles = [
|
|
258
|
+
{ method: 'removeStyle', el: progressArc, attr: 'transform-origin' },
|
|
259
|
+
{ method: 'removeStyle', el: progressArc, attr: 'fill' },
|
|
260
|
+
{ method: 'removeStyle', el: progressArc, attr: 'stroke-linecap' }
|
|
261
|
+
];
|
|
262
|
+
removeProgressBarStyles(removeIndeterminateStyles, this.renderer);
|
|
263
|
+
progressArc.innerHTML = '';
|
|
264
|
+
if (this.animation) {
|
|
265
|
+
this.progressbarAnimation();
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
updateCenterTemplate(value) {
|
|
270
|
+
if (!this.centerTemplate) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
this.centerTemplateContext.value = value;
|
|
274
|
+
this.centerTemplateContext.color = this.currentColor;
|
|
275
|
+
this.cdr.detectChanges();
|
|
276
|
+
this.positionLabel();
|
|
277
|
+
}
|
|
278
|
+
positionLabel() {
|
|
279
|
+
const labelEl = this.labelElement.nativeElement;
|
|
280
|
+
const elementRect = this.element.nativeElement.getBoundingClientRect();
|
|
281
|
+
const elWidth = elementRect.width;
|
|
282
|
+
const elHeight = elementRect.height;
|
|
283
|
+
const left = (elWidth / 2) - (labelEl.offsetWidth / 2);
|
|
284
|
+
const top = (elHeight / 2) - (labelEl.offsetHeight / 2);
|
|
285
|
+
const labelCalculations = [
|
|
286
|
+
{ method: 'setStyle', el: labelEl, attr: 'left', attrValue: `${left}px` },
|
|
287
|
+
{ method: 'setStyle', el: labelEl, attr: 'top', attrValue: `${top}px` }
|
|
288
|
+
];
|
|
289
|
+
setProgressBarStyles(labelCalculations, this.renderer);
|
|
290
|
+
}
|
|
291
|
+
get currentColor() {
|
|
292
|
+
const currentColor = this.progress.nativeElement.style.stroke;
|
|
293
|
+
return currentColor;
|
|
294
|
+
}
|
|
295
|
+
updateProgressColor(value) {
|
|
296
|
+
const progressArc = this.progress.nativeElement;
|
|
297
|
+
if (typeof this.progressColor === 'string') {
|
|
298
|
+
this.renderer.setStyle(progressArc, 'stroke', this.progressColor);
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
for (let i = 0; i < this.progressColor.length; i++) {
|
|
302
|
+
let from = this.progressColor[i].from;
|
|
303
|
+
let to = this.progressColor[i].to;
|
|
304
|
+
if (value >= from && value <= to || (!from && value <= to)) {
|
|
305
|
+
this.renderer.setStyle(progressArc, 'stroke', this.progressColor[i].color);
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
if (!to && value >= from) {
|
|
309
|
+
this.renderer.setStyle(progressArc, 'stroke', this.progressColor[i].color);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
handleErrors(type) {
|
|
315
|
+
if (isDevMode()) {
|
|
316
|
+
switch (type) {
|
|
317
|
+
case 'value > max':
|
|
318
|
+
throw new Error('The value of the CircularProgressbar cannot exceed the max value');
|
|
319
|
+
case 'value < min':
|
|
320
|
+
throw new Error('The value of the CircularProgressbar cannot be lower than the min value');
|
|
321
|
+
case 'max < min':
|
|
322
|
+
throw new Error('The min value cannot be higher than the max value');
|
|
323
|
+
default:
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
setDirection() {
|
|
328
|
+
this.rtl = this.localizationService.rtl;
|
|
329
|
+
if (this.element) {
|
|
330
|
+
this.renderer.setAttribute(this.element.nativeElement, 'dir', this.rtl ? 'rtl' : 'ltr');
|
|
331
|
+
}
|
|
332
|
+
if (this.labelElement) {
|
|
333
|
+
this.renderer.setAttribute(this.labelElement.nativeElement, 'dir', this.rtl ? 'rtl' : 'ltr');
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
rtlChange() {
|
|
337
|
+
if (this.element && this.rtl !== this.localizationService.rtl) {
|
|
338
|
+
this.setDirection();
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
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 });
|
|
343
|
+
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: [
|
|
344
|
+
LocalizationService,
|
|
345
|
+
{
|
|
346
|
+
provide: L10N_PREFIX,
|
|
347
|
+
useValue: 'kendo.circularprogressbar'
|
|
348
|
+
}
|
|
349
|
+
], 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: `
|
|
350
|
+
<div class="k-circular-progressbar-surface">
|
|
351
|
+
<div #svgWrapper>
|
|
352
|
+
<svg #svg>
|
|
353
|
+
<g>
|
|
354
|
+
<circle class="k-circular-progressbar-scale" #scale stroke-width="9.5"></circle>
|
|
355
|
+
<circle class="k-circular-progressbar-arc" #progress stroke-width="9.5"></circle>
|
|
356
|
+
</g>
|
|
357
|
+
</svg>
|
|
358
|
+
<div class="k-circular-progressbar-label" *ngIf="centerTemplate" #label>
|
|
359
|
+
<ng-template [ngTemplateOutlet]="centerTemplate.templateRef" [ngTemplateOutletContext]="centerTemplateContext"></ng-template>
|
|
360
|
+
</div>
|
|
361
|
+
</div>
|
|
362
|
+
</div>
|
|
363
|
+
<kendo-resize-sensor (resize)="onResize($event)"></kendo-resize-sensor>
|
|
364
|
+
`, 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"] }] });
|
|
365
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: CircularProgressBarComponent, decorators: [{
|
|
366
|
+
type: Component,
|
|
367
|
+
args: [{
|
|
368
|
+
exportAs: 'kendoCircularProgressBar',
|
|
369
|
+
selector: 'kendo-circularprogressbar',
|
|
370
|
+
template: `
|
|
371
|
+
<div class="k-circular-progressbar-surface">
|
|
372
|
+
<div #svgWrapper>
|
|
373
|
+
<svg #svg>
|
|
374
|
+
<g>
|
|
375
|
+
<circle class="k-circular-progressbar-scale" #scale stroke-width="9.5"></circle>
|
|
376
|
+
<circle class="k-circular-progressbar-arc" #progress stroke-width="9.5"></circle>
|
|
377
|
+
</g>
|
|
378
|
+
</svg>
|
|
379
|
+
<div class="k-circular-progressbar-label" *ngIf="centerTemplate" #label>
|
|
380
|
+
<ng-template [ngTemplateOutlet]="centerTemplate.templateRef" [ngTemplateOutletContext]="centerTemplateContext"></ng-template>
|
|
381
|
+
</div>
|
|
382
|
+
</div>
|
|
383
|
+
</div>
|
|
384
|
+
<kendo-resize-sensor (resize)="onResize($event)"></kendo-resize-sensor>
|
|
385
|
+
`, providers: [
|
|
386
|
+
LocalizationService,
|
|
387
|
+
{
|
|
388
|
+
provide: L10N_PREFIX,
|
|
389
|
+
useValue: 'kendo.circularprogressbar'
|
|
390
|
+
}
|
|
391
|
+
]
|
|
392
|
+
}]
|
|
393
|
+
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i1.LocalizationService }, { type: i0.ElementRef }, { type: i0.NgZone }]; }, propDecorators: { hostClasses: [{
|
|
394
|
+
type: HostBinding,
|
|
395
|
+
args: ['class.k-circular-progressbar']
|
|
396
|
+
}], WrapperSize: [{
|
|
397
|
+
type: HostBinding,
|
|
398
|
+
args: ['style.width']
|
|
399
|
+
}, {
|
|
400
|
+
type: HostBinding,
|
|
401
|
+
args: ['style.height']
|
|
402
|
+
}], value: [{
|
|
403
|
+
type: Input
|
|
404
|
+
}], max: [{
|
|
405
|
+
type: Input
|
|
406
|
+
}], min: [{
|
|
407
|
+
type: Input
|
|
408
|
+
}], animation: [{
|
|
409
|
+
type: Input
|
|
410
|
+
}], opacity: [{
|
|
411
|
+
type: Input
|
|
412
|
+
}], indeterminate: [{
|
|
413
|
+
type: Input
|
|
414
|
+
}], progressColor: [{
|
|
415
|
+
type: Input
|
|
416
|
+
}], animationEnd: [{
|
|
417
|
+
type: Output
|
|
418
|
+
}], progress: [{
|
|
419
|
+
type: ViewChild,
|
|
420
|
+
args: ['progress']
|
|
421
|
+
}], scale: [{
|
|
422
|
+
type: ViewChild,
|
|
423
|
+
args: ['scale']
|
|
424
|
+
}], labelElement: [{
|
|
425
|
+
type: ViewChild,
|
|
426
|
+
args: ["label"]
|
|
427
|
+
}], svgWrapper: [{
|
|
428
|
+
type: ViewChild,
|
|
429
|
+
args: ["svgWrapper"]
|
|
430
|
+
}], centerTemplate: [{
|
|
431
|
+
type: ContentChild,
|
|
432
|
+
args: [CircularProgressbarCenterTemplateDirective]
|
|
433
|
+
}] } });
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2021 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
/**
|
|
6
|
+
* The color range configuration of the pointer.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
@@ -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
|
@@ -79,3 +79,19 @@ export const stopCurrentAnimation = (changes) => {
|
|
|
79
79
|
const hasAnimation = isAnimationChanged && changes.animation.currentValue;
|
|
80
80
|
return isAnimationChanged && !hasAnimation;
|
|
81
81
|
};
|
|
82
|
+
/**
|
|
83
|
+
* @hidden
|
|
84
|
+
*/
|
|
85
|
+
export const setProgressBarStyles = (props, renderer) => {
|
|
86
|
+
props.forEach(prop => {
|
|
87
|
+
renderer[prop.method](prop.el, prop.attr, `${prop.attrValue}`);
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* @hidden
|
|
92
|
+
*/
|
|
93
|
+
export const removeProgressBarStyles = (props, renderer) => {
|
|
94
|
+
props.forEach(prop => {
|
|
95
|
+
renderer[prop.method](prop.el, prop.attr);
|
|
96
|
+
});
|
|
97
|
+
};
|
package/esm2015/main.js
CHANGED
|
@@ -4,4 +4,6 @@
|
|
|
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 { 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: 1659345594,
|
|
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,9 +6,12 @@ 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 { ResizeSensorModule } from '@progress/kendo-angular-common';
|
|
10
|
+
import { CircularProgressBarComponent } from './circularprogressbar/circular-progressbar.component';
|
|
11
|
+
import { CircularProgressbarCenterTemplateDirective } from './circularprogressbar/center-template.directive';
|
|
9
12
|
import * as i0 from "@angular/core";
|
|
10
|
-
const COMPONENT_DIRECTIVES = [ProgressBarComponent, ChunkProgressBarComponent];
|
|
11
|
-
const MODULES = [CommonModule];
|
|
13
|
+
const COMPONENT_DIRECTIVES = [ProgressBarComponent, ChunkProgressBarComponent, CircularProgressBarComponent, CircularProgressbarCenterTemplateDirective];
|
|
14
|
+
const MODULES = [CommonModule, ResizeSensorModule];
|
|
12
15
|
/**
|
|
13
16
|
* Represents the [NgModule]({{ site.data.urls.angular['ngmodules'] }})
|
|
14
17
|
* definition for the ProgressBar components.
|
|
@@ -43,7 +46,7 @@ const MODULES = [CommonModule];
|
|
|
43
46
|
export class ProgressBarModule {
|
|
44
47
|
}
|
|
45
48
|
ProgressBarModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
46
|
-
ProgressBarModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, declarations: [ProgressBarComponent, ChunkProgressBarComponent], imports: [CommonModule], exports: [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] });
|
|
47
50
|
ProgressBarModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, imports: [MODULES] });
|
|
48
51
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: ProgressBarModule, decorators: [{
|
|
49
52
|
type: NgModule,
|