@qrvey/utils 1.4.0-2 → 1.4.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.4.0-2*
1
+ # [@qrvey/utils](https://bitbucket.org/qrvey/qrvey_utils/wiki/Home) *1.4.0-3*
2
2
 
3
3
  > Helper, Utils for all Qrvey Projects
4
4
 
@@ -13,19 +13,17 @@ const columnTypeByChart_1 = require("./columnTypeByChart");
13
13
  * @param {IColumnFormatSettings} settings - IColumnFormatSettings
14
14
  */
15
15
  const defineTableChartFormat = (column, settings) => {
16
- const { aggregate, type, defaultFormat, outputFormat, selectedFormat, dateGroup, } = column;
16
+ const { aggregate, defaultFormat, outputFormat, selectedFormat, dateGroup } = column;
17
17
  const { tableType, shelfType } = settings;
18
18
  //Defaults
19
19
  const defaultText = "Default";
20
20
  const defaultNumeric = { type: "NUMERIC", format: "Numeric" };
21
- const defaultAbb = { type: "NUMERIC", format: "Abbreviated" };
22
21
  const isGroupedTable = tableType === TABLE_TYPE_1.TABLE_TYPE.GROUPED;
23
22
  const columnType = (0, columnTypeByChart_1.columnTypeByChart)(column, shelfType, CHART_GROUP_1.CHART_GROUPS.TABLES, isGroupedTable);
24
23
  const noFormatSupported = DATEGROUP_UNSUPPORT_FORMAT_1.DATEGROUP_UNSUPPORT_FORMAT.some((gp) => gp === (dateGroup === null || dateGroup === void 0 ? void 0 : dateGroup.label));
25
24
  const hasDefaultFormat = (0, __1.isEmpty)(selectedFormat) ||
26
25
  (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === defaultText ||
27
26
  (selectedFormat === null || selectedFormat === void 0 ? void 0 : selectedFormat.format) === defaultText;
28
- const isUsedAsNumericColumn = type !== columnType;
29
27
  switch (columnType) {
30
28
  case __1.COLUMN.YES_NO:
31
29
  case __1.COLUMN.PHONE:
@@ -53,21 +51,13 @@ const defineTableChartFormat = (column, settings) => {
53
51
  case __1.COLUMN.NUMERIC:
54
52
  case __1.COLUMN.RATING:
55
53
  case __1.COLUMN.SLIDEBAR: {
56
- if (isUsedAsNumericColumn) {
57
- if ((aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === __1.AGGREGATE.COUNT && hasDefaultFormat)
54
+ if (hasDefaultFormat) {
55
+ if ((aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === __1.AGGREGATE.COUNT ||
56
+ (aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === __1.AGGREGATE.DISTINCTCOUNT)
58
57
  return defaultNumeric;
59
- else if (hasDefaultFormat)
60
- return defaultAbb;
61
- else
62
- return selectedFormat || outputFormat;
63
- }
64
- else {
65
- if (hasDefaultFormat) {
66
- return Object.assign({}, column.outputFormat);
67
- }
68
- else
69
- return selectedFormat;
58
+ return defaultFormat;
70
59
  }
60
+ return selectedFormat;
71
61
  }
72
62
  }
73
63
  };
@@ -9,7 +9,7 @@ exports.getImageAnswers = void 0;
9
9
  function getImageAnswers(column) {
10
10
  const answers = (column === null || column === void 0 ? void 0 : column.answers) || [];
11
11
  return answers.map((answer) => ({
12
- answer: answer.answer || "",
12
+ answer: answer.answer,
13
13
  answerid: answer.answerid,
14
14
  answerUrl: answer.imageUrl,
15
15
  }));
@@ -10,19 +10,17 @@ import { columnTypeByChart } from "./columnTypeByChart";
10
10
  * @param {IColumnFormatSettings} settings - IColumnFormatSettings
11
11
  */
12
12
  export const defineTableChartFormat = (column, settings) => {
13
- const { aggregate, type, defaultFormat, outputFormat, selectedFormat, dateGroup, } = column;
13
+ const { aggregate, defaultFormat, outputFormat, selectedFormat, dateGroup } = column;
14
14
  const { tableType, shelfType } = settings;
15
15
  //Defaults
16
16
  const defaultText = "Default";
17
17
  const defaultNumeric = { type: "NUMERIC", format: "Numeric" };
18
- const defaultAbb = { type: "NUMERIC", format: "Abbreviated" };
19
18
  const isGroupedTable = tableType === TABLE_TYPE.GROUPED;
20
19
  const columnType = columnTypeByChart(column, shelfType, CHART_GROUPS.TABLES, isGroupedTable);
21
20
  const noFormatSupported = DATEGROUP_UNSUPPORT_FORMAT.some((gp) => gp === (dateGroup === null || dateGroup === void 0 ? void 0 : dateGroup.label));
22
21
  const hasDefaultFormat = isEmpty(selectedFormat) ||
23
22
  (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === defaultText ||
24
23
  (selectedFormat === null || selectedFormat === void 0 ? void 0 : selectedFormat.format) === defaultText;
25
- const isUsedAsNumericColumn = type !== columnType;
26
24
  switch (columnType) {
27
25
  case COLUMN.YES_NO:
28
26
  case COLUMN.PHONE:
@@ -50,21 +48,13 @@ export const defineTableChartFormat = (column, settings) => {
50
48
  case COLUMN.NUMERIC:
51
49
  case COLUMN.RATING:
52
50
  case COLUMN.SLIDEBAR: {
53
- if (isUsedAsNumericColumn) {
54
- if ((aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === AGGREGATE.COUNT && hasDefaultFormat)
51
+ if (hasDefaultFormat) {
52
+ if ((aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === AGGREGATE.COUNT ||
53
+ (aggregate === null || aggregate === void 0 ? void 0 : aggregate.label) === AGGREGATE.DISTINCTCOUNT)
55
54
  return defaultNumeric;
56
- else if (hasDefaultFormat)
57
- return defaultAbb;
58
- else
59
- return selectedFormat || outputFormat;
60
- }
61
- else {
62
- if (hasDefaultFormat) {
63
- return Object.assign({}, column.outputFormat);
64
- }
65
- else
66
- return selectedFormat;
55
+ return defaultFormat;
67
56
  }
57
+ return selectedFormat;
68
58
  }
69
59
  }
70
60
  };
@@ -6,7 +6,7 @@
6
6
  export function getImageAnswers(column) {
7
7
  const answers = (column === null || column === void 0 ? void 0 : column.answers) || [];
8
8
  return answers.map((answer) => ({
9
- answer: answer.answer || "",
9
+ answer: answer.answer,
10
10
  answerid: answer.answerid,
11
11
  answerUrl: answer.imageUrl,
12
12
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qrvey/utils",
3
- "version": "1.4.0-2",
3
+ "version": "1.4.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",