@seniorsistemas/angular-components 14.5.0 → 14.5.1

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.
@@ -41,6 +41,7 @@ import * as elementResizeDetectorMaker_ from 'element-resize-detector';
41
41
  import { FocusTrapFactory, A11yModule } from '@angular/cdk/a11y';
42
42
  import { ScrollPanelModule } from 'primeng/scrollpanel';
43
43
  import { Sidebar, SidebarModule as SidebarModule$1 } from 'primeng/sidebar';
44
+ import { BigNumber } from 'bignumber.js';
44
45
 
45
46
  var BreadcrumbComponent = /** @class */ (function () {
46
47
  function BreadcrumbComponent(activatedRoute, router) {
@@ -6284,43 +6285,43 @@ var StatsCardComponent = /** @class */ (function () {
6284
6285
  });
6285
6286
  StatsCardComponent.prototype.updateDisplayValue = function () {
6286
6287
  var _this = this;
6287
- var previousRawValue = Number(this.previousValue.replace(/[^\d]/g, ""));
6288
- var rawValue = Number(this.value.replace(/[^\d]/g, ""));
6289
- var incrementValue = Math.ceil(Math.abs(rawValue - previousRawValue) / (this.ANIMATION_DURATION_MS / this.STEP_DURATION_MS));
6290
- var incremental = previousRawValue < rawValue;
6288
+ var previousRawValue = new BigNumber(this.previousValue.replace(/\D/g, ""));
6289
+ var rawValue = new BigNumber(this.value.replace(/\D/g, ""));
6290
+ var eachAnimationDuration = new BigNumber(this.ANIMATION_DURATION_MS).dividedBy(new BigNumber(this.STEP_DURATION_MS));
6291
+ var incrementValue = rawValue.minus(previousRawValue).absoluteValue().dividedBy(eachAnimationDuration).dp(0, 7);
6292
+ var incremental = previousRawValue.isLessThan(rawValue);
6291
6293
  clearInterval(this.intervalId);
6292
6294
  this.displayValue = this.replaceNumericPositions(this.value);
6293
6295
  var counter = previousRawValue;
6294
6296
  this.intervalId = setInterval(function () {
6295
- if (incremental && counter < rawValue) {
6296
- _this.displayValue = _this.replaceNumericPositions(_this.displayValue, String(counter));
6297
- counter += incrementValue;
6297
+ if (incremental && counter.isLessThan(rawValue)) {
6298
+ _this.displayValue = _this.replaceNumericPositions(_this.displayValue, counter);
6299
+ counter = counter.plus(incrementValue);
6298
6300
  }
6299
- else if (incremental) {
6300
- _this.displayValue = _this.value;
6301
- clearInterval(_this.intervalId);
6301
+ else if (!incremental && counter.isGreaterThan(rawValue)) {
6302
+ _this.displayValue = _this.replaceNumericPositions(_this.displayValue, counter);
6303
+ counter = counter.minus(incrementValue);
6302
6304
  }
6303
- else if (!incremental && counter > rawValue) {
6304
- _this.displayValue = _this.replaceNumericPositions(_this.displayValue, String(counter));
6305
- counter -= incrementValue;
6306
- }
6307
- else if (!incremental) {
6305
+ else {
6308
6306
  _this.displayValue = _this.value;
6309
6307
  clearInterval(_this.intervalId);
6310
6308
  }
6311
6309
  }, this.STEP_DURATION_MS);
6312
6310
  };
6313
6311
  StatsCardComponent.prototype.replaceNumericPositions = function (value, newValue) {
6314
- if (newValue === void 0) { newValue = ""; }
6315
6312
  var rawValue = value.replace(/[^\d]/g, "");
6316
- var newValueString = newValue.replace(/[^\d]/g, "").padStart(rawValue.length, "0");
6313
+ var newValueString = newValue ? newValue.toString() : "";
6314
+ var formattedNewValue = newValueString
6315
+ .toString()
6316
+ .replace(/\D/g, "")
6317
+ .padStart(rawValue.length, "0");
6317
6318
  var newValueIndex = 0;
6318
6319
  return value
6319
6320
  .split("")
6320
6321
  .map(function (char) {
6321
6322
  var number = Number(char);
6322
6323
  if (number || char === "0")
6323
- return newValueString[newValueIndex++];
6324
+ return formattedNewValue[newValueIndex++];
6324
6325
  return char;
6325
6326
  })
6326
6327
  .join("");