@qrvey/utils 1.18.7 → 1.18.9
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
|
@@ -88,21 +88,25 @@ function formatComparativePeriodCaption(period, allDatesText, colLabel = "") {
|
|
|
88
88
|
if (!period?.date1) {
|
|
89
89
|
return colLabel ? `${colLabel} - ${allDatesText}` : allDatesText;
|
|
90
90
|
}
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
const d1 = period.formattedDate1 ?? period.date1;
|
|
92
|
+
const d2 = period.formattedDate2 ?? period.date2;
|
|
93
|
+
const dateRange = period.date2 ? `${d1} - ${d2}` : d1;
|
|
94
94
|
return colLabel ? `${colLabel} - ${dateRange}` : dateRange;
|
|
95
95
|
}
|
|
96
96
|
function formatDeltaDefaultCaption(referencePeriod, compareTo, allDatesText, colLabel = "") {
|
|
97
97
|
const fmtPeriodFn = (p) => {
|
|
98
98
|
if (!p?.date1)
|
|
99
99
|
return allDatesText;
|
|
100
|
-
|
|
100
|
+
const d1 = p.formattedDate1 ?? p.date1;
|
|
101
|
+
const d2 = p.formattedDate2 ?? p.date2;
|
|
102
|
+
return p.date2 ? `${d1} - ${d2}` : d1;
|
|
101
103
|
};
|
|
102
104
|
const ref = fmtPeriodFn(referencePeriod);
|
|
103
105
|
const cmp = fmtPeriodFn(compareTo);
|
|
104
106
|
const comparison = ref && cmp ? `${ref} vs ${cmp}` : ref || cmp;
|
|
105
|
-
const prefix = colLabel
|
|
107
|
+
const prefix = colLabel
|
|
108
|
+
? `${exports.DELTA_COLUMN_PREFIX} ${colLabel}`
|
|
109
|
+
: exports.DELTA_COLUMN_PREFIX;
|
|
106
110
|
return comparison ? `${prefix} - ${comparison}` : prefix;
|
|
107
111
|
}
|
|
108
112
|
function computeComparativeVirtualColumns(isGrouped, myBus, chart, getChartColumns) {
|
|
@@ -340,7 +344,7 @@ function buildComparativeChartComparison(myBus, chart, groups) {
|
|
|
340
344
|
return null;
|
|
341
345
|
const validationType = mapOperatorToValidationType(operatorLabel);
|
|
342
346
|
const expression = {
|
|
343
|
-
groupValue: "day",
|
|
347
|
+
groupValue: periodData.groupValue || "day",
|
|
344
348
|
questionid: dateColumn,
|
|
345
349
|
qrveyid,
|
|
346
350
|
questionType,
|
|
@@ -441,7 +445,9 @@ function computeDeltaCellContent(comparativeAnalisis, columnKey, rawValue, optio
|
|
|
441
445
|
const compValueProvided = options != null &&
|
|
442
446
|
Object.prototype.hasOwnProperty.call(options, "comparisonValue");
|
|
443
447
|
const compVal = options?.comparisonValue;
|
|
444
|
-
if (compValueProvided &&
|
|
448
|
+
if (compValueProvided &&
|
|
449
|
+
(compVal == null || (typeof compVal === "number" && isNaN(compVal))) &&
|
|
450
|
+
origNum != null) {
|
|
445
451
|
parts.push(options?.missingLabel ?? "Missing");
|
|
446
452
|
}
|
|
447
453
|
else if (origNum != null &&
|
|
@@ -70,21 +70,25 @@ export function formatComparativePeriodCaption(period, allDatesText, colLabel =
|
|
|
70
70
|
if (!period?.date1) {
|
|
71
71
|
return colLabel ? `${colLabel} - ${allDatesText}` : allDatesText;
|
|
72
72
|
}
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
const d1 = period.formattedDate1 ?? period.date1;
|
|
74
|
+
const d2 = period.formattedDate2 ?? period.date2;
|
|
75
|
+
const dateRange = period.date2 ? `${d1} - ${d2}` : d1;
|
|
76
76
|
return colLabel ? `${colLabel} - ${dateRange}` : dateRange;
|
|
77
77
|
}
|
|
78
78
|
export function formatDeltaDefaultCaption(referencePeriod, compareTo, allDatesText, colLabel = "") {
|
|
79
79
|
const fmtPeriodFn = (p) => {
|
|
80
80
|
if (!p?.date1)
|
|
81
81
|
return allDatesText;
|
|
82
|
-
|
|
82
|
+
const d1 = p.formattedDate1 ?? p.date1;
|
|
83
|
+
const d2 = p.formattedDate2 ?? p.date2;
|
|
84
|
+
return p.date2 ? `${d1} - ${d2}` : d1;
|
|
83
85
|
};
|
|
84
86
|
const ref = fmtPeriodFn(referencePeriod);
|
|
85
87
|
const cmp = fmtPeriodFn(compareTo);
|
|
86
88
|
const comparison = ref && cmp ? `${ref} vs ${cmp}` : ref || cmp;
|
|
87
|
-
const prefix = colLabel
|
|
89
|
+
const prefix = colLabel
|
|
90
|
+
? `${DELTA_COLUMN_PREFIX} ${colLabel}`
|
|
91
|
+
: DELTA_COLUMN_PREFIX;
|
|
88
92
|
return comparison ? `${prefix} - ${comparison}` : prefix;
|
|
89
93
|
}
|
|
90
94
|
export function computeComparativeVirtualColumns(isGrouped, myBus, chart, getChartColumns) {
|
|
@@ -322,7 +326,7 @@ export function buildComparativeChartComparison(myBus, chart, groups) {
|
|
|
322
326
|
return null;
|
|
323
327
|
const validationType = mapOperatorToValidationType(operatorLabel);
|
|
324
328
|
const expression = {
|
|
325
|
-
groupValue: "day",
|
|
329
|
+
groupValue: periodData.groupValue || "day",
|
|
326
330
|
questionid: dateColumn,
|
|
327
331
|
qrveyid,
|
|
328
332
|
questionType,
|
|
@@ -423,7 +427,9 @@ export function computeDeltaCellContent(comparativeAnalisis, columnKey, rawValue
|
|
|
423
427
|
const compValueProvided = options != null &&
|
|
424
428
|
Object.prototype.hasOwnProperty.call(options, "comparisonValue");
|
|
425
429
|
const compVal = options?.comparisonValue;
|
|
426
|
-
if (compValueProvided &&
|
|
430
|
+
if (compValueProvided &&
|
|
431
|
+
(compVal == null || (typeof compVal === "number" && isNaN(compVal))) &&
|
|
432
|
+
origNum != null) {
|
|
427
433
|
parts.push(options?.missingLabel ?? "Missing");
|
|
428
434
|
}
|
|
429
435
|
else if (origNum != null &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qrvey/utils",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.9",
|
|
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",
|
|
@@ -82,7 +82,8 @@
|
|
|
82
82
|
"dist/**/*"
|
|
83
83
|
],
|
|
84
84
|
"overrides": {
|
|
85
|
-
"
|
|
85
|
+
"brace-expansion": "^5.0.8",
|
|
86
|
+
"js-yaml": "4.3.0"
|
|
86
87
|
},
|
|
87
88
|
"sideEffects": false,
|
|
88
89
|
"types": "dist/index.d.ts"
|