all files / progressbar/ progressbar.js

94.13% Statements 369/392
85.11% Branches 240/282
94.12% Functions 48/51
94.01% Lines 361/384
5 statements, 2 functions, 11 branches Ignored     
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645    10× 10× 10×       80× 80× 80× 80×     36× 36× 36× 36× 36× 36× 36× 36× 36×   145×   293× 293× 293×   293× 293×   293× 293× 293× 293× 293× 293× 293× 293× 293× 293× 293× 293× 293× 293× 293× 39×     254×     293× 293× 293× 293×   293× 293× 293× 293× 293× 293× 293× 293× 293× 293× 293× 293× 293× 293×   290×   294× 294× 294× 294× 294× 290×   294× 294× 16×     294× 294× 28×         28× 24×     294× 294× 256× 256× 256×   38×       38× 38×     294× 294× 294× 292× 292× 292×     294× 294× 294×             294× 294×   294× 164×   130× 128×     294× 294× 164×   130× 128×     294× 21×   273×   294×   392×     392× 392×     392×     639× 639× 639× 639× 639×   92× 92× 92× 92× 92× 92× 92×   148× 148× 148× 148× 148× 148× 148× 148× 148× 105× 15× 15× 15× 15× 15×     90× 90× 90× 90×   105× 102× 102× 102×             43× 39× 39× 39×         148×   293× 293×     11×   11×           12× 12×   270×     291× 21×                                                                       16× 16× 16× 10×               18× 18×   586× 586× 586× 586× 586× 586× 586× 586× 586× 586×   293× 293× 293× 293× 293× 293× 293× 293× 293× 293× 293×   587× 587× 290×     19× 22× 22×                                                 387× 387× 387× 382×   387× 26×         387× 52×         387×                         293× 293× 293× 293× 23×   293× 293× 293× 36×                                                                                                                                                                                                                      
/* istanbul ignore next */ 
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/* istanbul ignore next */ 
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    Iif (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) Eif (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "./utils/helper", "./model/progress-base", "@syncfusion/ej2-svg-base", "./utils/theme", "./model/constant", "./model/constant", "./model/index", "./model/index", "./types/linear-progress", "./types/circular-progress", "./utils/progress-animation"], function (require, exports, ej2_base_1, ej2_base_2, helper_1, progress_base_1, ej2_svg_base_1, theme_1, constant_1, constant_2, index_1, index_2, linear_progress_1, circular_progress_1, progress_animation_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var ProgressBar = (function (_super) {
        __extends(ProgressBar, _super);
        function ProgressBar(options, element) {
            var _this = _super.call(this, options, element) || this;
            _this.linear = new linear_progress_1.Linear(_this);
            _this.circular = new circular_progress_1.Circular(_this);
            _this.annotateAnimation = new progress_animation_1.ProgressAnimation();
            _this.destroyIndeterminate = false;
            _this.scaleX = 1;
            _this.scaleY = 1;
            ProgressBar_1.Inject(index_1.ProgressTooltip);
            return _this;
        }
        ProgressBar_1 = ProgressBar;
        ProgressBar.prototype.getModuleName = function () {
            return 'progressbar';
        };
        ProgressBar.prototype.preRender = function () {
            this.unWireEvents();
            this.initPrivateVariable();
            this.wireEvents();
        };
        ProgressBar.prototype.initPrivateVariable = function () {
            this.progressRect = new helper_1.Rect(0, 0, 0, 0);
            this.progressSize = new helper_1.Size(0, 0);
        };
        ProgressBar.prototype.render = function () {
            var _this = this;
            this.trigger('load', { progressBar: this });
            this.element.style.display = 'block';
            this.element.style.position = 'relative';
            this.element.setAttribute('role', 'progressbar');
            this.element.setAttribute('aria-valuemin', this.minimum.toString());
            this.element.setAttribute('aria-valuemax', this.maximum.toString());
            this.element.setAttribute('aria-valuenow', this.value ? this.value.toString() : '0');
            this.element.setAttribute('tabindex', '0');
            this.element.setAttribute('aria-label', this.labelStyle.text || 'progress bar');
            this.calculateProgressBarSize();
            this.setTheme();
            this.createSVG();
            this.argsData = { value: this.value, progressColor: this.progressColor, trackColor: this.trackColor };
            if (this.argsData.value === this.maximum) {
                this.trigger(constant_1.progressCompleted, this.argsData, function () { _this.controlRendering(); });
            }
            else {
                this.trigger(constant_1.valueChanged, this.argsData, function () { _this.controlRendering(); });
            }
        };
        ProgressBar.prototype.controlRendering = function () {
            this.renderElements();
            this.trigger('loaded', { progressBar: this });
            this.renderComplete();
            this.controlRenderedTimeStamp = new Date().getTime();
        };
        ProgressBar.prototype.calculateProgressBarSize = function () {
            var containerWidth = this.element.clientWidth || this.element.offsetWidth;
            var containerHeight = this.element.clientHeight;
            var width = (this.type === 'Linear') ? 200 : 120;
            var height = (this.type === 'Linear') ? 30 : 120;
            var padding = 10;
            var thickness = Math.max(this.progressThickness, this.trackThickness);
            height = (this.type === 'Linear' && thickness > (height - padding)) ? thickness + padding : height;
            this.progressSize.width = helper_1.stringToNumber(this.width, containerWidth) || containerWidth || width;
            this.progressSize.height = helper_1.stringToNumber(this.height, containerHeight) || containerHeight || height;
            this.progressRect.x = this.margin.left;
            this.progressRect.y = this.margin.top;
            this.progressRect.width = this.progressSize.width - (this.margin.left + this.margin.right);
            this.progressRect.height = this.progressSize.height - (this.margin.top + this.margin.bottom);
            this.initialClipRect = new helper_1.Rect(this.progressRect.x, this.progressRect.y, this.progressSize.height, this.progressSize.width);
        };
        ProgressBar.prototype.renderAnnotations = function () {
            this.renderAnnotation();
        };
        ProgressBar.prototype.renderElements = function () {
            this.createSecondaryElement();
            this.renderTrack();
            this.renderProgress();
            this.renderLabel();
            if (this.annotations.length > 0) {
                this.renderAnnotations();
            }
            this.setSecondaryElementPosition();
            if (this.tooltip.enable && !(this.tooltip.showTooltipOnHover)) {
                this.progressTooltipModule.tooltip();
            }
        };
        ProgressBar.prototype.createSecondaryElement = function () {
            var secElement = document.getElementById(this.element.id + 'Secondary_Element');
            if (this.tooltip.enable) {
                this.tooltipElement = ej2_base_2.createElement('div', {
                    id: this.element.id + '_tooltip',
                    className: 'ejSVGTooltip',
                    styles: 'pointer-events: none; position: absolute; zIndex: 1; visibility: visible'
                });
                if (secElement) {
                    this.secElement.appendChild(this.tooltipElement);
                }
            }
            var tooltipElement = document.getElementById(this.element.id + '_tooltip');
            if (secElement) {
                secElement.innerHTML = '';
                this.secElement = tooltipElement ? secElement.appendChild(tooltipElement) : secElement;
                return;
            }
            this.secElement = ej2_base_2.createElement('div', {
                id: this.element.id + 'Secondary_Element',
                styles: 'position: absolute'
            });
            this.element.appendChild(this.secElement);
            if (this.tooltipElement) {
                this.secElement.appendChild(this.tooltipElement);
            }
        };
        ProgressBar.prototype.setSecondaryElementPosition = function () {
            var element = this.secElement;
            var rect = this.element.getBoundingClientRect();
            if (ej2_svg_base_1.getElement(this.svgObject.id)) {
                var svgRect = ej2_svg_base_1.getElement(this.svgObject.id).getBoundingClientRect();
                element.style.left = Math.max(svgRect.left - rect.left, 0) + 'px';
                element.style.top = Math.max(svgRect.top - rect.top, 0) + 'px';
            }
        };
        ProgressBar.prototype.createSVG = function () {
            this.removeSvg();
            this.renderer = new ej2_svg_base_1.SvgRenderer(this.element.id);
            this.svgObject = this.renderer.createSvg({
                id: this.element.id + 'SVG',
                width: this.progressSize.width,
                height: this.progressSize.height,
                style: 'background-color:' + this.themeStyle.backgroundColor
            });
        };
        ProgressBar.prototype.clipPathElement = function () {
            this.clipPath = this.renderer.createClipPath({ 'id': this.element.id + '_clippath' });
            this.bufferClipPath = this.renderer.createClipPath({ 'id': this.element.id + '_clippathBuffer' });
        };
        ProgressBar.prototype.renderTrack = function () {
            if (this.type === 'Linear') {
                this.linear.renderLinearTrack();
            }
            else if (this.type === 'Circular') {
                this.circular.renderCircularTrack();
            }
        };
        ProgressBar.prototype.renderProgress = function () {
            this.clipPathElement();
            if (this.type === 'Linear') {
                this.linear.renderLinearProgress();
            }
            else if (this.type === 'Circular') {
                this.circular.renderCircularProgress();
            }
        };
        ProgressBar.prototype.renderLabel = function () {
            if (this.type === 'Linear' && this.showProgressValue && !this.isIndeterminate) {
                this.linear.renderLinearLabel();
            }
            else if (this.type === 'Circular' && this.showProgressValue && !this.isIndeterminate) {
                this.circular.renderCircularLabel();
            }
            this.element.appendChild(this.svgObject);
        };
        ProgressBar.prototype.getPathLine = function (x, width, thickness) {
            var moveTo = (this.enableRtl) ? ((this.cornerRadius === 'Round') ?
                (x + this.progressRect.width) - ((constant_1.lineCapRadius / 2) * thickness) : (x + this.progressRect.width)) :
                ((this.cornerRadius === 'Round') ? (x + (constant_1.lineCapRadius / 2) * thickness) : x);
            thickness = width < thickness && this.cornerRadius === 'Round' ? width : thickness;
            var lineTo = (this.enableRtl) ? ((this.cornerRadius === 'Round' && width) ?
                (moveTo - width + (constant_1.lineCapRadius * thickness)) : (moveTo - width)) :
                ((this.cornerRadius === 'Round' && width) ? (moveTo + width - (constant_1.lineCapRadius * thickness)) : (moveTo + width));
            return 'M' + moveTo + ' ' + (this.progressRect.y + (this.progressRect.height / 2)) +
                'L' + lineTo + ' ' + (this.progressRect.y + (this.progressRect.height / 2));
        };
        ProgressBar.prototype.calculateProgressRange = function (value, minimum, maximum) {
            var min = minimum || this.minimum;
            var max = maximum || this.maximum;
            var endValue = (value - min) / (max - min) * ((this.type === 'Linear') ? 1 : this.totalAngle);
            var result = (value < min || value > max) ? 0 : endValue;
            return result;
        };
        ProgressBar.prototype.calculateSegmentSize = function (width, thickness) {
            var count = (this.type === 'Circular' && this.totalAngle === constant_1.completeAngle) ? this.segmentCount : this.segmentCount - 1;
            var cornerCount = (this.totalAngle === constant_1.completeAngle || this.type === 'Linear') ? this.segmentCount : this.segmentCount - 1;
            var gap = this.gapWidth || ((this.type === 'Linear') ? this.themeStyle.linearGapWidth : this.themeStyle.circularGapWidth);
            var size = (width - count * gap);
            size = (size - ((this.cornerRadius === 'Round') ? (cornerCount * (constant_1.lineCapRadius * thickness)) : 0)) / this.segmentCount;
            gap += (this.cornerRadius === 'Round') ? constant_1.lineCapRadius * thickness : 0;
            return ' ' + size + ' ' + gap;
        };
        ProgressBar.prototype.createClipPath = function (clipPath, range, d, refresh, thickness, isLabel, isMaximum) {
            var path;
            var rect;
            var option;
            var posx;
            var posy;
            var pathWidth;
            var x = this.progressRect.x;
            var totalWidth = this.progressRect.width;
            if (this.type === 'Linear') {
                if (this.cornerRadius === 'Round4px') {
                    posx = x;
                    pathWidth = totalWidth * range;
                    posx += (!isLabel) ? (-4) : 0;
                    posy = this.progressRect.y;
                    pathWidth += ((!isLabel && isMaximum) || this.isIndeterminate) ? 4 : 0;
                }
                else {
                    posx = (this.enableRtl && !isLabel) ? (x + totalWidth + (this.cornerRadius === 'Round' ? thickness / 10 : 0)) : x - (this.cornerRadius === 'Round' ? thickness / 10 : 0);
                    pathWidth = totalWidth * range;
                    posy = (this.progressRect.y + (this.progressRect.height / 2)) - (thickness / 2);
                    pathWidth += (this.cornerRadius === 'Round' && !isLabel) ? (constant_1.lineCapRadius * thickness) : 0;
                }
                if (!refresh) {
                    rect = new helper_1.RectOption(this.element.id + '_clippathrect' + (isLabel ? 'label' : ''), 'transparent', 1, 'transparent', 1, new helper_1.Rect(posx, posy, thickness, pathWidth));
                    path = this.renderer.drawRectangle(rect);
                    clipPath.appendChild(path);
                }
                else {
                    path = ej2_svg_base_1.getElement(this.element.id + '_clippathrect' + (isLabel ? 'label' : ''));
                    path.setAttribute('width', (pathWidth).toString());
                    if (this.isActive) {
                        path.setAttribute('x', (posx).toString());
                    }
                }
            }
            else {
                if (!refresh) {
                    option = new ej2_svg_base_1.PathOption(this.element.id + '_clippathcircle', 'transparent', 10, 'transparent', 1, '0', d);
                    path = this.renderer.drawPath(option);
                    clipPath.appendChild(path);
                }
                else {
                    path = ej2_svg_base_1.getElement(this.element.id + '_clippathcircle');
                    path.setAttribute('d', d);
                }
            }
            return path;
        };
        ProgressBar.prototype.setTheme = function () {
            this.themeStyle = theme_1.getProgressThemeColor(this.theme);
            switch (this.theme) {
                case 'Bootstrap':
                case 'Bootstrap4':
                    this.cornerRadius = this.cornerRadius === 'Auto' ?
                        ((this.type === 'Linear') ? 'Round4px' : 'Round') : this.cornerRadius;
                    break;
                case 'Fluent2':
                case 'Fluent2Dark':
                case 'Fluent2HighContrast':
                case 'Bootstrap5':
                case 'Bootstrap5Dark':
                    this.cornerRadius = this.cornerRadius === 'Auto' && this.type === 'Linear' ? 'Round' : this.cornerRadius;
                    break;
                default:
                    this.cornerRadius = this.cornerRadius === 'Auto' ? 'Square' : this.cornerRadius;
            }
        };
        ProgressBar.prototype.renderAnnotation = function () {
            if (this.progressAnnotationModule && this.annotations.length > 0) {
                this.progressAnnotationModule.renderAnnotations(this.secElement);
            }
        };
        ProgressBar.prototype.progressResize = function () {
            var _this = this;
            Eif (!(new Date().getTime() > this.controlRenderedTimeStamp + 800)) {
                return false;
            }
            var arg = {
                bar: this,
                name: 'resized',
                currentSize: new helper_1.Size(0, 0),
                previousSize: new helper_1.Size(this.progressSize.width, this.progressSize.height),
                cancel: (this.cancelResize) ? true : false
            };
            if (this.resizeTo) {
                clearTimeout(this.resizeTo);
            }
            this.resizeTo = setTimeout(function () {
                if (_this.isDestroyed) {
                    clearTimeout(_this.resizeTo);
                    return;
                }
                arg.currentSize = _this.progressSize;
                _this.trigger('resized', arg);
                if ((_this.width === null || _this.height === null || _this.width.indexOf('%') > -1 || _this.height.indexOf('%') > -1)
                    && !arg.cancel) {
                    if (_this.secElement) {
                        _this.secElement.innerHTML = '';
                    }
                    _this.calculateProgressBarSize();
                    _this.createSVG();
                    _this.renderElements();
                }
            }, 500);
            return false;
        };
        ProgressBar.prototype.progressMouseClick = function (e) {
            this.mouseEvent(constant_2.mouseClick, e);
        };
        ProgressBar.prototype.progressMouseDown = function (e) {
            this.mouseEvent(constant_2.mouseDown, e);
        };
        ProgressBar.prototype.progressMouseMove = function (e) {
            this.mouseEvent(constant_2.mouseMove, e);
            var target = e.target;
            if (this.tooltip.enable && this.tooltip.showTooltipOnHover) {
                if (target.id.indexOf('Circularprogress') >= 0 || target.id.indexOf('Circularbuffer') >= 0 || target.id.indexOf('Linearprogress') >= 0 || target.id.indexOf('Linearbuffer') >= 0 || target.id.indexOf('Linearbuffer') >= 0) {
                    this.progressTooltipModule.tooltip(e);
                }
                else Eif (this.progressTooltipModule.isRendered) {
                    this.progressTooltipModule.removeTooltip(1000);
                    this.progressTooltipModule.isRendered = false;
                }
            }
        };
        ProgressBar.prototype.progressMouseUp = function (e) {
            this.mouseEvent(constant_2.mouseUp, e);
        };
        ProgressBar.prototype.progressMouseLeave = function (e) {
            this.mouseEvent(constant_2.mouseLeave, e);
        };
        ProgressBar.prototype.mouseEvent = function (eventName, e) {
            var element = e.target;
            this.trigger(eventName, { target: element.id });
        };
        ProgressBar.prototype.unWireEvents = function () {
            var startEvent = ej2_base_1.Browser.touchStartEvent;
            var moveEvent = ej2_base_1.Browser.touchMoveEvent;
            var stopEvent = ej2_base_1.Browser.touchEndEvent;
            var cancelEvent = ej2_base_1.Browser.isPointer ? 'pointerleave' : 'mouseleave';
            ej2_base_1.EventHandler.remove(this.element, 'click', this.progressMouseClick);
            ej2_base_1.EventHandler.remove(this.element, startEvent, this.progressMouseDown);
            ej2_base_1.EventHandler.remove(this.element, moveEvent, this.progressMouseMove);
            ej2_base_1.EventHandler.remove(this.element, stopEvent, this.progressMouseUp);
            ej2_base_1.EventHandler.remove(this.element, cancelEvent, this.progressMouseLeave);
            window.removeEventListener((ej2_base_1.Browser.isTouch && ('orientation' in window && 'onorientationchange' in window)) ? 'orientationchange' : 'resize', this.resizeBounds);
        };
        ProgressBar.prototype.wireEvents = function () {
            var startEvent = ej2_base_1.Browser.touchStartEvent;
            var moveEvent = ej2_base_1.Browser.touchMoveEvent;
            var stopEvent = ej2_base_1.Browser.touchEndEvent;
            var cancelEvent = ej2_base_1.Browser.isPointer ? 'pointerleave' : 'mouseleave';
            ej2_base_1.EventHandler.add(this.element, 'click', this.progressMouseClick, this);
            ej2_base_1.EventHandler.add(this.element, startEvent, this.progressMouseDown, this);
            ej2_base_1.EventHandler.add(this.element, moveEvent, this.progressMouseMove, this);
            ej2_base_1.EventHandler.add(this.element, stopEvent, this.progressMouseUp, this);
            ej2_base_1.EventHandler.add(this.element, cancelEvent, this.progressMouseLeave, this);
            this.resizeBounds = this.progressResize.bind(this);
            window.addEventListener((ej2_base_1.Browser.isTouch && ('orientation' in window && 'onorientationchange' in window)) ? 'orientationchange' : 'resize', this.resizeBounds);
        };
        ProgressBar.prototype.removeSvg = function () {
            var svgElement = document.getElementById(this.element.id + 'SVG');
            if (svgElement) {
                ej2_base_2.remove(svgElement);
            }
        };
        ProgressBar.prototype.onPropertyChanged = function (newProp, oldProp) {
            for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
                var prop = _a[_i];
                switch (prop) {
                    case 'annotations':
                        this.secElement.innerHTML = '';
                        this.renderAnnotation();
                        break;
                    case 'value':
                        this.cancelResize = (this.animation.enable) ? true : false;
                        this.argsData = {
                            value: this.value,
                            progressColor: this.argsData.progressColor,
                            trackColor: this.argsData.trackColor
                        };
                        Iif (this.argsData.value < oldProp.value && this.animation.enable) {
                            this.argsData.value = oldProp.value;
                        }
                        if (this.argsData.value === this.maximum) {
                            this.trigger(constant_1.progressCompleted, this.argsData);
                        }
                        else {
                            this.trigger(constant_1.valueChanged, this.argsData);
                        }
                        if (this.type === 'Circular') {
                            this.circular.renderCircularProgress(this.previousEndAngle, this.previousTotalEnd, !ej2_base_2.isNullOrUndefined(oldProp.value));
                            Iif (this.showProgressValue) {
                                this.circular.renderCircularLabel(true);
                            }
                            Iif (this.progressAnnotationModule && this.animation.enable && !this.isIndeterminate) {
                                this.annotateAnimation.doAnnotationAnimation(this.clipPath, this, this.annotateEnd, this.annotateTotal);
                            }
                        }
                        else {
                            this.linear.renderLinearProgress(!ej2_base_2.isNullOrUndefined(oldProp.value), this.previousWidth);
                            Iif (this.showProgressValue) {
                                this.linear.renderLinearLabel(true);
                            }
                        }
                        this.element.setAttribute('aria-valuenow', this.argsData.value ? this.argsData.value.toString() : '0');
                        break;
                    case 'animation':
                        this.createSVG();
                        this.renderElements();
                        break;
                }
            }
        };
        ProgressBar.prototype.requiredModules = function () {
            var modules = [];
            var enableAnnotation = false;
            enableAnnotation = this.annotations.some(function (value) {
                return (value.content !== null);
            });
            if (enableAnnotation) {
                modules.push({
                    member: 'ProgressAnnotation',
                    args: [this]
                });
            }
            if (this.tooltip.enable) {
                modules.push({
                    member: 'ProgressTooltip',
                    args: [this]
                });
            }
            return modules;
        };
        ProgressBar.prototype.getPersistData = function () {
            return ' ';
        };
        ProgressBar.prototype.show = function () {
            Eif (!ej2_base_2.isNullOrUndefined(this.svgObject)) {
                this.svgObject.setAttribute('visibility', 'Visible');
                if (this.isIndeterminate) {
                    this.destroyIndeterminate = false;
                    Iif (this.type === 'Linear') {
                        this.linear.renderLinearProgress(true);
                    }
                    else {
                        this.circular.renderCircularProgress(null, null, true);
                    }
                }
            }
        };
        ProgressBar.prototype.hide = function () {
            Eif (!ej2_base_2.isNullOrUndefined(this.svgObject)) {
                this.svgObject.setAttribute('visibility', 'Hidden');
                if (this.isIndeterminate) {
                    this.destroyIndeterminate = true;
                }
            }
        };
        ProgressBar.prototype.destroy = function () {
            this.unWireEvents();
            _super.prototype.destroy.call(this);
            this.removeSvg();
            if (this.isReact) {
                this.clearTemplate();
            }
            this.svgObject = null;
            this.element.classList.remove('e-progressbar');
            if (!this.refreshing) {
                this.destroyIndeterminate = true;
            }
        };
        var ProgressBar_1;
        __decorate([
            ej2_base_1.Property('Linear')
        ], ProgressBar.prototype, "type", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], ProgressBar.prototype, "value", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], ProgressBar.prototype, "secondaryProgress", void 0);
        __decorate([
            ej2_base_1.Property('')
        ], ProgressBar.prototype, "secondaryProgressColor", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], ProgressBar.prototype, "secondaryProgressThickness", void 0);
        __decorate([
            ej2_base_1.Property(0)
        ], ProgressBar.prototype, "minimum", void 0);
        __decorate([
            ej2_base_1.Property(100)
        ], ProgressBar.prototype, "maximum", void 0);
        __decorate([
            ej2_base_1.Property(0)
        ], ProgressBar.prototype, "startAngle", void 0);
        __decorate([
            ej2_base_1.Property(0)
        ], ProgressBar.prototype, "endAngle", void 0);
        __decorate([
            ej2_base_1.Property('100%')
        ], ProgressBar.prototype, "radius", void 0);
        __decorate([
            ej2_base_1.Property('100%')
        ], ProgressBar.prototype, "innerRadius", void 0);
        __decorate([
            ej2_base_1.Property(1)
        ], ProgressBar.prototype, "segmentCount", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], ProgressBar.prototype, "gapWidth", void 0);
        __decorate([
            ej2_base_1.Property('')
        ], ProgressBar.prototype, "segmentColor", void 0);
        __decorate([
            ej2_base_1.Property('Auto')
        ], ProgressBar.prototype, "cornerRadius", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], ProgressBar.prototype, "height", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], ProgressBar.prototype, "width", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], ProgressBar.prototype, "isIndeterminate", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], ProgressBar.prototype, "isActive", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], ProgressBar.prototype, "isGradient", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], ProgressBar.prototype, "isStriped", void 0);
        __decorate([
            ej2_base_1.Property('Auto')
        ], ProgressBar.prototype, "role", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], ProgressBar.prototype, "enableRtl", void 0);
        __decorate([
            ej2_base_1.Property(true)
        ], ProgressBar.prototype, "labelOnTrack", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], ProgressBar.prototype, "trackColor", void 0);
        __decorate([
            ej2_base_1.Property(null)
        ], ProgressBar.prototype, "progressColor", void 0);
        __decorate([
            ej2_base_1.Property(0)
        ], ProgressBar.prototype, "trackThickness", void 0);
        __decorate([
            ej2_base_1.Property(0)
        ], ProgressBar.prototype, "progressThickness", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], ProgressBar.prototype, "enablePieProgress", void 0);
        __decorate([
            ej2_base_1.Property('Fabric')
        ], ProgressBar.prototype, "theme", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], ProgressBar.prototype, "showProgressValue", void 0);
        __decorate([
            ej2_base_1.Property(false)
        ], ProgressBar.prototype, "enableProgressSegments", void 0);
        __decorate([
            ej2_base_1.Complex({ size: null, color: null, fontStyle: null, fontWeight: null, fontFamily: null }, progress_base_1.Font)
        ], ProgressBar.prototype, "labelStyle", void 0);
        __decorate([
            ej2_base_1.Complex({}, progress_base_1.Margin)
        ], ProgressBar.prototype, "margin", void 0);
        __decorate([
            ej2_base_1.Complex({}, progress_base_1.Animation)
        ], ProgressBar.prototype, "animation", void 0);
        __decorate([
            ej2_base_1.Complex({}, progress_base_1.TooltipSettings)
        ], ProgressBar.prototype, "tooltip", void 0);
        __decorate([
            ej2_base_1.Event()
        ], ProgressBar.prototype, "load", void 0);
        __decorate([
            ej2_base_1.Event()
        ], ProgressBar.prototype, "textRender", void 0);
        __decorate([
            ej2_base_1.Event()
        ], ProgressBar.prototype, "loaded", void 0);
        __decorate([
            ej2_base_1.Event()
        ], ProgressBar.prototype, "valueChanged", void 0);
        __decorate([
            ej2_base_1.Event()
        ], ProgressBar.prototype, "progressCompleted", void 0);
        __decorate([
            ej2_base_1.Event()
        ], ProgressBar.prototype, "animationComplete", void 0);
        __decorate([
            ej2_base_1.Event()
        ], ProgressBar.prototype, "mouseClick", void 0);
        __decorate([
            ej2_base_1.Event()
        ], ProgressBar.prototype, "mouseMove", void 0);
        __decorate([
            ej2_base_1.Event()
        ], ProgressBar.prototype, "mouseUp", void 0);
        __decorate([
            ej2_base_1.Event()
        ], ProgressBar.prototype, "mouseDown", void 0);
        __decorate([
            ej2_base_1.Event()
        ], ProgressBar.prototype, "mouseLeave", void 0);
        __decorate([
            ej2_base_1.Event()
        ], ProgressBar.prototype, "tooltipRender", void 0);
        __decorate([
            ej2_base_1.Collection([{}], index_2.ProgressAnnotationSettings)
        ], ProgressBar.prototype, "annotations", void 0);
        __decorate([
            ej2_base_1.Collection([{}], progress_base_1.RangeColor)
        ], ProgressBar.prototype, "rangeColors", void 0);
        ProgressBar = ProgressBar_1 = __decorate([
            ej2_base_1.NotifyPropertyChanges
        ], ProgressBar);
        return ProgressBar;
    }(ej2_base_1.Component));
    exports.ProgressBar = ProgressBar;
});