@qrvey/utils 1.5.0-2 → 1.5.0-3
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 +1 -1
- package/dist/cjs/column_format/helpers/defineTableChartFormat.js +19 -10
- package/dist/cjs/dates/constants/DATETIME_COLUMN_FORMAT.js +1 -0
- package/dist/column_format/helpers/defineTableChartFormat.js +19 -10
- package/dist/dates/constants/DATETIME_COLUMN_FORMAT.js +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ const TABLE_TYPE_1 = require("../constants/TABLE_TYPE");
|
|
|
10
10
|
const columnTypeByChart_1 = require("./columnTypeByChart");
|
|
11
11
|
const CALCULATION_LABEL_1 = require("../../qrvey/constants/CALCULATION_LABEL");
|
|
12
12
|
const DATEGROUP_UNSUPPORT_FORMAT_1 = require("../constants/DATEGROUP_UNSUPPORT_FORMAT");
|
|
13
|
+
const DURATION_PARTS_LIST_1 = require("../constants/DURATION_PARTS_LIST");
|
|
13
14
|
/**
|
|
14
15
|
* It returns the format of a column based on the column type, the chart type, and the chart settings
|
|
15
16
|
* @param {IChartColumn} column - IChartColumn
|
|
@@ -60,17 +61,25 @@ const defineTableChartFormat = (column, settings) => {
|
|
|
60
61
|
case COLUMN_1.COLUMN.NUMERIC:
|
|
61
62
|
case COLUMN_1.COLUMN.RATING:
|
|
62
63
|
case COLUMN_1.COLUMN.SLIDEBAR: {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return defaultPercentage;
|
|
67
|
-
if (hasDefaultFormat) {
|
|
68
|
-
if ((aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === AGGREGATE_1.AGGREGATE.COUNT ||
|
|
69
|
-
(aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === AGGREGATE_1.AGGREGATE.DISTINCTCOUNT)
|
|
70
|
-
return defaultNumeric;
|
|
71
|
-
return defaultFormat || defaultNumeric;
|
|
64
|
+
let output;
|
|
65
|
+
if (selectedFormat && selectedFormat.format !== "Default") {
|
|
66
|
+
output = selectedFormat;
|
|
72
67
|
}
|
|
73
|
-
|
|
68
|
+
else if ((calculation === null || calculation === void 0 ? void 0 : calculation.value) === CALCULATION_LABEL_1.CALCULATION_LABEL.PDIFF) {
|
|
69
|
+
output = defaultPercentage;
|
|
70
|
+
}
|
|
71
|
+
else if (isGroupedTable &&
|
|
72
|
+
((aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === AGGREGATE_1.AGGREGATE.COUNT ||
|
|
73
|
+
(aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === AGGREGATE_1.AGGREGATE.DISTINCTCOUNT)) {
|
|
74
|
+
output = defaultNumeric;
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
output = defaultFormat || defaultNumeric;
|
|
78
|
+
}
|
|
79
|
+
if (DURATION_PARTS_LIST_1.DURATION_PARTS_LIST.includes(output === null || output === void 0 ? void 0 : output.format)) {
|
|
80
|
+
output = Object.assign(Object.assign({}, output), { template: output.format, format: "Duration" });
|
|
81
|
+
}
|
|
82
|
+
return output;
|
|
74
83
|
}
|
|
75
84
|
}
|
|
76
85
|
};
|
|
@@ -7,6 +7,7 @@ import { TABLE_TYPE } from "../constants/TABLE_TYPE";
|
|
|
7
7
|
import { columnTypeByChart } from "./columnTypeByChart";
|
|
8
8
|
import { CALCULATION_LABEL } from "../../qrvey/constants/CALCULATION_LABEL";
|
|
9
9
|
import { DATEGROUP_UNSUPPORT_FORMAT } from "../constants/DATEGROUP_UNSUPPORT_FORMAT";
|
|
10
|
+
import { DURATION_PARTS_LIST } from '../constants/DURATION_PARTS_LIST';
|
|
10
11
|
/**
|
|
11
12
|
* It returns the format of a column based on the column type, the chart type, and the chart settings
|
|
12
13
|
* @param {IChartColumn} column - IChartColumn
|
|
@@ -57,17 +58,25 @@ export const defineTableChartFormat = (column, settings) => {
|
|
|
57
58
|
case COLUMN.NUMERIC:
|
|
58
59
|
case COLUMN.RATING:
|
|
59
60
|
case COLUMN.SLIDEBAR: {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return defaultPercentage;
|
|
64
|
-
if (hasDefaultFormat) {
|
|
65
|
-
if ((aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === AGGREGATE.COUNT ||
|
|
66
|
-
(aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === AGGREGATE.DISTINCTCOUNT)
|
|
67
|
-
return defaultNumeric;
|
|
68
|
-
return defaultFormat || defaultNumeric;
|
|
61
|
+
let output;
|
|
62
|
+
if (selectedFormat && selectedFormat.format !== "Default") {
|
|
63
|
+
output = selectedFormat;
|
|
69
64
|
}
|
|
70
|
-
|
|
65
|
+
else if ((calculation === null || calculation === void 0 ? void 0 : calculation.value) === CALCULATION_LABEL.PDIFF) {
|
|
66
|
+
output = defaultPercentage;
|
|
67
|
+
}
|
|
68
|
+
else if (isGroupedTable &&
|
|
69
|
+
((aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === AGGREGATE.COUNT ||
|
|
70
|
+
(aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === AGGREGATE.DISTINCTCOUNT)) {
|
|
71
|
+
output = defaultNumeric;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
output = defaultFormat || defaultNumeric;
|
|
75
|
+
}
|
|
76
|
+
if (DURATION_PARTS_LIST.includes(output === null || output === void 0 ? void 0 : output.format)) {
|
|
77
|
+
output = Object.assign(Object.assign({}, output), { template: output.format, format: "Duration" });
|
|
78
|
+
}
|
|
79
|
+
return output;
|
|
71
80
|
}
|
|
72
81
|
}
|
|
73
82
|
};
|