@qrvey/utils 1.5.0-6 → 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 +5 -4
- package/dist/cjs/filters/helpers/common/excludeFiltersByParams.js +4 -3
- package/dist/cjs/filters/helpers/common/resolveScopeConditions.js +1 -1
- package/dist/cjs/format/definition.d.ts +2 -1
- package/dist/cjs/format/definition.js +7 -5
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +1 -1
- package/dist/column_format/helpers/defineTableChartFormat.js +3 -3
- package/dist/column_format/helpers/defineXYChartFormat.js +6 -5
- package/dist/filters/helpers/common/excludeFiltersByParams.js +4 -3
- package/dist/filters/helpers/common/resolveScopeConditions.js +1 -1
- package/dist/format/definition.d.ts +2 -1
- package/dist/format/definition.js +7 -5
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_STYLE_OPTIONS.js +1 -1
- 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 &&
|
|
@@ -38,9 +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 = definition_1.STANDARD_NUMERIC_FORMATS.includes(outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format)
|
|
42
|
-
? outputFormat
|
|
43
|
-
: Object.assign(Object.assign({}, outputFormat), { template: outputFormat.format, format: "Duration" });
|
|
44
41
|
switch (columnType) {
|
|
45
42
|
case COLUMN_1.COLUMN.YES_NO:
|
|
46
43
|
case COLUMN_1.COLUMN.PHONE:
|
|
@@ -86,7 +83,11 @@ const defineXYChartFormat = (column, settings) => {
|
|
|
86
83
|
return columnDefaultFormat;
|
|
87
84
|
}
|
|
88
85
|
else if (hasDefaultFormat) {
|
|
89
|
-
|
|
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);
|
|
90
91
|
}
|
|
91
92
|
else
|
|
92
93
|
return selectedFormat;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.excludeFiltersByParams = void 0;
|
|
4
4
|
const isEmpty_1 = require("../../../general/mix/isEmpty");
|
|
5
|
+
const cloneDeep_1 = require("../../../general/object/cloneDeep");
|
|
5
6
|
/**
|
|
6
7
|
* Excludes filters from the given Filters.
|
|
7
8
|
* The validation to filter the stored filter is depending on:
|
|
@@ -22,6 +23,7 @@ function excludeFiltersByParams(filterData, params) {
|
|
|
22
23
|
return;
|
|
23
24
|
if ((0, isEmpty_1.isEmpty)(params))
|
|
24
25
|
return filterData;
|
|
26
|
+
filterData = (0, cloneDeep_1.cloneDeep)(filterData);
|
|
25
27
|
filterData.scopes = filterData.scopes
|
|
26
28
|
.map((scope) => {
|
|
27
29
|
if (resolveScopeConditions(scope, params)) {
|
|
@@ -55,8 +57,7 @@ function excludeFiltersByParams(filterData, params) {
|
|
|
55
57
|
.filter((filter) => {
|
|
56
58
|
var _a;
|
|
57
59
|
return !(0, isEmpty_1.isEmpty)(filter) &&
|
|
58
|
-
filter.selectAll
|
|
59
|
-
((_a = filter.values) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
60
|
+
(filter.selectAll || ((_a = filter.values) === null || _a === void 0 ? void 0 : _a.length) > 0);
|
|
60
61
|
}) });
|
|
61
62
|
}
|
|
62
63
|
})
|
|
@@ -71,7 +72,7 @@ function resolveScopeConditions(scope, params) {
|
|
|
71
72
|
return ((params.enableds == null || params.enableds !== scope.enabled) &&
|
|
72
73
|
((0, isEmpty_1.isEmpty)(params.scope) || scope.scope !== params.scope) &&
|
|
73
74
|
((0, isEmpty_1.isEmpty)(params.scopeid) || scope.scopeid !== params.scopeid) &&
|
|
74
|
-
scope.datasets.
|
|
75
|
+
scope.datasets.length > 0);
|
|
75
76
|
}
|
|
76
77
|
function resolveDatasetConditions(dataset, params) {
|
|
77
78
|
return ((params.enableds == null || params.enableds !== dataset.enabled) &&
|
|
@@ -25,6 +25,6 @@ function resolveScopeConditions(scope, params, letPassUndefinedProperties = fals
|
|
|
25
25
|
(letPassUndefinedProperties && scope.scopeid == null) ||
|
|
26
26
|
(letPassUndefinedParams && (0, isEmpty_1.isEmpty)(params.scopeid)) ||
|
|
27
27
|
scope.scopeid === params.scopeid) &&
|
|
28
|
-
scope.datasets.
|
|
28
|
+
scope.datasets.length > 0);
|
|
29
29
|
}
|
|
30
30
|
exports.resolveScopeConditions = resolveScopeConditions;
|
|
@@ -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" };
|
|
@@ -44,7 +44,7 @@ exports.I18N_CHART_BUILDER_STYLE_OPTIONS = {
|
|
|
44
44
|
},
|
|
45
45
|
color_settings: {
|
|
46
46
|
color_by_category: "By category",
|
|
47
|
-
color_by_value_title: "Color by
|
|
47
|
+
color_by_value_title: "Color by values",
|
|
48
48
|
match_color: "Match colors across charts",
|
|
49
49
|
select_color: "Color",
|
|
50
50
|
select_color_type: "Color type",
|
|
@@ -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,6 +1,6 @@
|
|
|
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
|
+
import { STANDARD_NUMERIC_FORMATS, } from "../../format/definition";
|
|
4
4
|
import { isEmpty } from "../../general/mix/isEmpty";
|
|
5
5
|
import { CALCULATION_LABEL } from "../../qrvey/constants/CALCULATION_LABEL";
|
|
6
6
|
import { CHART_GROUPS } from "../constants/CHART_GROUP";
|
|
@@ -35,9 +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 = STANDARD_NUMERIC_FORMATS.includes(outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format)
|
|
39
|
-
? outputFormat
|
|
40
|
-
: Object.assign(Object.assign({}, outputFormat), { template: outputFormat.format, format: "Duration" });
|
|
41
38
|
switch (columnType) {
|
|
42
39
|
case COLUMN.YES_NO:
|
|
43
40
|
case COLUMN.PHONE:
|
|
@@ -83,7 +80,11 @@ export const defineXYChartFormat = (column, settings) => {
|
|
|
83
80
|
return columnDefaultFormat;
|
|
84
81
|
}
|
|
85
82
|
else if (hasDefaultFormat) {
|
|
86
|
-
|
|
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);
|
|
87
88
|
}
|
|
88
89
|
else
|
|
89
90
|
return selectedFormat;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isEmpty } from "../../../general/mix/isEmpty";
|
|
2
|
+
import { cloneDeep } from "../../../general/object/cloneDeep";
|
|
2
3
|
/**
|
|
3
4
|
* Excludes filters from the given Filters.
|
|
4
5
|
* The validation to filter the stored filter is depending on:
|
|
@@ -19,6 +20,7 @@ export function excludeFiltersByParams(filterData, params) {
|
|
|
19
20
|
return;
|
|
20
21
|
if (isEmpty(params))
|
|
21
22
|
return filterData;
|
|
23
|
+
filterData = cloneDeep(filterData);
|
|
22
24
|
filterData.scopes = filterData.scopes
|
|
23
25
|
.map((scope) => {
|
|
24
26
|
if (resolveScopeConditions(scope, params)) {
|
|
@@ -52,8 +54,7 @@ export function excludeFiltersByParams(filterData, params) {
|
|
|
52
54
|
.filter((filter) => {
|
|
53
55
|
var _a;
|
|
54
56
|
return !isEmpty(filter) &&
|
|
55
|
-
filter.selectAll
|
|
56
|
-
((_a = filter.values) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
57
|
+
(filter.selectAll || ((_a = filter.values) === null || _a === void 0 ? void 0 : _a.length) > 0);
|
|
57
58
|
}) });
|
|
58
59
|
}
|
|
59
60
|
})
|
|
@@ -67,7 +68,7 @@ function resolveScopeConditions(scope, params) {
|
|
|
67
68
|
return ((params.enableds == null || params.enableds !== scope.enabled) &&
|
|
68
69
|
(isEmpty(params.scope) || scope.scope !== params.scope) &&
|
|
69
70
|
(isEmpty(params.scopeid) || scope.scopeid !== params.scopeid) &&
|
|
70
|
-
scope.datasets.
|
|
71
|
+
scope.datasets.length > 0);
|
|
71
72
|
}
|
|
72
73
|
function resolveDatasetConditions(dataset, params) {
|
|
73
74
|
return ((params.enableds == null || params.enableds !== dataset.enabled) &&
|
|
@@ -22,5 +22,5 @@ export function resolveScopeConditions(scope, params, letPassUndefinedProperties
|
|
|
22
22
|
(letPassUndefinedProperties && scope.scopeid == null) ||
|
|
23
23
|
(letPassUndefinedParams && isEmpty(params.scopeid)) ||
|
|
24
24
|
scope.scopeid === params.scopeid) &&
|
|
25
|
-
scope.datasets.
|
|
25
|
+
scope.datasets.length > 0);
|
|
26
26
|
}
|
|
@@ -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" };
|
|
@@ -41,7 +41,7 @@ export const I18N_CHART_BUILDER_STYLE_OPTIONS = {
|
|
|
41
41
|
},
|
|
42
42
|
color_settings: {
|
|
43
43
|
color_by_category: "By category",
|
|
44
|
-
color_by_value_title: "Color by
|
|
44
|
+
color_by_value_title: "Color by values",
|
|
45
45
|
match_color: "Match colors across charts",
|
|
46
46
|
select_color: "Color",
|
|
47
47
|
select_color_type: "Color type",
|