@qrvey/utils 1.8.0-3 → 1.8.0-5
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/charts/adapters/RequestAdapterMetric.d.ts +14 -1
- package/dist/charts/adapters/RequestAdapterMetric.js +2 -2
- package/dist/cjs/charts/adapters/RequestAdapterMetric.d.ts +14 -1
- package/dist/cjs/charts/adapters/RequestAdapterMetric.js +5 -4
- package/dist/cjs/column_format/helpers/defineXYChartFormat.js +6 -1
- package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderComparisionOptions.d.ts +5 -0
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_COMPARISION_OPTIONS.js +5 -0
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_GENERAL.js +1 -1
- package/dist/column_format/helpers/defineXYChartFormat.js +6 -1
- package/dist/globalization/interfaces/chart_builder/II18nChartBuilderComparisionOptions.d.ts +5 -0
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_COMPARISION_OPTIONS.js +5 -0
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_GENERAL.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IBColumn } from "../../columns";
|
|
2
|
+
import { CustomRangeConfig, MetricConfig, MetricCustomRange, MetricPeriod, MetricRequestPayload, MetricTimeInfo } from "../interfaces/IRequestAdapterMetric";
|
|
2
3
|
/**
|
|
3
4
|
* It takes a metric object and returns a metric request object
|
|
4
5
|
* @param {MetricConfig} metricObj - MetricConfigData
|
|
5
6
|
* @returns A function that takes in a metricObj and returns a partial metricRequest
|
|
6
7
|
*/
|
|
7
8
|
export declare const makeBodyRequestMetrics: (metricObj: MetricConfig) => Partial<MetricRequestPayload>;
|
|
9
|
+
/**
|
|
10
|
+
* It takes a date column, time data, and a custom range config and returns a metric period or metric
|
|
11
|
+
* custom range
|
|
12
|
+
* @param dateColumn - The column that contains the date data.
|
|
13
|
+
* @param timeData - {
|
|
14
|
+
* @param {CustomRangeConfig} range - CustomRangeConfig
|
|
15
|
+
* @returns An object with the following properties:
|
|
16
|
+
* - label
|
|
17
|
+
* - value
|
|
18
|
+
* - questionid
|
|
19
|
+
*/
|
|
20
|
+
export declare const metricMakeTimeData: (dateColumn: IBColumn, timeData: MetricTimeInfo, range: CustomRangeConfig) => MetricPeriod | MetricCustomRange;
|
|
@@ -53,7 +53,7 @@ const isComparison = (data) => Boolean(data === null || data === void 0 ? void 0
|
|
|
53
53
|
* - value
|
|
54
54
|
* - questionid
|
|
55
55
|
*/
|
|
56
|
-
const metricMakeTimeData = (dateColumn, timeData, range) => {
|
|
56
|
+
export const metricMakeTimeData = (dateColumn, timeData, range) => {
|
|
57
57
|
const relativObject = getConfigRelativeObjectBytimeLabel(timeData.label, range);
|
|
58
58
|
if (!isEmpty(relativObject))
|
|
59
59
|
return Object.assign(Object.assign({}, relativObject), { questionid: dateColumn.id });
|
|
@@ -83,7 +83,7 @@ const makeCustomRangeConfig = (customRangeData) => {
|
|
|
83
83
|
return { gte: startingDate };
|
|
84
84
|
if (label === TP_CUSTOM_RANGE.BEFORE && !isEmpty(startingDate))
|
|
85
85
|
return { lte: startingDate };
|
|
86
|
-
if (!isEmpty(startingDate)
|
|
86
|
+
if (!isEmpty(startingDate) || !isEmpty(endDate))
|
|
87
87
|
return { gte: startingDate, lte: endDate };
|
|
88
88
|
};
|
|
89
89
|
/**
|
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IBColumn } from "../../columns";
|
|
2
|
+
import { CustomRangeConfig, MetricConfig, MetricCustomRange, MetricPeriod, MetricRequestPayload, MetricTimeInfo } from "../interfaces/IRequestAdapterMetric";
|
|
2
3
|
/**
|
|
3
4
|
* It takes a metric object and returns a metric request object
|
|
4
5
|
* @param {MetricConfig} metricObj - MetricConfigData
|
|
5
6
|
* @returns A function that takes in a metricObj and returns a partial metricRequest
|
|
6
7
|
*/
|
|
7
8
|
export declare const makeBodyRequestMetrics: (metricObj: MetricConfig) => Partial<MetricRequestPayload>;
|
|
9
|
+
/**
|
|
10
|
+
* It takes a date column, time data, and a custom range config and returns a metric period or metric
|
|
11
|
+
* custom range
|
|
12
|
+
* @param dateColumn - The column that contains the date data.
|
|
13
|
+
* @param timeData - {
|
|
14
|
+
* @param {CustomRangeConfig} range - CustomRangeConfig
|
|
15
|
+
* @returns An object with the following properties:
|
|
16
|
+
* - label
|
|
17
|
+
* - value
|
|
18
|
+
* - questionid
|
|
19
|
+
*/
|
|
20
|
+
export declare const metricMakeTimeData: (dateColumn: IBColumn, timeData: MetricTimeInfo, range: CustomRangeConfig) => MetricPeriod | MetricCustomRange;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeBodyRequestMetrics = void 0;
|
|
3
|
+
exports.metricMakeTimeData = exports.makeBodyRequestMetrics = void 0;
|
|
4
4
|
const general_1 = require("../../general");
|
|
5
5
|
const interfaces_1 = require("../../interfaces");
|
|
6
6
|
const REQUEST_ADAPTER_1 = require("../constants/REQUEST_ADAPTER");
|
|
@@ -17,8 +17,8 @@ const makeBodyRequestMetrics = (metricObj) => {
|
|
|
17
17
|
/* Checking if the data object has a dateColumn property. If it does, it will add a period and
|
|
18
18
|
comparison property to the body object. */
|
|
19
19
|
if (isComparison(data)) {
|
|
20
|
-
body.period = metricMakeTimeData(data.dateColumn, data.timePeriod, getRangeDataPeriod(data));
|
|
21
|
-
body.comparison = metricMakeTimeData(data.dateColumn, data.comparison, getRangeDataComparison(data));
|
|
20
|
+
body.period = (0, exports.metricMakeTimeData)(data.dateColumn, data.timePeriod, getRangeDataPeriod(data));
|
|
21
|
+
body.comparison = (0, exports.metricMakeTimeData)(data.dateColumn, data.comparison, getRangeDataComparison(data));
|
|
22
22
|
}
|
|
23
23
|
return body;
|
|
24
24
|
};
|
|
@@ -62,6 +62,7 @@ const metricMakeTimeData = (dateColumn, timeData, range) => {
|
|
|
62
62
|
if (!(0, general_1.isEmpty)(relativObject))
|
|
63
63
|
return Object.assign(Object.assign({}, relativObject), { questionid: dateColumn.id });
|
|
64
64
|
};
|
|
65
|
+
exports.metricMakeTimeData = metricMakeTimeData;
|
|
65
66
|
/**
|
|
66
67
|
* Given a time label and a custom range, return a relative date config or a metric custom range.
|
|
67
68
|
* @param {TIME_PERIOD} timeLabel - TIME_PERIOD.CUSTOM_RANGE
|
|
@@ -87,7 +88,7 @@ const makeCustomRangeConfig = (customRangeData) => {
|
|
|
87
88
|
return { gte: startingDate };
|
|
88
89
|
if (label === interfaces_1.TP_CUSTOM_RANGE.BEFORE && !(0, general_1.isEmpty)(startingDate))
|
|
89
90
|
return { lte: startingDate };
|
|
90
|
-
if (!(0, general_1.isEmpty)(startingDate)
|
|
91
|
+
if (!(0, general_1.isEmpty)(startingDate) || !(0, general_1.isEmpty)(endDate))
|
|
91
92
|
return { gte: startingDate, lte: endDate };
|
|
92
93
|
};
|
|
93
94
|
/**
|
|
@@ -31,7 +31,12 @@ const defineXYChartFormat = (column, settings) => {
|
|
|
31
31
|
format: "Percentage" /* LOCALE_FORMATS.PERCENTAGE */,
|
|
32
32
|
};
|
|
33
33
|
const columnType = (0, columnTypeByChart_1.columnTypeByChart)(column, shelfType, CHART_GROUP_1.CHART_GROUPS.XY);
|
|
34
|
-
|
|
34
|
+
let stringDateGroupForDrillCategory;
|
|
35
|
+
if (typeof dateGroup === "string")
|
|
36
|
+
stringDateGroupForDrillCategory = dateGroup;
|
|
37
|
+
const noFormatSupported = DATEGROUP_UNSUPPORT_FORMAT_1.DATEGROUP_UNSUPPORT_FORMAT.some((gp) => gp === (dateGroup === null || dateGroup === void 0 ? void 0 : dateGroup.label) ||
|
|
38
|
+
gp === (timeGroup === null || timeGroup === void 0 ? void 0 : timeGroup.label) ||
|
|
39
|
+
gp === stringDateGroupForDrillCategory);
|
|
35
40
|
const isUsedAsNumericColumn = type !== columnType;
|
|
36
41
|
const columnCurrentFormat = isUsedAsNumericColumn
|
|
37
42
|
? selectedFormat
|
package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderComparisionOptions.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export interface II18nChartBuilderComparisionOptions {
|
|
2
|
+
add_column: string;
|
|
2
3
|
comparison: string;
|
|
3
4
|
change_triangle_up: string;
|
|
4
5
|
change_triangle_down: string;
|
|
5
6
|
change_none: string;
|
|
6
7
|
change_circle: string;
|
|
8
|
+
column_title: string;
|
|
9
|
+
default_column_name: string;
|
|
7
10
|
date_column: string;
|
|
8
11
|
difference_higher: string;
|
|
9
12
|
difference_lower: string;
|
|
@@ -16,7 +19,9 @@ export interface II18nChartBuilderComparisionOptions {
|
|
|
16
19
|
increasing_change: string;
|
|
17
20
|
no_change: string;
|
|
18
21
|
preposition_than: string;
|
|
22
|
+
remove: string;
|
|
19
23
|
select_option: string;
|
|
24
|
+
show_value: string;
|
|
20
25
|
type: string;
|
|
21
26
|
time_period: string;
|
|
22
27
|
type_change: string;
|
package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_COMPARISION_OPTIONS.js
CHANGED
|
@@ -3,11 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.I18N_CHART_BUILDER_COMPARISION_OPTIONS = void 0;
|
|
4
4
|
exports.I18N_CHART_BUILDER_COMPARISION_OPTIONS = {
|
|
5
5
|
comparison_options: {
|
|
6
|
+
add_column: "Add Comparison Column",
|
|
6
7
|
comparison: "Comparison",
|
|
7
8
|
change_triangle_up: "Triangle Up",
|
|
8
9
|
change_triangle_down: "Triangle Down",
|
|
9
10
|
change_none: "None",
|
|
10
11
|
change_circle: "Circle",
|
|
12
|
+
column_title: "Column",
|
|
13
|
+
default_column_name: "Comparison Column",
|
|
11
14
|
date_column: "Date Column",
|
|
12
15
|
difference_higher: "higher",
|
|
13
16
|
difference_lower: "lower",
|
|
@@ -20,7 +23,9 @@ exports.I18N_CHART_BUILDER_COMPARISION_OPTIONS = {
|
|
|
20
23
|
increasing_change: "Increasing Change",
|
|
21
24
|
no_change: "No Change",
|
|
22
25
|
preposition_than: "than",
|
|
26
|
+
remove: "Remove",
|
|
23
27
|
select_option: "Select Option",
|
|
28
|
+
show_value: "Show Value",
|
|
24
29
|
type: "Type",
|
|
25
30
|
time_period: "Time Period",
|
|
26
31
|
type_change: "% Change",
|
|
@@ -259,6 +259,6 @@ exports.I18N_CHART_BUILDER_GENERAL = {
|
|
|
259
259
|
distribution_missing: "A <i>Distribution</i> column is needed for this chart when the <i>Value</i> column is of non-numeric datatype.",
|
|
260
260
|
},
|
|
261
261
|
messages_combined: {
|
|
262
|
-
column_missing: "A <i>Category</i>, a <i>Series</i> and at least two <i>
|
|
262
|
+
column_missing: "A <i>Category</i>, a <i>Series</i> and at least two <i>Values</i> are needed for this chart.",
|
|
263
263
|
},
|
|
264
264
|
};
|
|
@@ -28,7 +28,12 @@ export const defineXYChartFormat = (column, settings) => {
|
|
|
28
28
|
format: "Percentage" /* LOCALE_FORMATS.PERCENTAGE */,
|
|
29
29
|
};
|
|
30
30
|
const columnType = columnTypeByChart(column, shelfType, CHART_GROUPS.XY);
|
|
31
|
-
|
|
31
|
+
let stringDateGroupForDrillCategory;
|
|
32
|
+
if (typeof dateGroup === "string")
|
|
33
|
+
stringDateGroupForDrillCategory = dateGroup;
|
|
34
|
+
const noFormatSupported = DATEGROUP_UNSUPPORT_FORMAT.some((gp) => gp === (dateGroup === null || dateGroup === void 0 ? void 0 : dateGroup.label) ||
|
|
35
|
+
gp === (timeGroup === null || timeGroup === void 0 ? void 0 : timeGroup.label) ||
|
|
36
|
+
gp === stringDateGroupForDrillCategory);
|
|
32
37
|
const isUsedAsNumericColumn = type !== columnType;
|
|
33
38
|
const columnCurrentFormat = isUsedAsNumericColumn
|
|
34
39
|
? selectedFormat
|
package/dist/globalization/interfaces/chart_builder/II18nChartBuilderComparisionOptions.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
export interface II18nChartBuilderComparisionOptions {
|
|
2
|
+
add_column: string;
|
|
2
3
|
comparison: string;
|
|
3
4
|
change_triangle_up: string;
|
|
4
5
|
change_triangle_down: string;
|
|
5
6
|
change_none: string;
|
|
6
7
|
change_circle: string;
|
|
8
|
+
column_title: string;
|
|
9
|
+
default_column_name: string;
|
|
7
10
|
date_column: string;
|
|
8
11
|
difference_higher: string;
|
|
9
12
|
difference_lower: string;
|
|
@@ -16,7 +19,9 @@ export interface II18nChartBuilderComparisionOptions {
|
|
|
16
19
|
increasing_change: string;
|
|
17
20
|
no_change: string;
|
|
18
21
|
preposition_than: string;
|
|
22
|
+
remove: string;
|
|
19
23
|
select_option: string;
|
|
24
|
+
show_value: string;
|
|
20
25
|
type: string;
|
|
21
26
|
time_period: string;
|
|
22
27
|
type_change: string;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
export const I18N_CHART_BUILDER_COMPARISION_OPTIONS = {
|
|
2
2
|
comparison_options: {
|
|
3
|
+
add_column: "Add Comparison Column",
|
|
3
4
|
comparison: "Comparison",
|
|
4
5
|
change_triangle_up: "Triangle Up",
|
|
5
6
|
change_triangle_down: "Triangle Down",
|
|
6
7
|
change_none: "None",
|
|
7
8
|
change_circle: "Circle",
|
|
9
|
+
column_title: "Column",
|
|
10
|
+
default_column_name: "Comparison Column",
|
|
8
11
|
date_column: "Date Column",
|
|
9
12
|
difference_higher: "higher",
|
|
10
13
|
difference_lower: "lower",
|
|
@@ -17,7 +20,9 @@ export const I18N_CHART_BUILDER_COMPARISION_OPTIONS = {
|
|
|
17
20
|
increasing_change: "Increasing Change",
|
|
18
21
|
no_change: "No Change",
|
|
19
22
|
preposition_than: "than",
|
|
23
|
+
remove: "Remove",
|
|
20
24
|
select_option: "Select Option",
|
|
25
|
+
show_value: "Show Value",
|
|
21
26
|
type: "Type",
|
|
22
27
|
time_period: "Time Period",
|
|
23
28
|
type_change: "% Change",
|
|
@@ -256,6 +256,6 @@ export const I18N_CHART_BUILDER_GENERAL = {
|
|
|
256
256
|
distribution_missing: "A <i>Distribution</i> column is needed for this chart when the <i>Value</i> column is of non-numeric datatype.",
|
|
257
257
|
},
|
|
258
258
|
messages_combined: {
|
|
259
|
-
column_missing: "A <i>Category</i>, a <i>Series</i> and at least two <i>
|
|
259
|
+
column_missing: "A <i>Category</i>, a <i>Series</i> and at least two <i>Values</i> are needed for this chart.",
|
|
260
260
|
},
|
|
261
261
|
};
|