@qrvey/utils 1.10.0-5 → 1.10.0-7
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/dist/cjs/columns/helpers/isNumericalColumn.js +3 -1
- package/dist/cjs/general/object/mergeDeep.d.ts +6 -0
- package/dist/cjs/general/object/mergeDeep.js +12 -10
- package/dist/cjs/globalization/labels/panel/I18N_PANEL.js +1 -1
- package/dist/columns/helpers/isNumericalColumn.js +3 -1
- package/dist/general/object/mergeDeep.d.ts +6 -0
- package/dist/general/object/mergeDeep.js +12 -10
- package/dist/globalization/labels/panel/I18N_PANEL.js +1 -1
- package/package.json +1 -1
|
@@ -14,5 +14,7 @@ const NUMERICAL_COLUMNS_1 = require("../constants/NUMERICAL_COLUMNS");
|
|
|
14
14
|
const isNumericalColumn = (column) => !(0, isEmpty_1.isEmpty)(column) &&
|
|
15
15
|
(0, isObject_1.isObject)(column) &&
|
|
16
16
|
(NUMERICAL_COLUMNS_1.NUMERICAL_COLUMNS.includes(column.type) ||
|
|
17
|
-
(column.type === COLUMN_1.COLUMN.FORMULA && column.formulaType === FORMULA_1.FORMULA.NUMBER)
|
|
17
|
+
(column.type === COLUMN_1.COLUMN.FORMULA && column.formulaType === FORMULA_1.FORMULA.NUMBER) ||
|
|
18
|
+
(column.type === COLUMN_1.COLUMN.AGGREGATED_FORMULA &&
|
|
19
|
+
column.formulaType === FORMULA_1.FORMULA.NUMBER));
|
|
18
20
|
exports.isNumericalColumn = isNumericalColumn;
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
* Settings structure of the Merge Deep helper
|
|
3
3
|
*/
|
|
4
4
|
interface IMergeDeepSettings {
|
|
5
|
+
/**
|
|
6
|
+
* Merging properties that exists in object 2 but not in object 1
|
|
7
|
+
*/
|
|
5
8
|
mergeMissingProperties?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Merging values on matched object properties. If false, the object 1 values remains as equal.
|
|
11
|
+
*/
|
|
6
12
|
mergeExistingValues?: boolean;
|
|
7
13
|
}
|
|
8
14
|
/**
|
|
@@ -15,22 +15,23 @@ function mergeDeep(obj1, obj2, settings) {
|
|
|
15
15
|
const defaultSettings = getParamsToMergeDeep(settings);
|
|
16
16
|
if (!isValid(obj1, obj2))
|
|
17
17
|
return (0, objectCopy_1.objectCopy)(obj1);
|
|
18
|
-
const result = {};
|
|
18
|
+
const result = Array.isArray(obj1) ? [] : {};
|
|
19
19
|
for (const i in obj1) {
|
|
20
|
-
if (
|
|
20
|
+
if ((0, isObject_1.isObject)(obj1[i]) || Array.isArray(obj1[i])) {
|
|
21
21
|
result[i] = mergeDeep(obj1[i], obj2[i], defaultSettings);
|
|
22
22
|
}
|
|
23
|
+
else if (i in obj2 && defaultSettings.mergeExistingValues) {
|
|
24
|
+
result[i] = obj2[i];
|
|
25
|
+
}
|
|
23
26
|
else {
|
|
24
27
|
result[i] = obj1[i];
|
|
25
28
|
}
|
|
26
29
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
(
|
|
30
|
-
i
|
|
31
|
-
|
|
32
|
-
(!(i in result) && defaultSettings.mergeMissingProperties))) {
|
|
33
|
-
result[i] = obj2[i];
|
|
30
|
+
if (defaultSettings.mergeMissingProperties) {
|
|
31
|
+
for (const i in obj2) {
|
|
32
|
+
if (!(i in result)) {
|
|
33
|
+
result[i] = obj2[i];
|
|
34
|
+
}
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
return result;
|
|
@@ -43,7 +44,8 @@ exports.mergeDeep = mergeDeep;
|
|
|
43
44
|
* @returns true: they are valid; false: they are not
|
|
44
45
|
*/
|
|
45
46
|
function isValid(obj1, obj2) {
|
|
46
|
-
return (0, isObject_1.isObject)(obj1) && (0, isObject_1.isObject)(obj2)
|
|
47
|
+
return (((0, isObject_1.isObject)(obj1) && (0, isObject_1.isObject)(obj2)) ||
|
|
48
|
+
(Array.isArray(obj1) && Array.isArray(obj2)));
|
|
47
49
|
}
|
|
48
50
|
/**
|
|
49
51
|
* Validates and gets the settings with all set parameters.
|
|
@@ -18,7 +18,7 @@ exports.I18N_PANEL = {
|
|
|
18
18
|
invalid_data_for_chart: "No valid data for this chart",
|
|
19
19
|
longer_available_panel: "This panel is no longer available",
|
|
20
20
|
long_text: "long-text",
|
|
21
|
-
max_buckets_limit: "The combination of data used in this chart exceeds the maximum number of
|
|
21
|
+
max_buckets_limit: "The combination of data used in this chart exceeds the maximum number of aggregation buckets allowed in a single response.<br><br>To fix this issue, try the following:<br>• <i>Filter</i> your data<br>• Apply a <i>Date Grouping</i> that returns less data<br>• Use another chart visualization",
|
|
22
22
|
missing_column: "Missing Column.",
|
|
23
23
|
missing_bucket_column: "Missing bucket column.",
|
|
24
24
|
missing_formula_column: "Missing formula column.",
|
|
@@ -11,4 +11,6 @@ import { NUMERICAL_COLUMNS } from "../constants/NUMERICAL_COLUMNS";
|
|
|
11
11
|
export const isNumericalColumn = (column) => !isEmpty(column) &&
|
|
12
12
|
isObject(column) &&
|
|
13
13
|
(NUMERICAL_COLUMNS.includes(column.type) ||
|
|
14
|
-
(column.type === COLUMN.FORMULA && column.formulaType === FORMULA.NUMBER)
|
|
14
|
+
(column.type === COLUMN.FORMULA && column.formulaType === FORMULA.NUMBER) ||
|
|
15
|
+
(column.type === COLUMN.AGGREGATED_FORMULA &&
|
|
16
|
+
column.formulaType === FORMULA.NUMBER));
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
* Settings structure of the Merge Deep helper
|
|
3
3
|
*/
|
|
4
4
|
interface IMergeDeepSettings {
|
|
5
|
+
/**
|
|
6
|
+
* Merging properties that exists in object 2 but not in object 1
|
|
7
|
+
*/
|
|
5
8
|
mergeMissingProperties?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Merging values on matched object properties. If false, the object 1 values remains as equal.
|
|
11
|
+
*/
|
|
6
12
|
mergeExistingValues?: boolean;
|
|
7
13
|
}
|
|
8
14
|
/**
|
|
@@ -12,22 +12,23 @@ export function mergeDeep(obj1, obj2, settings) {
|
|
|
12
12
|
const defaultSettings = getParamsToMergeDeep(settings);
|
|
13
13
|
if (!isValid(obj1, obj2))
|
|
14
14
|
return objectCopy(obj1);
|
|
15
|
-
const result = {};
|
|
15
|
+
const result = Array.isArray(obj1) ? [] : {};
|
|
16
16
|
for (const i in obj1) {
|
|
17
|
-
if (i
|
|
17
|
+
if (isObject(obj1[i]) || Array.isArray(obj1[i])) {
|
|
18
18
|
result[i] = mergeDeep(obj1[i], obj2[i], defaultSettings);
|
|
19
19
|
}
|
|
20
|
+
else if (i in obj2 && defaultSettings.mergeExistingValues) {
|
|
21
|
+
result[i] = obj2[i];
|
|
22
|
+
}
|
|
20
23
|
else {
|
|
21
24
|
result[i] = obj1[i];
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
(
|
|
27
|
-
i
|
|
28
|
-
|
|
29
|
-
(!(i in result) && defaultSettings.mergeMissingProperties))) {
|
|
30
|
-
result[i] = obj2[i];
|
|
27
|
+
if (defaultSettings.mergeMissingProperties) {
|
|
28
|
+
for (const i in obj2) {
|
|
29
|
+
if (!(i in result)) {
|
|
30
|
+
result[i] = obj2[i];
|
|
31
|
+
}
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
return result;
|
|
@@ -39,7 +40,8 @@ export function mergeDeep(obj1, obj2, settings) {
|
|
|
39
40
|
* @returns true: they are valid; false: they are not
|
|
40
41
|
*/
|
|
41
42
|
function isValid(obj1, obj2) {
|
|
42
|
-
return isObject(obj1) && isObject(obj2)
|
|
43
|
+
return ((isObject(obj1) && isObject(obj2)) ||
|
|
44
|
+
(Array.isArray(obj1) && Array.isArray(obj2)));
|
|
43
45
|
}
|
|
44
46
|
/**
|
|
45
47
|
* Validates and gets the settings with all set parameters.
|
|
@@ -15,7 +15,7 @@ export const I18N_PANEL = {
|
|
|
15
15
|
invalid_data_for_chart: "No valid data for this chart",
|
|
16
16
|
longer_available_panel: "This panel is no longer available",
|
|
17
17
|
long_text: "long-text",
|
|
18
|
-
max_buckets_limit: "The combination of data used in this chart exceeds the maximum number of
|
|
18
|
+
max_buckets_limit: "The combination of data used in this chart exceeds the maximum number of aggregation buckets allowed in a single response.<br><br>To fix this issue, try the following:<br>• <i>Filter</i> your data<br>• Apply a <i>Date Grouping</i> that returns less data<br>• Use another chart visualization",
|
|
19
19
|
missing_column: "Missing Column.",
|
|
20
20
|
missing_bucket_column: "Missing bucket column.",
|
|
21
21
|
missing_formula_column: "Missing formula column.",
|