@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 CHANGED
@@ -1,4 +1,4 @@
1
- # [@qrvey/utils](https://bitbucket.org/qrvey/qrvey_utils/wiki/Home) *1.5.0-2*
1
+ # [@qrvey/utils](https://bitbucket.org/qrvey/qrvey_utils/wiki/Home) *1.5.0-3*
2
2
 
3
3
  > Helper, Utils for all Qrvey Projects
4
4
 
@@ -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
- if (selectedFormat)
64
- return selectedFormat;
65
- if ((calculation === null || calculation === void 0 ? void 0 : calculation.value) === CALCULATION_LABEL_1.CALCULATION_LABEL.PDIFF)
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
- return;
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
  };
@@ -8,4 +8,5 @@ exports.DATETIME_COLUMN_FORMAT = [
8
8
  "MM/DD/YYYY HH24:MI:SS",
9
9
  "DD/MM/YYYY HH24:MI:SS",
10
10
  "YYYY-MM-DD HH24:MI:SS",
11
+ "YYYY-MM-DD HH:mm:ss",
11
12
  ];
@@ -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
- if (selectedFormat)
61
- return selectedFormat;
62
- if ((calculation === null || calculation === void 0 ? void 0 : calculation.value) === CALCULATION_LABEL.PDIFF)
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
- return;
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
  };
@@ -5,4 +5,5 @@ export const DATETIME_COLUMN_FORMAT = [
5
5
  "MM/DD/YYYY HH24:MI:SS",
6
6
  "DD/MM/YYYY HH24:MI:SS",
7
7
  "YYYY-MM-DD HH24:MI:SS",
8
+ "YYYY-MM-DD HH:mm:ss",
8
9
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.5.0-2",
3
+ "version": "1.5.0-3",
4
4
  "description": "Helper, Utils for all Qrvey Projects",
5
5
  "homepage": "https://bitbucket.org/qrvey/qrvey_utils/wiki/Home",
6
6
  "main": "dist/index.js",