@progress/kendo-angular-progressbar 2.0.3 → 3.0.0-next.202202141243

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.
Files changed (78) hide show
  1. package/bundles/kendo-angular-progressbar.umd.js +5 -0
  2. package/{dist/es2015/chunk → chunk}/chunk-progressbar.component.d.ts +6 -3
  3. package/{dist/es2015/common → common}/constants.d.ts +0 -0
  4. package/{dist/es2015/common → common}/progressbar-base.d.ts +19 -16
  5. package/{dist/es2015/common → common}/util.d.ts +0 -0
  6. package/{dist/es2015 → esm2015}/chunk/chunk-progressbar.component.js +51 -39
  7. package/{dist/es2015 → esm2015}/common/constants.js +0 -0
  8. package/{dist/es2015 → esm2015}/common/progressbar-base.js +61 -84
  9. package/{dist/es2015 → esm2015}/common/util.js +0 -3
  10. package/{dist/es2015/index.d.ts → esm2015/kendo-angular-progressbar.js} +0 -1
  11. package/{dist/es → esm2015}/main.js +0 -0
  12. package/{dist/es2015 → esm2015}/package-metadata.js +1 -1
  13. package/{dist/es2015 → esm2015}/progressbar.component.js +79 -58
  14. package/{dist/es2015 → esm2015}/progressbar.module.js +14 -11
  15. package/{dist/es2015 → esm2015}/types/animation-end-event.js +1 -0
  16. package/{dist/es2015 → esm2015}/types/animation-options.interface.js +1 -0
  17. package/{dist/es2015 → esm2015}/types/label-fn-type.js +1 -0
  18. package/{dist/es → esm2015}/types/label-position.js +1 -0
  19. package/{dist/es → esm2015}/types/label-settings.interface.js +1 -0
  20. package/{dist/es → esm2015}/types/label-type.js +1 -0
  21. package/{dist/es → esm2015}/types/progressbar-animation.interface.js +1 -0
  22. package/{dist/es → esm2015}/types/progressbar-orientation.js +1 -0
  23. package/{dist/fesm2015/index.js → fesm2015/kendo-angular-progressbar.js} +201 -187
  24. package/{dist/es/index.js → kendo-angular-progressbar.d.ts} +1 -1
  25. package/{dist/es2015/main.d.ts → main.d.ts} +0 -0
  26. package/{dist/es2015/package-metadata.d.ts → package-metadata.d.ts} +0 -0
  27. package/package.json +32 -98
  28. package/{dist/es2015/progressbar.component.d.ts → progressbar.component.d.ts} +10 -7
  29. package/{dist/es2015/progressbar.module.d.ts → progressbar.module.d.ts} +7 -0
  30. package/schematics/ngAdd/index.js +5 -2
  31. package/schematics/ngAdd/index.js.map +1 -1
  32. package/{dist/es2015/types → types}/animation-end-event.d.ts +0 -0
  33. package/{dist/es2015/types → types}/animation-options.interface.d.ts +0 -0
  34. package/{dist/es2015/types → types}/label-fn-type.d.ts +0 -0
  35. package/{dist/es2015/types → types}/label-position.d.ts +0 -0
  36. package/{dist/es2015/types → types}/label-settings.interface.d.ts +0 -0
  37. package/{dist/es2015/types → types}/label-type.d.ts +0 -0
  38. package/{dist/es2015/types → types}/progressbar-animation.interface.d.ts +0 -0
  39. package/{dist/es2015/types → types}/progressbar-orientation.d.ts +0 -0
  40. package/dist/cdn/js/kendo-angular-progressbar.js +0 -20
  41. package/dist/cdn/main.js +0 -5
  42. package/dist/es/chunk/chunk-progressbar.component.js +0 -129
  43. package/dist/es/common/constants.js +0 -16
  44. package/dist/es/common/progressbar-base.js +0 -305
  45. package/dist/es/common/util.js +0 -86
  46. package/dist/es/package-metadata.js +0 -15
  47. package/dist/es/progressbar.component.js +0 -304
  48. package/dist/es/progressbar.module.js +0 -55
  49. package/dist/es/types/animation-end-event.js +0 -4
  50. package/dist/es/types/animation-options.interface.js +0 -4
  51. package/dist/es/types/label-fn-type.js +0 -4
  52. package/dist/es2015/index.js +0 -9
  53. package/dist/es2015/index.metadata.json +0 -1
  54. package/dist/es2015/main.js +0 -7
  55. package/dist/es2015/types/label-position.js +0 -4
  56. package/dist/es2015/types/label-settings.interface.js +0 -4
  57. package/dist/es2015/types/label-type.js +0 -4
  58. package/dist/es2015/types/progressbar-animation.interface.js +0 -4
  59. package/dist/es2015/types/progressbar-orientation.js +0 -4
  60. package/dist/fesm5/index.js +0 -875
  61. package/dist/npm/chunk/chunk-progressbar.component.js +0 -131
  62. package/dist/npm/common/constants.js +0 -18
  63. package/dist/npm/common/progressbar-base.js +0 -307
  64. package/dist/npm/common/util.js +0 -89
  65. package/dist/npm/index.js +0 -13
  66. package/dist/npm/main.js +0 -12
  67. package/dist/npm/package-metadata.js +0 -17
  68. package/dist/npm/progressbar.component.js +0 -306
  69. package/dist/npm/progressbar.module.js +0 -57
  70. package/dist/npm/types/animation-end-event.js +0 -6
  71. package/dist/npm/types/animation-options.interface.js +0 -6
  72. package/dist/npm/types/label-fn-type.js +0 -6
  73. package/dist/npm/types/label-position.js +0 -6
  74. package/dist/npm/types/label-settings.interface.js +0 -6
  75. package/dist/npm/types/label-type.js +0 -6
  76. package/dist/npm/types/progressbar-animation.interface.js +0 -6
  77. package/dist/npm/types/progressbar-orientation.js +0 -6
  78. package/dist/systemjs/kendo-angular-progressbar.js +0 -5
@@ -1,875 +0,0 @@
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 { __decorate, __metadata, __extends } from 'tslib';
6
- import { isDevMode, HostBinding, Input, EventEmitter, Output, ViewChild, ElementRef, Component, NgZone, Renderer2, NgModule } from '@angular/core';
7
- import { validatePackage } from '@progress/kendo-licensing';
8
- import { LocalizationService, L10N_PREFIX } from '@progress/kendo-angular-l10n';
9
- import { hasObservers } from '@progress/kendo-angular-common';
10
- import { CommonModule } from '@angular/common';
11
-
12
- /**
13
- * @hidden
14
- */
15
- var packageMetadata = {
16
- name: '@progress/kendo-angular-progressbar',
17
- productName: 'Kendo UI for Angular',
18
- productCodes: ['KENDOUIANGULAR', 'KENDOUICOMPLETE'],
19
- publishDate: 1642588075,
20
- version: '',
21
- 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'
22
- };
23
-
24
- /**
25
- * @hidden
26
- */
27
- var MIN_MAX_ERROR_MESSAGE = "The max value should be greater than the min.";
28
- /**
29
- * @hidden
30
- */
31
- var LABEL_DECIMALS = 3;
32
- /**
33
- * @hidden
34
- */
35
- var MIN_RATIO = 0.0001;
36
-
37
- /**
38
- * @hidden
39
- */
40
- var reverseChunks = function (orientation, reverse) { return (orientation === 'vertical' && !reverse || orientation === 'horizontal' && reverse); };
41
- /**
42
- * @hidden
43
- */
44
- var formatValue = function (value, min, max, label) {
45
- var defaultFormattedValue = truncateNumber(value);
46
- if (typeof label !== 'boolean') {
47
- if (typeof label.format === 'string') {
48
- switch (label.format) {
49
- case 'value':
50
- return defaultFormattedValue;
51
- case 'percent':
52
- return Math.floor(calculatePercentage(value, min, max)) + "%";
53
- default:
54
- return defaultFormattedValue;
55
- }
56
- }
57
- else if (typeof label.format === 'function') {
58
- return label.format(value);
59
- }
60
- else {
61
- return defaultFormattedValue;
62
- }
63
- }
64
- return defaultFormattedValue;
65
- };
66
- /**
67
- * @hidden
68
- */
69
- var validateRange = function (min, max) {
70
- if (isDevMode && min > max) {
71
- throw new Error(MIN_MAX_ERROR_MESSAGE);
72
- }
73
- };
74
- /**
75
- * @hidden
76
- */
77
- var adjustValueToRange = function (min, max, value) { return Math.max(Math.min(value, max), min); };
78
- /**
79
- * @hidden
80
- */
81
- var calculatePercentage = function (value, min, max) {
82
- var onePercent = Math.abs((max - min) / 100);
83
- return Math.abs((value - min) / onePercent);
84
- };
85
- /**
86
- * @hidden
87
- */
88
- var truncateNumber = function (value) {
89
- var numberParts = value.toString().split('.');
90
- return numberParts.length === 1 ? "" + numberParts[0] : numberParts[0] + "." + numberParts[1].substr(0, LABEL_DECIMALS);
91
- };
92
- /**
93
- * @hidden
94
- */
95
- var calculateRatio = function (min, max, value) { return Math.max((value - min) / (max - min), MIN_RATIO); };
96
- /**
97
- * @hidden
98
- */
99
- var extractValueFromChanges = function (changes, type, value) {
100
- return changes[type] && changes[type].currentValue !== undefined ? changes[type].currentValue : value;
101
- };
102
- /**
103
- * @hidden
104
- */
105
- var runAnimation = function (changes, animation, previousValue, displayValue) { return animation && typeof requestAnimationFrame !== 'undefined' && changes.value && previousValue !== displayValue; };
106
- /**
107
- * @hidden
108
- */
109
- var stopCurrentAnimation = function (changes) {
110
- var isAnimationChanged = Boolean(changes.animation);
111
- var hasAnimation = isAnimationChanged && changes.animation.currentValue;
112
- return isAnimationChanged && !hasAnimation;
113
- };
114
-
115
- /**
116
- * @hidden
117
- */
118
- var ProgressBarBase = /** @class */ (function () {
119
- /**
120
- * @hidden
121
- */
122
- function ProgressBarBase(localization) {
123
- var _this = this;
124
- this.localization = localization;
125
- this.widgetClasses = true;
126
- this.roleAttribute = 'progressbar';
127
- /**
128
- * The maximum value of the ProgressBar.
129
- * Defaults to `100`.
130
- */
131
- this.max = 100;
132
- /**
133
- * The minimum value of the ProgressBar.
134
- * Defaults to `0`.
135
- */
136
- this.min = 0;
137
- /**
138
- * The value of the ProgressBar.
139
- * Has to be between `min` and `max`.
140
- * By default, the value is equal to the `min` value.
141
- */
142
- /**
143
- * The value of the ProgressBar.
144
- * Has to be between `min` and `max`.
145
- * Defaults to `0`.
146
- */
147
- this.value = 0;
148
- /**
149
- * Defines the orientation of the ProgressBar
150
- * ([see example]({% slug progressbar_orientation %})).
151
- * Defaults to `horizontal`.
152
- */
153
- this.orientation = 'horizontal';
154
- /**
155
- * If set to `true`, the ProgressBar will be disabled
156
- * ([see example]({% slug progressbar_disabled %})).
157
- * It will still allow you to change its value.
158
- * Defaults to `false`.
159
- */
160
- this.disabled = false;
161
- /**
162
- * If set to `true`, the ProgressBar will be reversed
163
- * ([see example]({% slug progressbar_direction %})).
164
- * Defaults to `false`.
165
- */
166
- this.reverse = false;
167
- /**
168
- * Sets the `indeterminate` state of the ProgressBar.
169
- * Defaults to `false`.
170
- */
171
- this.indeterminate = false;
172
- this.displayValue = 0;
173
- this.previousValue = 0;
174
- validatePackage(packageMetadata);
175
- this.localizationChangeSubscription = localization.changes.subscribe(function (_a) {
176
- var rtl = _a.rtl;
177
- _this.direction = rtl ? 'rtl' : 'ltr';
178
- });
179
- }
180
- Object.defineProperty(ProgressBarBase.prototype, "isHorizontal", {
181
- get: function () {
182
- return this.orientation === 'horizontal';
183
- },
184
- enumerable: true,
185
- configurable: true
186
- });
187
- Object.defineProperty(ProgressBarBase.prototype, "isVertical", {
188
- get: function () {
189
- return this.orientation === 'vertical';
190
- },
191
- enumerable: true,
192
- configurable: true
193
- });
194
- Object.defineProperty(ProgressBarBase.prototype, "disabledClass", {
195
- get: function () {
196
- return this.disabled;
197
- },
198
- enumerable: true,
199
- configurable: true
200
- });
201
- Object.defineProperty(ProgressBarBase.prototype, "reverseClass", {
202
- get: function () {
203
- return this.reverse;
204
- },
205
- enumerable: true,
206
- configurable: true
207
- });
208
- Object.defineProperty(ProgressBarBase.prototype, "indeterminateClass", {
209
- get: function () {
210
- return this.indeterminate;
211
- },
212
- enumerable: true,
213
- configurable: true
214
- });
215
- Object.defineProperty(ProgressBarBase.prototype, "dirAttribute", {
216
- get: function () {
217
- return this.direction;
218
- },
219
- enumerable: true,
220
- configurable: true
221
- });
222
- Object.defineProperty(ProgressBarBase.prototype, "ariaMinAttribute", {
223
- get: function () {
224
- return String(this.min);
225
- },
226
- enumerable: true,
227
- configurable: true
228
- });
229
- Object.defineProperty(ProgressBarBase.prototype, "ariaMaxAttribute", {
230
- get: function () {
231
- return String(this.max);
232
- },
233
- enumerable: true,
234
- configurable: true
235
- });
236
- Object.defineProperty(ProgressBarBase.prototype, "ariaValueAttribute", {
237
- get: function () {
238
- return this.indeterminate ? undefined : String(this.displayValue);
239
- },
240
- enumerable: true,
241
- configurable: true
242
- });
243
- Object.defineProperty(ProgressBarBase.prototype, "isCompleted", {
244
- /**
245
- * @hidden
246
- */
247
- get: function () {
248
- return this.value === this.max;
249
- },
250
- enumerable: true,
251
- configurable: true
252
- });
253
- Object.defineProperty(ProgressBarBase.prototype, "statusWidth", {
254
- /**
255
- * @hidden
256
- */
257
- get: function () {
258
- return this.orientation === 'horizontal' ? this._progressRatio * 100 : 100;
259
- },
260
- enumerable: true,
261
- configurable: true
262
- });
263
- Object.defineProperty(ProgressBarBase.prototype, "statusHeight", {
264
- /**
265
- * @hidden
266
- */
267
- get: function () {
268
- return this.orientation === 'vertical' ? this._progressRatio * 100 : 100;
269
- },
270
- enumerable: true,
271
- configurable: true
272
- });
273
- Object.defineProperty(ProgressBarBase.prototype, "statusWrapperWidth", {
274
- /**
275
- * @hidden
276
- */
277
- get: function () {
278
- return this.orientation === 'horizontal' ? 100 / this._progressRatio : 100;
279
- },
280
- enumerable: true,
281
- configurable: true
282
- });
283
- Object.defineProperty(ProgressBarBase.prototype, "statusWrapperHeight", {
284
- /**
285
- * @hidden
286
- */
287
- get: function () {
288
- return this.orientation === 'vertical' ? 100 / this._progressRatio : 100;
289
- },
290
- enumerable: true,
291
- configurable: true
292
- });
293
- Object.defineProperty(ProgressBarBase.prototype, "_progressRatio", {
294
- get: function () {
295
- return calculateRatio(this.min, this.max, this.displayValue);
296
- },
297
- enumerable: true,
298
- configurable: true
299
- });
300
- ProgressBarBase.prototype.ngOnChanges = function (changes) {
301
- var min = extractValueFromChanges(changes, 'min', this.min);
302
- var max = extractValueFromChanges(changes, 'max', this.max);
303
- var value = extractValueFromChanges(changes, 'value', this.value);
304
- if (changes.min || changes.max || changes.value) {
305
- if (changes.min || changes.max) {
306
- validateRange(min, max);
307
- }
308
- if (changes.value) {
309
- if (value == null || Number.isNaN(value)) {
310
- this.value = min;
311
- }
312
- var previousValue = this.displayValue;
313
- this.displayValue = adjustValueToRange(this.min, this.max, value);
314
- this.previousValue = previousValue;
315
- }
316
- this.min = min;
317
- this.max = max;
318
- this.displayValue = adjustValueToRange(this.min, this.max, value);
319
- }
320
- };
321
- ProgressBarBase.prototype.ngOnDestroy = function () {
322
- if (this.localizationChangeSubscription) {
323
- this.localizationChangeSubscription.unsubscribe();
324
- }
325
- };
326
- __decorate([
327
- HostBinding('class.k-widget'),
328
- HostBinding('class.k-progressbar'),
329
- __metadata("design:type", Boolean)
330
- ], ProgressBarBase.prototype, "widgetClasses", void 0);
331
- __decorate([
332
- HostBinding('class.k-progressbar-horizontal'),
333
- __metadata("design:type", Boolean),
334
- __metadata("design:paramtypes", [])
335
- ], ProgressBarBase.prototype, "isHorizontal", null);
336
- __decorate([
337
- HostBinding('class.k-progressbar-vertical'),
338
- __metadata("design:type", Boolean),
339
- __metadata("design:paramtypes", [])
340
- ], ProgressBarBase.prototype, "isVertical", null);
341
- __decorate([
342
- HostBinding('class.k-state-disabled'),
343
- __metadata("design:type", Boolean),
344
- __metadata("design:paramtypes", [])
345
- ], ProgressBarBase.prototype, "disabledClass", null);
346
- __decorate([
347
- HostBinding('class.k-progressbar-reverse'),
348
- __metadata("design:type", Boolean),
349
- __metadata("design:paramtypes", [])
350
- ], ProgressBarBase.prototype, "reverseClass", null);
351
- __decorate([
352
- HostBinding('class.k-progressbar-indeterminate'),
353
- __metadata("design:type", Boolean),
354
- __metadata("design:paramtypes", [])
355
- ], ProgressBarBase.prototype, "indeterminateClass", null);
356
- __decorate([
357
- HostBinding('attr.dir'),
358
- __metadata("design:type", String),
359
- __metadata("design:paramtypes", [])
360
- ], ProgressBarBase.prototype, "dirAttribute", null);
361
- __decorate([
362
- HostBinding('attr.role'),
363
- __metadata("design:type", String)
364
- ], ProgressBarBase.prototype, "roleAttribute", void 0);
365
- __decorate([
366
- HostBinding('attr.aria-valuemin'),
367
- __metadata("design:type", String),
368
- __metadata("design:paramtypes", [])
369
- ], ProgressBarBase.prototype, "ariaMinAttribute", null);
370
- __decorate([
371
- HostBinding('attr.aria-valuemax'),
372
- __metadata("design:type", String),
373
- __metadata("design:paramtypes", [])
374
- ], ProgressBarBase.prototype, "ariaMaxAttribute", null);
375
- __decorate([
376
- HostBinding('attr.aria-valuenow'),
377
- __metadata("design:type", String),
378
- __metadata("design:paramtypes", [])
379
- ], ProgressBarBase.prototype, "ariaValueAttribute", null);
380
- __decorate([
381
- Input(),
382
- __metadata("design:type", Number)
383
- ], ProgressBarBase.prototype, "max", void 0);
384
- __decorate([
385
- Input(),
386
- __metadata("design:type", Number)
387
- ], ProgressBarBase.prototype, "min", void 0);
388
- __decorate([
389
- Input(),
390
- __metadata("design:type", Number)
391
- ], ProgressBarBase.prototype, "value", void 0);
392
- __decorate([
393
- Input(),
394
- __metadata("design:type", String)
395
- ], ProgressBarBase.prototype, "orientation", void 0);
396
- __decorate([
397
- Input(),
398
- __metadata("design:type", Boolean)
399
- ], ProgressBarBase.prototype, "disabled", void 0);
400
- __decorate([
401
- Input(),
402
- __metadata("design:type", Boolean)
403
- ], ProgressBarBase.prototype, "reverse", void 0);
404
- __decorate([
405
- Input(),
406
- __metadata("design:type", Boolean)
407
- ], ProgressBarBase.prototype, "indeterminate", void 0);
408
- return ProgressBarBase;
409
- }());
410
-
411
- /**
412
- * Represents the [Kendo UI ProgressBar component for Angular]({% slug overview_progressbar %}).
413
- *
414
- * @example
415
- * ```ts-preview
416
- * _@Component({
417
- * selector: 'my-app',
418
- * template: `
419
- * <kendo-progressbar [value]="value">
420
- * </kendo-progressbar>
421
- * `
422
- * })
423
- * class AppComponent {
424
- * public value = 50;
425
- * }
426
- * ```
427
- */
428
- var ProgressBarComponent = /** @class */ (function (_super) {
429
- __extends(ProgressBarComponent, _super);
430
- /**
431
- * @hidden
432
- */
433
- function ProgressBarComponent(localization, zone, renderer) {
434
- var _this = _super.call(this, localization) || this;
435
- _this.localization = localization;
436
- _this.zone = zone;
437
- _this.renderer = renderer;
438
- /**
439
- * Determines whether the status label will be visible.
440
- * Defaults to `true`&mdash;the label will be visible and displayed with the default
441
- * `LabelSettings` having its position set to `end` and its format set to `value`.
442
- */
443
- _this.label = true;
444
- /**
445
- * The animation configuration of the ProgressBar.
446
- * Defaults to `false`.
447
- */
448
- _this.animation = false;
449
- /**
450
- * Fires when the animation which indicates the latest value change is completed.
451
- */
452
- _this.animationEnd = new EventEmitter();
453
- return _this;
454
- }
455
- Object.defineProperty(ProgressBarComponent.prototype, "showLabel", {
456
- /**
457
- * @hidden
458
- */
459
- get: function () {
460
- if (typeof this.label === 'boolean') {
461
- return this.label;
462
- }
463
- else {
464
- if (this.label && !this.label.hasOwnProperty('visible')) {
465
- this.label.visible = true;
466
- }
467
- return this.label.visible;
468
- }
469
- },
470
- enumerable: true,
471
- configurable: true
472
- });
473
- Object.defineProperty(ProgressBarComponent.prototype, "labelPosition", {
474
- /**
475
- * @hidden
476
- */
477
- get: function () {
478
- if (typeof this.label === 'boolean') {
479
- return 'end';
480
- }
481
- else {
482
- if (this.label && !this.label.hasOwnProperty('position')) {
483
- this.label.position = 'end';
484
- }
485
- return this.label.position;
486
- }
487
- },
488
- enumerable: true,
489
- configurable: true
490
- });
491
- Object.defineProperty(ProgressBarComponent.prototype, "isPositionStart", {
492
- /**
493
- * @hidden
494
- */
495
- get: function () {
496
- return this.labelPosition === 'start';
497
- },
498
- enumerable: true,
499
- configurable: true
500
- });
501
- Object.defineProperty(ProgressBarComponent.prototype, "isPositionCenter", {
502
- /**
503
- * @hidden
504
- */
505
- get: function () {
506
- return this.labelPosition === 'center';
507
- },
508
- enumerable: true,
509
- configurable: true
510
- });
511
- Object.defineProperty(ProgressBarComponent.prototype, "isPositionEnd", {
512
- /**
513
- * @hidden
514
- */
515
- get: function () {
516
- return this.labelPosition === 'end';
517
- },
518
- enumerable: true,
519
- configurable: true
520
- });
521
- Object.defineProperty(ProgressBarComponent.prototype, "formattedLabelValue", {
522
- /**
523
- * @hidden
524
- */
525
- get: function () {
526
- return formatValue(this.displayValue, this.min, this.max, this.label);
527
- },
528
- enumerable: true,
529
- configurable: true
530
- });
531
- /**
532
- * @hidden
533
- */
534
- ProgressBarComponent.prototype.ngOnChanges = function (changes) {
535
- _super.prototype.ngOnChanges.call(this, changes);
536
- if (this.isAnimationInProgress && stopCurrentAnimation(changes)) {
537
- this.cancelCurrentAnimation = true;
538
- }
539
- if (runAnimation(changes, this.animation, this.previousValue, this.displayValue) && !changes.value.firstChange) {
540
- this.startAnimation(this.previousValue);
541
- }
542
- };
543
- /**
544
- * @hidden
545
- */
546
- ProgressBarComponent.prototype.ngOnDestroy = function () {
547
- if (this.animationFrame) {
548
- cancelAnimationFrame(this.animationFrame);
549
- }
550
- };
551
- /**
552
- * @hidden
553
- */
554
- ProgressBarComponent.prototype.startAnimation = function (previousValue) {
555
- var _this = this;
556
- this.isAnimationInProgress = true;
557
- var element = this.progressStatusElement.nativeElement;
558
- var wrapperElement = this.progressStatusWrapperElement.nativeElement;
559
- var animationOptions = this.getAnimationOptions(previousValue);
560
- this.zone.runOutsideAngular(function () {
561
- if (_this.animationFrame) {
562
- cancelAnimationFrame(_this.animationFrame);
563
- }
564
- var animate = function () {
565
- var elapsed = new Date().getTime() - animationOptions.startTime;
566
- var position = Math.min(elapsed / animationOptions.duration, 1);
567
- var size = animationOptions.startSize + animationOptions.deltaSize * position;
568
- var wrapperSize = (100 / size) * 100;
569
- _this.renderValueChange(element, wrapperElement, animationOptions.property, size, wrapperSize);
570
- if (position < 1) {
571
- if (_this.cancelCurrentAnimation) {
572
- _this.resetProgress(element, wrapperElement, animationOptions.property);
573
- return;
574
- }
575
- _this.animationFrame = requestAnimationFrame(animate);
576
- }
577
- else {
578
- _this.stopAnimation(previousValue);
579
- }
580
- };
581
- animate();
582
- });
583
- };
584
- Object.defineProperty(ProgressBarComponent.prototype, "animationDuration", {
585
- /**
586
- * @hidden
587
- */
588
- get: function () {
589
- if (typeof this.animation === 'boolean') {
590
- return 400;
591
- }
592
- else {
593
- if (this.animation && !this.animation.hasOwnProperty('duration')) {
594
- this.animation.duration = 400;
595
- }
596
- return this.animation.duration;
597
- }
598
- },
599
- enumerable: true,
600
- configurable: true
601
- });
602
- ProgressBarComponent.prototype.stopAnimation = function (value) {
603
- var _this = this;
604
- if (hasObservers(this.animationEnd)) {
605
- this.zone.run(function () {
606
- _this.animationEnd.emit({
607
- from: value,
608
- to: _this.displayValue
609
- });
610
- });
611
- }
612
- this.zone.run(function () {
613
- _this.isAnimationInProgress = false;
614
- });
615
- };
616
- ProgressBarComponent.prototype.getAnimationOptions = function (value) {
617
- var isHorizontal = this.orientation === 'horizontal';
618
- var previousRatio = calculateRatio(this.min, this.max, value);
619
- var previousStatusWidth = isHorizontal ? previousRatio * 100 : 100;
620
- var previousStatusHeight = !isHorizontal ? previousRatio * 100 : 100;
621
- var property = isHorizontal ? 'width' : 'height';
622
- var startTime = new Date().getTime();
623
- var startSize = isHorizontal ? previousStatusWidth : previousStatusHeight;
624
- var deltaSize = isHorizontal ? this.statusWidth - previousStatusWidth : this.statusHeight - previousStatusHeight;
625
- var duration = this.animationDuration * Math.abs((deltaSize / 100));
626
- return {
627
- property: property,
628
- startTime: startTime,
629
- startSize: startSize,
630
- deltaSize: deltaSize,
631
- duration: duration
632
- };
633
- };
634
- ProgressBarComponent.prototype.renderValueChange = function (element, wrapperElement, property, size, wrapperSize) {
635
- this.renderer.setStyle(element, property, size + '%');
636
- this.renderer.setStyle(wrapperElement, property, wrapperSize + '%');
637
- };
638
- ProgressBarComponent.prototype.resetProgress = function (element, wrapperElement, property) {
639
- var _this = this;
640
- var size = calculateRatio(this.min, this.max, this.value);
641
- var newSize = size * 100;
642
- var newWrapperSize = 100 / size;
643
- this.renderValueChange(element, wrapperElement, property, newSize, newWrapperSize);
644
- this.zone.run(function () {
645
- _this.cancelCurrentAnimation = false;
646
- _this.isAnimationInProgress = false;
647
- });
648
- };
649
- __decorate([
650
- Input(),
651
- __metadata("design:type", Object)
652
- ], ProgressBarComponent.prototype, "label", void 0);
653
- __decorate([
654
- Input(),
655
- __metadata("design:type", Object)
656
- ], ProgressBarComponent.prototype, "progressCssStyle", void 0);
657
- __decorate([
658
- Input(),
659
- __metadata("design:type", Object)
660
- ], ProgressBarComponent.prototype, "progressCssClass", void 0);
661
- __decorate([
662
- Input(),
663
- __metadata("design:type", Object)
664
- ], ProgressBarComponent.prototype, "emptyCssStyle", void 0);
665
- __decorate([
666
- Input(),
667
- __metadata("design:type", Object)
668
- ], ProgressBarComponent.prototype, "emptyCssClass", void 0);
669
- __decorate([
670
- Input(),
671
- __metadata("design:type", Object)
672
- ], ProgressBarComponent.prototype, "animation", void 0);
673
- __decorate([
674
- Output(),
675
- __metadata("design:type", EventEmitter)
676
- ], ProgressBarComponent.prototype, "animationEnd", void 0);
677
- __decorate([
678
- ViewChild('progressStatus', { static: false }),
679
- __metadata("design:type", ElementRef)
680
- ], ProgressBarComponent.prototype, "progressStatusElement", void 0);
681
- __decorate([
682
- ViewChild('progressStatusWrap', { static: false }),
683
- __metadata("design:type", ElementRef)
684
- ], ProgressBarComponent.prototype, "progressStatusWrapperElement", void 0);
685
- ProgressBarComponent = __decorate([
686
- Component({
687
- exportAs: 'kendoProgressBar',
688
- selector: 'kendo-progressbar',
689
- 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 ",
690
- providers: [
691
- LocalizationService,
692
- {
693
- provide: L10N_PREFIX,
694
- useValue: 'kendo.progressbar'
695
- }
696
- ]
697
- }),
698
- __metadata("design:paramtypes", [LocalizationService,
699
- NgZone,
700
- Renderer2])
701
- ], ProgressBarComponent);
702
- return ProgressBarComponent;
703
- }(ProgressBarBase));
704
-
705
- /**
706
- * Represents the [Kendo UI ChunkProgressBar component for Angular]({% slug overview_chunkprogressbar %}).
707
- *
708
- * @example
709
- * ```ts-preview
710
- * _@Component({
711
- * selector: 'my-app',
712
- * template: `
713
- * <kendo-chunkprogressbar [value]="value">
714
- * </kendo-chunkprogressbar>
715
- * `
716
- * })
717
- * class AppComponent {
718
- * public value = 40;
719
- * }
720
- * ```
721
- */
722
- var ChunkProgressBarComponent = /** @class */ (function (_super) {
723
- __extends(ChunkProgressBarComponent, _super);
724
- /**
725
- * @hidden
726
- */
727
- function ChunkProgressBarComponent(localization) {
728
- var _this = _super.call(this, localization) || this;
729
- _this.localization = localization;
730
- /**
731
- * Sets the number of chunks into which the ChunkProgressBar will be split.
732
- * Defaults to `5`.
733
- */
734
- _this.chunkCount = 5;
735
- _this._orientationStyles = {
736
- width: _this.chunkSizePercentage + "%"
737
- };
738
- return _this;
739
- }
740
- Object.defineProperty(ChunkProgressBarComponent.prototype, "chunks", {
741
- /**
742
- * @hidden
743
- */
744
- get: function () {
745
- var count = this.chunkCount;
746
- var chunks = Array(count).fill(false);
747
- var completedChunks = Math.floor(this._progressRatio * count);
748
- for (var i = 0; i < completedChunks; i++) {
749
- chunks[i] = true;
750
- }
751
- if (reverseChunks(this.orientation, this.reverse)) {
752
- chunks.reverse();
753
- }
754
- return chunks;
755
- },
756
- enumerable: true,
757
- configurable: true
758
- });
759
- Object.defineProperty(ChunkProgressBarComponent.prototype, "chunkSizePercentage", {
760
- /**
761
- * @hidden
762
- */
763
- get: function () {
764
- return 100 / this.chunkCount;
765
- },
766
- enumerable: true,
767
- configurable: true
768
- });
769
- Object.defineProperty(ChunkProgressBarComponent.prototype, "orientationStyles", {
770
- /**
771
- * @hidden
772
- */
773
- get: function () {
774
- if (this.orientation === 'horizontal') {
775
- this._orientationStyles.width = this.chunkSizePercentage + "%";
776
- this._orientationStyles.height = undefined;
777
- }
778
- else {
779
- this._orientationStyles.height = this.chunkSizePercentage + "%";
780
- this._orientationStyles.width = undefined;
781
- }
782
- return this._orientationStyles;
783
- },
784
- enumerable: true,
785
- configurable: true
786
- });
787
- __decorate([
788
- Input(),
789
- __metadata("design:type", Number)
790
- ], ChunkProgressBarComponent.prototype, "chunkCount", void 0);
791
- __decorate([
792
- Input(),
793
- __metadata("design:type", Object)
794
- ], ChunkProgressBarComponent.prototype, "progressCssStyle", void 0);
795
- __decorate([
796
- Input(),
797
- __metadata("design:type", Object)
798
- ], ChunkProgressBarComponent.prototype, "progressCssClass", void 0);
799
- __decorate([
800
- Input(),
801
- __metadata("design:type", Object)
802
- ], ChunkProgressBarComponent.prototype, "emptyCssStyle", void 0);
803
- __decorate([
804
- Input(),
805
- __metadata("design:type", Object)
806
- ], ChunkProgressBarComponent.prototype, "emptyCssClass", void 0);
807
- ChunkProgressBarComponent = __decorate([
808
- Component({
809
- exportAs: 'kendoChunkProgressBar',
810
- selector: 'kendo-chunkprogressbar',
811
- 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 ",
812
- providers: [
813
- LocalizationService,
814
- {
815
- provide: L10N_PREFIX,
816
- useValue: 'kendo.chunkprogressbar'
817
- }
818
- ]
819
- }),
820
- __metadata("design:paramtypes", [LocalizationService])
821
- ], ChunkProgressBarComponent);
822
- return ChunkProgressBarComponent;
823
- }(ProgressBarBase));
824
-
825
- var COMPONENT_DIRECTIVES = [ProgressBarComponent, ChunkProgressBarComponent];
826
- var MODULES = [CommonModule];
827
- /**
828
- * Represents the [NgModule]({{ site.data.urls.angular['ngmodules'] }})
829
- * definition for the ProgressBar components.
830
- *
831
- * @example
832
- *
833
- * ```ts-no-run
834
- * // Import the ProgressBar module
835
- * import { ProgressBarModule } from '@progress/kendo-angular-progressbar';
836
- *
837
- * // The browser platform with a compiler
838
- * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
839
- *
840
- * import { NgModule } from '@angular/core';
841
- *
842
- * // Import the app component
843
- * import { AppComponent } from './app.component';
844
- *
845
- * // Define the app module
846
- * _@NgModule({
847
- * declarations: [AppComponent], // declare app component
848
- * imports: [BrowserModule, ProgressBarModule], // import ProgressBar module
849
- * bootstrap: [AppComponent]
850
- * })
851
- * export class AppModule {}
852
- *
853
- * // Compile and launch the module
854
- * platformBrowserDynamic().bootstrapModule(AppModule);
855
- *
856
- * ```
857
- */
858
- var ProgressBarModule = /** @class */ (function () {
859
- function ProgressBarModule() {
860
- }
861
- ProgressBarModule = __decorate([
862
- NgModule({
863
- declarations: COMPONENT_DIRECTIVES,
864
- exports: COMPONENT_DIRECTIVES,
865
- imports: MODULES
866
- })
867
- ], ProgressBarModule);
868
- return ProgressBarModule;
869
- }());
870
-
871
- /**
872
- * Generated bundle index. Do not edit.
873
- */
874
-
875
- export { ProgressBarBase, ProgressBarComponent, ChunkProgressBarComponent, ProgressBarModule };