@qrvey/utils 1.18.6 → 1.18.8

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.6*
1
+ # [@qrvey/utils](https://bitbucket.org/qrvey/qrvey_utils/wiki/Home) *1.18.8*
2
2
 
3
3
  > Helper, Utils for all Qrvey Projects
4
4
 
@@ -21,10 +21,10 @@ const format_1 = require("../format/format");
21
21
  exports.DELTA_COLUMN_PREFIX = "\u0394";
22
22
  exports.REFERENCE_COLUMN_MARKER = "\u25CF";
23
23
  function formatDeltaColumnCaption(caption) {
24
- return `${exports.DELTA_COLUMN_PREFIX} ${caption}`;
24
+ return `${exports.DELTA_COLUMN_PREFIX} ${stripColumnMarker(caption)}`;
25
25
  }
26
26
  function formatReferenceColumnCaption(caption) {
27
- return `${exports.REFERENCE_COLUMN_MARKER} ${caption}`;
27
+ return `${exports.REFERENCE_COLUMN_MARKER} ${stripColumnMarker(caption)}`;
28
28
  }
29
29
  function stripColumnMarker(caption) {
30
30
  const markers = exports.DELTA_COLUMN_PREFIX + exports.REFERENCE_COLUMN_MARKER;
@@ -63,7 +63,10 @@ function resolveComparativeColumnCaption(chartModel, columnKey, allDatesText) {
63
63
  ? `${refDataField}__${suffixType}`
64
64
  : columnKey;
65
65
  if (suffixType === "comp") {
66
- return (customLabels[dataFieldKey] ??
66
+ const customLabel = customLabels[dataFieldKey]
67
+ ? stripColumnMarker(customLabels[dataFieldKey])
68
+ : null;
69
+ return (customLabel ??
67
70
  formatComparativePeriodCaption(comparativeAnalisis.compareTo, fallbackAllDates, defaultName));
68
71
  }
69
72
  const diffCols = comparativeAnalisis?.styles?.columnDiffs?.[uniqueCode] ?? [];
@@ -85,16 +88,18 @@ function formatComparativePeriodCaption(period, allDatesText, colLabel = "") {
85
88
  if (!period?.date1) {
86
89
  return colLabel ? `${colLabel} - ${allDatesText}` : allDatesText;
87
90
  }
88
- const dateRange = period.date2
89
- ? `${period.date1}-${period.date2}`
90
- : period.date1;
91
+ const d1 = period.formattedDate1 ?? period.date1;
92
+ const d2 = period.formattedDate2 ?? period.date2;
93
+ const dateRange = period.date2 ? `${d1} - ${d2}` : d1;
91
94
  return colLabel ? `${colLabel} - ${dateRange}` : dateRange;
92
95
  }
93
96
  function formatDeltaDefaultCaption(referencePeriod, compareTo, allDatesText, colLabel = "") {
94
97
  const fmtPeriodFn = (p) => {
95
98
  if (!p?.date1)
96
99
  return allDatesText;
97
- return p.date2 ? `${p.date1}-${p.date2}` : p.date1;
100
+ const d1 = p.formattedDate1 ?? p.date1;
101
+ const d2 = p.formattedDate2 ?? p.date2;
102
+ return p.date2 ? `${d1} - ${d2}` : d1;
98
103
  };
99
104
  const ref = fmtPeriodFn(referencePeriod);
100
105
  const cmp = fmtPeriodFn(compareTo);
@@ -160,7 +165,7 @@ function expandColumnListWithComparativeColumns(columnList, comparativeVirtualCo
160
165
  col.label.trim().length > 0 &&
161
166
  col.label.trim() !== defaultName.trim();
162
167
  const refLabel = hasCustomLabel
163
- ? col.label
168
+ ? stripColumnMarker(col.label)
164
169
  : formatComparativePeriodCaption(comparativeData.referencePeriod, fallbackAllDates, defaultName);
165
170
  const customLabels = (0, get_1._get)(myBus, "store.comparativeAnalisis.customColumnLabels") ??
166
171
  (0, get_1._get)(chart, "data.v2.comparativeAnalisis.customColumnLabels") ??
@@ -253,7 +258,7 @@ function applyComparativeHeaderBorders(columns, myBus, chart) {
253
258
  if (col._comparativeLabel) {
254
259
  const titleEl = columnHeader.querySelector(".an-header-title-text");
255
260
  if (titleEl)
256
- titleEl.textContent = `${exports.REFERENCE_COLUMN_MARKER} ${col._comparativeLabel}`;
261
+ titleEl.textContent = formatReferenceColumnCaption(col._comparativeLabel);
257
262
  }
258
263
  const totalCols = cellInfo.component?.columnCount?.() ?? 0;
259
264
  if (hasVerticalBorder && cellInfo.columnIndex < totalCols - 1) {
@@ -3,10 +3,10 @@ import { addFormat } from "../format/format";
3
3
  export const DELTA_COLUMN_PREFIX = "\u0394";
4
4
  export const REFERENCE_COLUMN_MARKER = "\u25CF";
5
5
  export function formatDeltaColumnCaption(caption) {
6
- return `${DELTA_COLUMN_PREFIX} ${caption}`;
6
+ return `${DELTA_COLUMN_PREFIX} ${stripColumnMarker(caption)}`;
7
7
  }
8
8
  export function formatReferenceColumnCaption(caption) {
9
- return `${REFERENCE_COLUMN_MARKER} ${caption}`;
9
+ return `${REFERENCE_COLUMN_MARKER} ${stripColumnMarker(caption)}`;
10
10
  }
11
11
  export function stripColumnMarker(caption) {
12
12
  const markers = DELTA_COLUMN_PREFIX + REFERENCE_COLUMN_MARKER;
@@ -45,7 +45,10 @@ export function resolveComparativeColumnCaption(chartModel, columnKey, allDatesT
45
45
  ? `${refDataField}__${suffixType}`
46
46
  : columnKey;
47
47
  if (suffixType === "comp") {
48
- return (customLabels[dataFieldKey] ??
48
+ const customLabel = customLabels[dataFieldKey]
49
+ ? stripColumnMarker(customLabels[dataFieldKey])
50
+ : null;
51
+ return (customLabel ??
49
52
  formatComparativePeriodCaption(comparativeAnalisis.compareTo, fallbackAllDates, defaultName));
50
53
  }
51
54
  const diffCols = comparativeAnalisis?.styles?.columnDiffs?.[uniqueCode] ?? [];
@@ -67,16 +70,18 @@ export function formatComparativePeriodCaption(period, allDatesText, colLabel =
67
70
  if (!period?.date1) {
68
71
  return colLabel ? `${colLabel} - ${allDatesText}` : allDatesText;
69
72
  }
70
- const dateRange = period.date2
71
- ? `${period.date1}-${period.date2}`
72
- : period.date1;
73
+ const d1 = period.formattedDate1 ?? period.date1;
74
+ const d2 = period.formattedDate2 ?? period.date2;
75
+ const dateRange = period.date2 ? `${d1} - ${d2}` : d1;
73
76
  return colLabel ? `${colLabel} - ${dateRange}` : dateRange;
74
77
  }
75
78
  export function formatDeltaDefaultCaption(referencePeriod, compareTo, allDatesText, colLabel = "") {
76
79
  const fmtPeriodFn = (p) => {
77
80
  if (!p?.date1)
78
81
  return allDatesText;
79
- return p.date2 ? `${p.date1}-${p.date2}` : p.date1;
82
+ const d1 = p.formattedDate1 ?? p.date1;
83
+ const d2 = p.formattedDate2 ?? p.date2;
84
+ return p.date2 ? `${d1} - ${d2}` : d1;
80
85
  };
81
86
  const ref = fmtPeriodFn(referencePeriod);
82
87
  const cmp = fmtPeriodFn(compareTo);
@@ -142,7 +147,7 @@ export function expandColumnListWithComparativeColumns(columnList, comparativeVi
142
147
  col.label.trim().length > 0 &&
143
148
  col.label.trim() !== defaultName.trim();
144
149
  const refLabel = hasCustomLabel
145
- ? col.label
150
+ ? stripColumnMarker(col.label)
146
151
  : formatComparativePeriodCaption(comparativeData.referencePeriod, fallbackAllDates, defaultName);
147
152
  const customLabels = _get(myBus, "store.comparativeAnalisis.customColumnLabels") ??
148
153
  _get(chart, "data.v2.comparativeAnalisis.customColumnLabels") ??
@@ -235,7 +240,7 @@ export function applyComparativeHeaderBorders(columns, myBus, chart) {
235
240
  if (col._comparativeLabel) {
236
241
  const titleEl = columnHeader.querySelector(".an-header-title-text");
237
242
  if (titleEl)
238
- titleEl.textContent = `${REFERENCE_COLUMN_MARKER} ${col._comparativeLabel}`;
243
+ titleEl.textContent = formatReferenceColumnCaption(col._comparativeLabel);
239
244
  }
240
245
  const totalCols = cellInfo.component?.columnCount?.() ?? 0;
241
246
  if (hasVerticalBorder && cellInfo.columnIndex < totalCols - 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.18.6",
3
+ "version": "1.18.8",
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
- "js-yaml": "4.2.0"
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"