@qrvey/utils 1.2.9-10 → 1.2.9-11
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 +89 -89
- package/dist/cjs/filters/helpers/ui/getUIValues.js +11 -5
- package/dist/cjs/globalization/interfaces/chart_builder/II18nChartBuilderRefernceLine.d.ts +1 -0
- package/dist/cjs/globalization/labels/chart_builder/I18N_CHART_BUILDER_LAYER_OPTIONS.js +2 -1
- package/dist/filters/helpers/ui/getUIValues.js +11 -5
- package/dist/globalization/interfaces/chart_builder/II18nChartBuilderRefernceLine.d.ts +1 -0
- package/dist/globalization/labels/chart_builder/I18N_CHART_BUILDER_LAYER_OPTIONS.js +2 -1
- package/package.json +1 -1
- package/src/filters/helpers/ui/getUIValues.ts +12 -7
- package/src/globalization/interfaces/chart_builder/II18nChartBuilderRefernceLine.ts +1 -0
- package/src/globalization/labels/chart_builder/I18N_CHART_BUILDER_LAYER_OPTIONS.ts +2 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# [@qrvey/utils](https://bitbucket.org/qrvey/qrvey_utils/wiki/Home) *1.2.9-
|
|
1
|
+
# [@qrvey/utils](https://bitbucket.org/qrvey/qrvey_utils/wiki/Home) *1.2.9-11*
|
|
2
2
|
|
|
3
3
|
> Helper, Utils for all Qrvey Projects
|
|
4
4
|
|
|
@@ -946,6 +946,34 @@ Generates a Flattened UI Filter Structure from the UI Filter Data structure v2.1
|
|
|
946
946
|
|
|
947
947
|
|
|
948
948
|
|
|
949
|
+
### dist/filters/adapters/adaptDateGroupingProperty.js
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
#### adaptDateGroupingProperty(property)
|
|
953
|
+
|
|
954
|
+
[TODO: For 2022, eliminate this adapter]
|
|
955
|
+
Get the new property base on the old date grouping properties
|
|
956
|
+
|
|
957
|
+
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
##### Parameters
|
|
961
|
+
|
|
962
|
+
| Name | Type | Description | |
|
|
963
|
+
| ---- | ---- | ----------- | -------- |
|
|
964
|
+
| property | | | |
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
##### Returns
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
-
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
|
|
949
977
|
### dist/filters/adapters/adaptFilterData.js
|
|
950
978
|
|
|
951
979
|
|
|
@@ -1510,6 +1538,26 @@ const filterData = transformFilters(oldPreferenceFilters, 'ANALYZE');
|
|
|
1510
1538
|
|
|
1511
1539
|
|
|
1512
1540
|
|
|
1541
|
+
### dist/filters/classes/FilterInputErrorHandler.js
|
|
1542
|
+
|
|
1543
|
+
|
|
1544
|
+
#### new FilterInputErrorHandler()
|
|
1545
|
+
|
|
1546
|
+
|
|
1547
|
+
|
|
1548
|
+
|
|
1549
|
+
|
|
1550
|
+
|
|
1551
|
+
|
|
1552
|
+
|
|
1553
|
+
##### Returns
|
|
1554
|
+
|
|
1555
|
+
|
|
1556
|
+
- `Void`
|
|
1557
|
+
|
|
1558
|
+
|
|
1559
|
+
|
|
1560
|
+
|
|
1513
1561
|
### dist/filters/helpers/applyHierarchyForAggFilters.js
|
|
1514
1562
|
|
|
1515
1563
|
|
|
@@ -1621,54 +1669,6 @@ Gets the Scopes IDS for the Available Scope function by any config
|
|
|
1621
1669
|
|
|
1622
1670
|
|
|
1623
1671
|
|
|
1624
|
-
### dist/filters/classes/FilterInputErrorHandler.js
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
#### new FilterInputErrorHandler()
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
##### Returns
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
- `Void`
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
### dist/filters/adapters/adaptDateGroupingProperty.js
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
#### adaptDateGroupingProperty(property)
|
|
1648
|
-
|
|
1649
|
-
[TODO: For 2022, eliminate this adapter]
|
|
1650
|
-
Get the new property base on the old date grouping properties
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
##### Parameters
|
|
1656
|
-
|
|
1657
|
-
| Name | Type | Description | |
|
|
1658
|
-
| ---- | ---- | ----------- | -------- |
|
|
1659
|
-
| property | | | |
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
##### Returns
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
1672
|
### dist/general/array/delete.js
|
|
1673
1673
|
|
|
1674
1674
|
|
|
@@ -2348,6 +2348,35 @@ Checks if the given argument is an object type
|
|
|
2348
2348
|
|
|
2349
2349
|
|
|
2350
2350
|
|
|
2351
|
+
### dist/general/object/mapValues.js
|
|
2352
|
+
|
|
2353
|
+
|
|
2354
|
+
#### mapValues(baseObject, iteratee)
|
|
2355
|
+
|
|
2356
|
+
Invoke iteratee (function) for each object key-value pair
|
|
2357
|
+
and return a mapped object
|
|
2358
|
+
|
|
2359
|
+
|
|
2360
|
+
|
|
2361
|
+
|
|
2362
|
+
##### Parameters
|
|
2363
|
+
|
|
2364
|
+
| Name | Type | Description | |
|
|
2365
|
+
| ---- | ---- | ----------- | -------- |
|
|
2366
|
+
| baseObject | `Object` | Base object. | |
|
|
2367
|
+
| iteratee | `Function` | The executed per iteration. | |
|
|
2368
|
+
|
|
2369
|
+
|
|
2370
|
+
|
|
2371
|
+
|
|
2372
|
+
##### Returns
|
|
2373
|
+
|
|
2374
|
+
|
|
2375
|
+
- `Object` New mapped object.
|
|
2376
|
+
|
|
2377
|
+
|
|
2378
|
+
|
|
2379
|
+
|
|
2351
2380
|
### dist/general/object/mergeDeep.js
|
|
2352
2381
|
|
|
2353
2382
|
|
|
@@ -2810,35 +2839,6 @@ try to find this string as a variable on Windows object
|
|
|
2810
2839
|
|
|
2811
2840
|
|
|
2812
2841
|
|
|
2813
|
-
### dist/general/object/mapValues.js
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
#### mapValues(baseObject, iteratee)
|
|
2817
|
-
|
|
2818
|
-
Invoke iteratee (function) for each object key-value pair
|
|
2819
|
-
and return a mapped object
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
##### Parameters
|
|
2825
|
-
|
|
2826
|
-
| Name | Type | Description | |
|
|
2827
|
-
| ---- | ---- | ----------- | -------- |
|
|
2828
|
-
| baseObject | `Object` | Base object. | |
|
|
2829
|
-
| iteratee | `Function` | The executed per iteration. | |
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
##### Returns
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
- `Object` New mapped object.
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
2842
|
### dist/dates/relative/helpers/formatStatement.js
|
|
2843
2843
|
|
|
2844
2844
|
|
|
@@ -3244,12 +3244,12 @@ Returns a filter builder config object by a any given config
|
|
|
3244
3244
|
|
|
3245
3245
|
|
|
3246
3246
|
|
|
3247
|
-
### dist/filters/helpers/common/
|
|
3247
|
+
### dist/filters/helpers/common/excludeFiltersByAggregateColumn.js
|
|
3248
3248
|
|
|
3249
3249
|
|
|
3250
|
-
####
|
|
3250
|
+
#### excludeFiltersByAggregateColumn(filterData)
|
|
3251
3251
|
|
|
3252
|
-
|
|
3252
|
+
Excludes Aggregate Filters in the Filter Data. Excluding filters when the column.aggregate is included.
|
|
3253
3253
|
|
|
3254
3254
|
|
|
3255
3255
|
|
|
@@ -3258,8 +3258,7 @@ Validates if both filters are the same
|
|
|
3258
3258
|
|
|
3259
3259
|
| Name | Type | Description | |
|
|
3260
3260
|
| ---- | ---- | ----------- | -------- |
|
|
3261
|
-
|
|
|
3262
|
-
| filter2 | | filter 2 | |
|
|
3261
|
+
| filterData | | The filter data object | |
|
|
3263
3262
|
|
|
3264
3263
|
|
|
3265
3264
|
|
|
@@ -3267,17 +3266,17 @@ Validates if both filters are the same
|
|
|
3267
3266
|
##### Returns
|
|
3268
3267
|
|
|
3269
3268
|
|
|
3270
|
-
-
|
|
3269
|
+
- The new filter data object that were excluded the aggregate filters
|
|
3271
3270
|
|
|
3272
3271
|
|
|
3273
3272
|
|
|
3274
3273
|
|
|
3275
|
-
### dist/filters/helpers/common/
|
|
3274
|
+
### dist/filters/helpers/common/areFiltersEquals.js
|
|
3276
3275
|
|
|
3277
3276
|
|
|
3278
|
-
####
|
|
3277
|
+
#### areFiltersEquals(filter1, filter2)
|
|
3279
3278
|
|
|
3280
|
-
|
|
3279
|
+
Validates if both filters are the same
|
|
3281
3280
|
|
|
3282
3281
|
|
|
3283
3282
|
|
|
@@ -3286,7 +3285,8 @@ Excludes Aggregate Filters in the Filter Data. Excluding filters when the column
|
|
|
3286
3285
|
|
|
3287
3286
|
| Name | Type | Description | |
|
|
3288
3287
|
| ---- | ---- | ----------- | -------- |
|
|
3289
|
-
|
|
|
3288
|
+
| filter1 | | filter 1 | |
|
|
3289
|
+
| filter2 | | filter 2 | |
|
|
3290
3290
|
|
|
3291
3291
|
|
|
3292
3292
|
|
|
@@ -3294,7 +3294,7 @@ Excludes Aggregate Filters in the Filter Data. Excluding filters when the column
|
|
|
3294
3294
|
##### Returns
|
|
3295
3295
|
|
|
3296
3296
|
|
|
3297
|
-
-
|
|
3297
|
+
- true: the filters are equal; false: the filters are NOT equal
|
|
3298
3298
|
|
|
3299
3299
|
|
|
3300
3300
|
|
|
@@ -49,10 +49,15 @@ function getUIValues(filter, settings) {
|
|
|
49
49
|
enabled: settings.addEnableds ? (_a = filter.values[0]) === null || _a === void 0 ? void 0 : _a.enabled : undefined,
|
|
50
50
|
}];
|
|
51
51
|
case FILTER_VALIDATOR_1.FILTER_VALIDATOR.IN:
|
|
52
|
-
return filter.values.map(value =>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
return filter.values.map(value => {
|
|
53
|
+
const cursor = (settings === null || settings === void 0 ? void 0 : settings.translate) ? settings.translate(RELATIVE_CURSOR_INFO_1.RELATIVE_CURSOR_INFO[value.cursor].i18nLabelPath) : RELATIVE_CURSOR_INFO_1.RELATIVE_CURSOR_INFO[value.cursor].i18nLabelPath;
|
|
54
|
+
const from = (settings === null || settings === void 0 ? void 0 : settings.translate) ? settings.translate('filter.relative_container.from_label') : 'from';
|
|
55
|
+
const anchor = (settings === null || settings === void 0 ? void 0 : settings.translate) ? settings === null || settings === void 0 ? void 0 : settings.translate('filter.relative_container.current_date') : 'current date';
|
|
56
|
+
return {
|
|
57
|
+
value: `${cursor} ${value.cursor !== RELATIVE_CURSOR_1.RELATIVE_CURSOR.THIS && value.number > 1 ? value.number : ''} ${getValueUiUnitRelativeDate(value, settings)} ${value.cursor !== RELATIVE_CURSOR_1.RELATIVE_CURSOR.THIS ? `${from} ${value.anchor || anchor}` : ''}`,
|
|
58
|
+
enabled: settings.addEnableds ? filter.enabled : undefined,
|
|
59
|
+
};
|
|
60
|
+
});
|
|
56
61
|
default:
|
|
57
62
|
if (filter.column.type === COLUMN_1.COLUMN.RANKING && (0, isEmpty_1.isEmpty)(filter.column.aggregate)) {
|
|
58
63
|
return getRankingUIValues(filter.values, settings.addEnableds, settings.rankingGroupIndex);
|
|
@@ -78,7 +83,8 @@ function getUiValuesSettings(settings) {
|
|
|
78
83
|
};
|
|
79
84
|
}
|
|
80
85
|
function getValueUiUnitRelativeDate(relative, settings) {
|
|
81
|
-
|
|
86
|
+
const unit = settings.translate ? `${settings.translate(`common.units.${relative.unit}`)}` : relative.unit;
|
|
87
|
+
return relative.cursor !== RELATIVE_CURSOR_1.RELATIVE_CURSOR.THIS && relative.number > 1 ? `${unit}s` : unit;
|
|
82
88
|
}
|
|
83
89
|
function getRankingUIValues(values, addEnableds = false, rankingGroupIndex) {
|
|
84
90
|
const flattenValues = rankingGroupIndex == null ? (0, flattenDeep_1.flattenDeep)(values) : values[rankingGroupIndex];
|
|
@@ -25,11 +25,12 @@ exports.I18N_CHART_BUILDER_LAYER_OPTIONS = {
|
|
|
25
25
|
custom_label_placeholder: 'Type custom label',
|
|
26
26
|
dynamic: 'Dynamic',
|
|
27
27
|
fixed: 'Fixed',
|
|
28
|
-
new_reference_line_label: 'Reference Line
|
|
28
|
+
new_reference_line_label: 'Reference Line',
|
|
29
29
|
opacity: 'Opacity',
|
|
30
30
|
remove: 'Remove',
|
|
31
31
|
title: 'Reference Line',
|
|
32
32
|
value: 'Value',
|
|
33
33
|
value_aggregated: 'Value Aggregate',
|
|
34
|
+
value_aggregated_placeholder: 'Select Aggregate',
|
|
34
35
|
},
|
|
35
36
|
};
|
|
@@ -46,10 +46,15 @@ export function getUIValues(filter, settings) {
|
|
|
46
46
|
enabled: settings.addEnableds ? (_a = filter.values[0]) === null || _a === void 0 ? void 0 : _a.enabled : undefined,
|
|
47
47
|
}];
|
|
48
48
|
case FILTER_VALIDATOR.IN:
|
|
49
|
-
return filter.values.map(value =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
return filter.values.map(value => {
|
|
50
|
+
const cursor = (settings === null || settings === void 0 ? void 0 : settings.translate) ? settings.translate(RELATIVE_CURSOR_INFO[value.cursor].i18nLabelPath) : RELATIVE_CURSOR_INFO[value.cursor].i18nLabelPath;
|
|
51
|
+
const from = (settings === null || settings === void 0 ? void 0 : settings.translate) ? settings.translate('filter.relative_container.from_label') : 'from';
|
|
52
|
+
const anchor = (settings === null || settings === void 0 ? void 0 : settings.translate) ? settings === null || settings === void 0 ? void 0 : settings.translate('filter.relative_container.current_date') : 'current date';
|
|
53
|
+
return {
|
|
54
|
+
value: `${cursor} ${value.cursor !== RELATIVE_CURSOR.THIS && value.number > 1 ? value.number : ''} ${getValueUiUnitRelativeDate(value, settings)} ${value.cursor !== RELATIVE_CURSOR.THIS ? `${from} ${value.anchor || anchor}` : ''}`,
|
|
55
|
+
enabled: settings.addEnableds ? filter.enabled : undefined,
|
|
56
|
+
};
|
|
57
|
+
});
|
|
53
58
|
default:
|
|
54
59
|
if (filter.column.type === COLUMN.RANKING && isEmpty(filter.column.aggregate)) {
|
|
55
60
|
return getRankingUIValues(filter.values, settings.addEnableds, settings.rankingGroupIndex);
|
|
@@ -74,7 +79,8 @@ function getUiValuesSettings(settings) {
|
|
|
74
79
|
};
|
|
75
80
|
}
|
|
76
81
|
function getValueUiUnitRelativeDate(relative, settings) {
|
|
77
|
-
|
|
82
|
+
const unit = settings.translate ? `${settings.translate(`common.units.${relative.unit}`)}` : relative.unit;
|
|
83
|
+
return relative.cursor !== RELATIVE_CURSOR.THIS && relative.number > 1 ? `${unit}s` : unit;
|
|
78
84
|
}
|
|
79
85
|
function getRankingUIValues(values, addEnableds = false, rankingGroupIndex) {
|
|
80
86
|
const flattenValues = rankingGroupIndex == null ? flattenDeep(values) : values[rankingGroupIndex];
|
|
@@ -22,11 +22,12 @@ export const I18N_CHART_BUILDER_LAYER_OPTIONS = {
|
|
|
22
22
|
custom_label_placeholder: 'Type custom label',
|
|
23
23
|
dynamic: 'Dynamic',
|
|
24
24
|
fixed: 'Fixed',
|
|
25
|
-
new_reference_line_label: 'Reference Line
|
|
25
|
+
new_reference_line_label: 'Reference Line',
|
|
26
26
|
opacity: 'Opacity',
|
|
27
27
|
remove: 'Remove',
|
|
28
28
|
title: 'Reference Line',
|
|
29
29
|
value: 'Value',
|
|
30
30
|
value_aggregated: 'Value Aggregate',
|
|
31
|
+
value_aggregated_placeholder: 'Select Aggregate',
|
|
31
32
|
},
|
|
32
33
|
};
|
package/package.json
CHANGED
|
@@ -23,7 +23,6 @@ import { getI18nDateGroupLabel, IDateColumnPropertyType } from "../../..";
|
|
|
23
23
|
*/
|
|
24
24
|
export function getUIValues(filter: IFSFilter, settings?: IFUUIValueSettings): IFUValue[] {
|
|
25
25
|
settings = getUiValuesSettings(settings);
|
|
26
|
-
|
|
27
26
|
switch (filter.validator) {
|
|
28
27
|
case FILTER_VALIDATOR.AFTER:
|
|
29
28
|
case FILTER_VALIDATOR.GREATER_THAN:
|
|
@@ -54,11 +53,16 @@ export function getUIValues(filter: IFSFilter, settings?: IFUUIValueSettings): I
|
|
|
54
53
|
enabled: settings.addEnableds ? (filter.values as IFSValue[])[0]?.enabled : undefined,
|
|
55
54
|
}];
|
|
56
55
|
case FILTER_VALIDATOR.IN:
|
|
57
|
-
return (filter.values as IFSValueRelativeDate[]).map(value =>
|
|
58
|
-
value:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
return (filter.values as IFSValueRelativeDate[]).map(value => {
|
|
57
|
+
const cursor = settings?.translate ? settings.translate(RELATIVE_CURSOR_INFO[value.cursor].i18nLabelPath) : RELATIVE_CURSOR_INFO[value.cursor].i18nLabelPath;
|
|
58
|
+
const from = settings?.translate ? settings.translate('filter.relative_container.from_label') : 'from';
|
|
59
|
+
const anchor = settings?.translate ? settings?.translate('filter.relative_container.current_date') : 'current date';
|
|
60
|
+
return {
|
|
61
|
+
value:
|
|
62
|
+
`${cursor} ${value.cursor !== RELATIVE_CURSOR.THIS && value.number > 1 ? value.number : ''} ${getValueUiUnitRelativeDate(value, settings)} ${value.cursor !== RELATIVE_CURSOR.THIS ? `${from} ${value.anchor || anchor}`: ''}`,
|
|
63
|
+
enabled: settings.addEnableds ? filter.enabled : undefined,
|
|
64
|
+
};
|
|
65
|
+
});
|
|
62
66
|
default:
|
|
63
67
|
if (filter.column.type === COLUMN.RANKING && isEmpty(filter.column.aggregate)) {
|
|
64
68
|
return getRankingUIValues(filter.values as IFSValueRanking[][], settings.addEnableds, settings.rankingGroupIndex);
|
|
@@ -85,7 +89,8 @@ function getUiValuesSettings(settings: IFUUIValueSettings): IFUUIValueSettings {
|
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
function getValueUiUnitRelativeDate(relative: IFSValueRelativeDate, settings: IFUUIValueSettings) {
|
|
88
|
-
|
|
92
|
+
const unit = settings.translate ? `${settings.translate(`common.units.${relative.unit}`)}` : relative.unit;
|
|
93
|
+
return relative.cursor !== RELATIVE_CURSOR.THIS && relative.number > 1 ? `${unit}s`: unit;
|
|
89
94
|
}
|
|
90
95
|
|
|
91
96
|
function getRankingUIValues(values: IFSValueRanking[][], addEnableds = false, rankingGroupIndex?: number) {
|
|
@@ -25,11 +25,12 @@ export const I18N_CHART_BUILDER_LAYER_OPTIONS: Pick<II18nChartBuilder, LayerOpti
|
|
|
25
25
|
custom_label_placeholder: 'Type custom label',
|
|
26
26
|
dynamic: 'Dynamic',
|
|
27
27
|
fixed: 'Fixed',
|
|
28
|
-
new_reference_line_label: 'Reference Line
|
|
28
|
+
new_reference_line_label: 'Reference Line',
|
|
29
29
|
opacity: 'Opacity',
|
|
30
30
|
remove: 'Remove',
|
|
31
31
|
title: 'Reference Line',
|
|
32
32
|
value: 'Value',
|
|
33
33
|
value_aggregated: 'Value Aggregate',
|
|
34
|
+
value_aggregated_placeholder: 'Select Aggregate',
|
|
34
35
|
},
|
|
35
36
|
};
|