@qrvey/utils 1.5.0-8 → 1.5.0-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 +1 -1
- package/dist/cjs/column_format/helpers/defineTableChartFormat.js +3 -3
- package/dist/cjs/column_format/helpers/defineXYChartFormat.js +6 -4
- package/dist/cjs/format/definition.d.ts +2 -1
- package/dist/cjs/format/definition.js +7 -5
- package/dist/column_format/helpers/defineTableChartFormat.js +3 -3
- package/dist/column_format/helpers/defineXYChartFormat.js +6 -4
- package/dist/format/definition.d.ts +2 -1
- package/dist/format/definition.js +7 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -61,11 +61,11 @@ const defineTableChartFormat = (column, settings) => {
|
|
|
61
61
|
case COLUMN_1.COLUMN.NUMERIC:
|
|
62
62
|
case COLUMN_1.COLUMN.RATING:
|
|
63
63
|
case COLUMN_1.COLUMN.SLIDEBAR: {
|
|
64
|
-
let output;
|
|
65
64
|
if (selectedFormat && selectedFormat.format !== "Default") {
|
|
66
|
-
|
|
65
|
+
return selectedFormat;
|
|
67
66
|
}
|
|
68
|
-
|
|
67
|
+
let output;
|
|
68
|
+
if ((calculation === null || calculation === void 0 ? void 0 : calculation.value) === CALCULATION_LABEL_1.CALCULATION_LABEL.PDIFF) {
|
|
69
69
|
output = defaultPercentage;
|
|
70
70
|
}
|
|
71
71
|
else if (isGroupedTable &&
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.defineXYChartFormat = void 0;
|
|
4
4
|
const AGGREGATE_1 = require("../../charts/constants/AGGREGATE");
|
|
5
5
|
const COLUMN_1 = require("../../columns/constants/COLUMN");
|
|
6
|
+
const definition_1 = require("../../format/definition");
|
|
6
7
|
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
7
8
|
const CALCULATION_LABEL_1 = require("../../qrvey/constants/CALCULATION_LABEL");
|
|
8
9
|
const CHART_GROUP_1 = require("../constants/CHART_GROUP");
|
|
9
10
|
const DATEGROUP_UNSUPPORT_FORMAT_1 = require("../constants/DATEGROUP_UNSUPPORT_FORMAT");
|
|
10
|
-
const DURATION_PARTS_LIST_1 = require("../constants/DURATION_PARTS_LIST");
|
|
11
11
|
const STRING_FORMAT_1 = require("../constants/STRING_FORMAT");
|
|
12
12
|
const columnTypeByChart_1 = require("./columnTypeByChart");
|
|
13
13
|
/**
|
|
@@ -38,8 +38,6 @@ const defineXYChartFormat = (column, settings) => {
|
|
|
38
38
|
const hasDefaultFormat = (0, isEmpty_1.isEmpty)(selectedFormat) ||
|
|
39
39
|
(outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === defaultText ||
|
|
40
40
|
(selectedFormat === null || selectedFormat === void 0 ? void 0 : selectedFormat.format) === defaultText;
|
|
41
|
-
const newOutputFormat = DURATION_PARTS_LIST_1.DURATION_PARTS_LIST.includes(outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format)
|
|
42
|
-
? Object.assign(Object.assign({}, outputFormat), { template: outputFormat.format, format: "Duration" }) : outputFormat;
|
|
43
41
|
switch (columnType) {
|
|
44
42
|
case COLUMN_1.COLUMN.YES_NO:
|
|
45
43
|
case COLUMN_1.COLUMN.PHONE:
|
|
@@ -85,7 +83,11 @@ const defineXYChartFormat = (column, settings) => {
|
|
|
85
83
|
return columnDefaultFormat;
|
|
86
84
|
}
|
|
87
85
|
else if (hasDefaultFormat) {
|
|
88
|
-
|
|
86
|
+
if (!definition_1.STANDARD_NUMERIC_FORMATS.includes(outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format)) {
|
|
87
|
+
return Object.assign(Object.assign({}, outputFormat), { template: outputFormat.format, format: "Duration" });
|
|
88
|
+
}
|
|
89
|
+
else
|
|
90
|
+
return Object.assign({}, outputFormat);
|
|
89
91
|
}
|
|
90
92
|
else
|
|
91
93
|
return selectedFormat;
|
|
@@ -15,13 +15,14 @@ export declare const currencyISO: {
|
|
|
15
15
|
}[];
|
|
16
16
|
export declare const enum LOCALE_FORMATS {
|
|
17
17
|
DECIMAL = "Decimal",
|
|
18
|
+
NUMERIC = "Numeric",
|
|
18
19
|
CURRENCY = "Currency",
|
|
19
20
|
PERCENTAGE = "Percentage",
|
|
20
21
|
SCIENTIFIC = "Scientific",
|
|
21
22
|
ABBREVIATED = "Abbreviated",
|
|
22
23
|
DURATION = "Duration"
|
|
23
24
|
}
|
|
24
|
-
export declare const STANDARD_NUMERIC_FORMATS:
|
|
25
|
+
export declare const STANDARD_NUMERIC_FORMATS: string[];
|
|
25
26
|
export declare const enum LOCALE_STYLES {
|
|
26
27
|
DECIMAL = "decimal",
|
|
27
28
|
PERCENT = "percent",
|
|
@@ -105,11 +105,13 @@ exports.currencyISO = [
|
|
|
105
105
|
{ text: "RM (MYR)", label: "MYR" },
|
|
106
106
|
];
|
|
107
107
|
exports.STANDARD_NUMERIC_FORMATS = [
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"Percentage"
|
|
112
|
-
"Scientific"
|
|
108
|
+
"Decimal",
|
|
109
|
+
"Numeric",
|
|
110
|
+
"Currency",
|
|
111
|
+
"Percentage",
|
|
112
|
+
"Scientific",
|
|
113
|
+
"Abbreviated",
|
|
114
|
+
"Duration",
|
|
113
115
|
];
|
|
114
116
|
exports.LANG_DEFAULT = "en-US";
|
|
115
117
|
exports.CURRENCY_DEFAULT = { text: "$ (USD)", label: "USD" };
|
|
@@ -58,11 +58,11 @@ export const defineTableChartFormat = (column, settings) => {
|
|
|
58
58
|
case COLUMN.NUMERIC:
|
|
59
59
|
case COLUMN.RATING:
|
|
60
60
|
case COLUMN.SLIDEBAR: {
|
|
61
|
-
let output;
|
|
62
61
|
if (selectedFormat && selectedFormat.format !== "Default") {
|
|
63
|
-
|
|
62
|
+
return selectedFormat;
|
|
64
63
|
}
|
|
65
|
-
|
|
64
|
+
let output;
|
|
65
|
+
if ((calculation === null || calculation === void 0 ? void 0 : calculation.value) === CALCULATION_LABEL.PDIFF) {
|
|
66
66
|
output = defaultPercentage;
|
|
67
67
|
}
|
|
68
68
|
else if (isGroupedTable &&
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AGGREGATE } from "../../charts/constants/AGGREGATE";
|
|
2
2
|
import { COLUMN } from "../../columns/constants/COLUMN";
|
|
3
|
+
import { STANDARD_NUMERIC_FORMATS, } from "../../format/definition";
|
|
3
4
|
import { isEmpty } from "../../general/mix/isEmpty";
|
|
4
5
|
import { CALCULATION_LABEL } from "../../qrvey/constants/CALCULATION_LABEL";
|
|
5
6
|
import { CHART_GROUPS } from "../constants/CHART_GROUP";
|
|
6
7
|
import { DATEGROUP_UNSUPPORT_FORMAT } from "../constants/DATEGROUP_UNSUPPORT_FORMAT";
|
|
7
|
-
import { DURATION_PARTS_LIST } from "../constants/DURATION_PARTS_LIST";
|
|
8
8
|
import { STRING_FORMAT } from "../constants/STRING_FORMAT";
|
|
9
9
|
import { columnTypeByChart } from "./columnTypeByChart";
|
|
10
10
|
/**
|
|
@@ -35,8 +35,6 @@ export const defineXYChartFormat = (column, settings) => {
|
|
|
35
35
|
const hasDefaultFormat = isEmpty(selectedFormat) ||
|
|
36
36
|
(outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === defaultText ||
|
|
37
37
|
(selectedFormat === null || selectedFormat === void 0 ? void 0 : selectedFormat.format) === defaultText;
|
|
38
|
-
const newOutputFormat = DURATION_PARTS_LIST.includes(outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format)
|
|
39
|
-
? Object.assign(Object.assign({}, outputFormat), { template: outputFormat.format, format: "Duration" }) : outputFormat;
|
|
40
38
|
switch (columnType) {
|
|
41
39
|
case COLUMN.YES_NO:
|
|
42
40
|
case COLUMN.PHONE:
|
|
@@ -82,7 +80,11 @@ export const defineXYChartFormat = (column, settings) => {
|
|
|
82
80
|
return columnDefaultFormat;
|
|
83
81
|
}
|
|
84
82
|
else if (hasDefaultFormat) {
|
|
85
|
-
|
|
83
|
+
if (!STANDARD_NUMERIC_FORMATS.includes(outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format)) {
|
|
84
|
+
return Object.assign(Object.assign({}, outputFormat), { template: outputFormat.format, format: "Duration" });
|
|
85
|
+
}
|
|
86
|
+
else
|
|
87
|
+
return Object.assign({}, outputFormat);
|
|
86
88
|
}
|
|
87
89
|
else
|
|
88
90
|
return selectedFormat;
|
|
@@ -15,13 +15,14 @@ export declare const currencyISO: {
|
|
|
15
15
|
}[];
|
|
16
16
|
export declare const enum LOCALE_FORMATS {
|
|
17
17
|
DECIMAL = "Decimal",
|
|
18
|
+
NUMERIC = "Numeric",
|
|
18
19
|
CURRENCY = "Currency",
|
|
19
20
|
PERCENTAGE = "Percentage",
|
|
20
21
|
SCIENTIFIC = "Scientific",
|
|
21
22
|
ABBREVIATED = "Abbreviated",
|
|
22
23
|
DURATION = "Duration"
|
|
23
24
|
}
|
|
24
|
-
export declare const STANDARD_NUMERIC_FORMATS:
|
|
25
|
+
export declare const STANDARD_NUMERIC_FORMATS: string[];
|
|
25
26
|
export declare const enum LOCALE_STYLES {
|
|
26
27
|
DECIMAL = "decimal",
|
|
27
28
|
PERCENT = "percent",
|
|
@@ -98,11 +98,13 @@ export const currencyISO = [
|
|
|
98
98
|
{ text: "RM (MYR)", label: "MYR" },
|
|
99
99
|
];
|
|
100
100
|
export const STANDARD_NUMERIC_FORMATS = [
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"Percentage"
|
|
105
|
-
"Scientific"
|
|
101
|
+
"Decimal",
|
|
102
|
+
"Numeric",
|
|
103
|
+
"Currency",
|
|
104
|
+
"Percentage",
|
|
105
|
+
"Scientific",
|
|
106
|
+
"Abbreviated",
|
|
107
|
+
"Duration",
|
|
106
108
|
];
|
|
107
109
|
export const LANG_DEFAULT = "en-US";
|
|
108
110
|
export const CURRENCY_DEFAULT = { text: "$ (USD)", label: "USD" };
|