@qrvey/utils 1.18.2 → 1.18.4

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [@qrvey/utils](https://bitbucket.org/qrvey/qrvey_utils/wiki/Home) *1.18.2*
1
+ # [@qrvey/utils](https://bitbucket.org/qrvey/qrvey_utils/wiki/Home) *1.18.4*
2
2
 
3
3
  > Helper, Utils for all Qrvey Projects
4
4
 
@@ -430,7 +430,13 @@ function computeDeltaCellContent(comparativeAnalisis, columnKey, rawValue, optio
430
430
  }
431
431
  else if (flag === "showPercent" && showPercent) {
432
432
  const origNum = options?.originalValue;
433
- if (origNum != null &&
433
+ const compValueProvided = options != null &&
434
+ Object.prototype.hasOwnProperty.call(options, "comparisonValue");
435
+ const compVal = options?.comparisonValue;
436
+ if (compValueProvided && (compVal == null || (typeof compVal === "number" && isNaN(compVal))) && origNum != null) {
437
+ parts.push(options?.missingLabel ?? "Missing");
438
+ }
439
+ else if (origNum != null &&
434
440
  typeof origNum === "number" &&
435
441
  isFinite(origNum) &&
436
442
  origNum !== 0) {
@@ -45,6 +45,8 @@ export interface IComparativeStyles {
45
45
  }
46
46
  export interface FormatDeltaCellOptions {
47
47
  originalValue?: number;
48
+ comparisonValue?: number | null;
49
+ missingLabel?: string;
48
50
  format?: any;
49
51
  locale?: any;
50
52
  }
@@ -413,7 +413,13 @@ export function computeDeltaCellContent(comparativeAnalisis, columnKey, rawValue
413
413
  }
414
414
  else if (flag === "showPercent" && showPercent) {
415
415
  const origNum = options?.originalValue;
416
- if (origNum != null &&
416
+ const compValueProvided = options != null &&
417
+ Object.prototype.hasOwnProperty.call(options, "comparisonValue");
418
+ const compVal = options?.comparisonValue;
419
+ if (compValueProvided && (compVal == null || (typeof compVal === "number" && isNaN(compVal))) && origNum != null) {
420
+ parts.push(options?.missingLabel ?? "Missing");
421
+ }
422
+ else if (origNum != null &&
417
423
  typeof origNum === "number" &&
418
424
  isFinite(origNum) &&
419
425
  origNum !== 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.18.2",
3
+ "version": "1.18.4",
4
4
  "description": "Helper, Utils for all Qrvey Projects",
5
5
  "homepage": "https://bitbucket.org/qrvey/qrvey_utils/wiki/Home",
6
6
  "main": "dist/cjs/index.js",