@qrvey/utils 1.18.3 → 1.18.5

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.3*
1
+ # [@qrvey/utils](https://bitbucket.org/qrvey/qrvey_utils/wiki/Home) *1.18.5*
2
2
 
3
3
  > Helper, Utils for all Qrvey Projects
4
4
 
@@ -14,6 +14,7 @@ exports.mapOperatorToValidationType = mapOperatorToValidationType;
14
14
  exports.buildComparisonExpressionValue = buildComparisonExpressionValue;
15
15
  exports.buildComparativeChartComparison = buildComparativeChartComparison;
16
16
  exports.resolveDeltaDiffInfo = resolveDeltaDiffInfo;
17
+ exports.resolveColumnOrder = resolveColumnOrder;
17
18
  exports.computeDeltaCellContent = computeDeltaCellContent;
18
19
  const get_1 = require("../general/object/get");
19
20
  const format_1 = require("../format/format");
@@ -375,6 +376,10 @@ function resolveDeltaDiffInfo(dataField, comparativeVirtualColumns, getChartColu
375
376
  }
376
377
  return { origUniqueCode: "", diffIndex: -1 };
377
378
  }
379
+ function resolveColumnOrder(chart) {
380
+ const order = (0, get_1._get)(chart, "data.v2.comparativeAnalisis.columnOrder");
381
+ return order?.length ? [...order] : undefined;
382
+ }
378
383
  function computeDeltaCellContent(comparativeAnalisis, columnKey, rawValue, options) {
379
384
  const match = columnKey.match(/^(.+?)__delta(?:_(\d+))?$/);
380
385
  if (!match)
@@ -430,8 +435,10 @@ function computeDeltaCellContent(comparativeAnalisis, columnKey, rawValue, optio
430
435
  }
431
436
  else if (flag === "showPercent" && showPercent) {
432
437
  const origNum = options?.originalValue;
438
+ const compValueProvided = options != null &&
439
+ Object.prototype.hasOwnProperty.call(options, "comparisonValue");
433
440
  const compVal = options?.comparisonValue;
434
- if (compVal === null && origNum != null) {
441
+ if (compValueProvided && (compVal == null || (typeof compVal === "number" && isNaN(compVal))) && origNum != null) {
435
442
  parts.push(options?.missingLabel ?? "Missing");
436
443
  }
437
444
  else if (origNum != null &&
@@ -23,6 +23,7 @@ export declare function resolveDeltaDiffInfo(dataField: string, comparativeVirtu
23
23
  origUniqueCode: string;
24
24
  diffIndex: number;
25
25
  };
26
+ export declare function resolveColumnOrder(chart: any): string[] | undefined;
26
27
  export interface IDifferenceColumnStyle {
27
28
  id: string;
28
29
  name: string;
@@ -358,6 +358,10 @@ export function resolveDeltaDiffInfo(dataField, comparativeVirtualColumns, getCh
358
358
  }
359
359
  return { origUniqueCode: "", diffIndex: -1 };
360
360
  }
361
+ export function resolveColumnOrder(chart) {
362
+ const order = _get(chart, "data.v2.comparativeAnalisis.columnOrder");
363
+ return order?.length ? [...order] : undefined;
364
+ }
361
365
  export function computeDeltaCellContent(comparativeAnalisis, columnKey, rawValue, options) {
362
366
  const match = columnKey.match(/^(.+?)__delta(?:_(\d+))?$/);
363
367
  if (!match)
@@ -413,8 +417,10 @@ export function computeDeltaCellContent(comparativeAnalisis, columnKey, rawValue
413
417
  }
414
418
  else if (flag === "showPercent" && showPercent) {
415
419
  const origNum = options?.originalValue;
420
+ const compValueProvided = options != null &&
421
+ Object.prototype.hasOwnProperty.call(options, "comparisonValue");
416
422
  const compVal = options?.comparisonValue;
417
- if (compVal === null && origNum != null) {
423
+ if (compValueProvided && (compVal == null || (typeof compVal === "number" && isNaN(compVal))) && origNum != null) {
418
424
  parts.push(options?.missingLabel ?? "Missing");
419
425
  }
420
426
  else if (origNum != null &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.18.3",
3
+ "version": "1.18.5",
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",