@qrvey/utils 1.2.10-5 → 1.2.10-8
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/bitbucket-pipelines.yml +1 -1
- package/dist/cjs/filters/adapters/adaptFilterValues.js +1 -1
- package/dist/cjs/filters/adapters/flatUIToFD.js +4 -0
- package/dist/cjs/filters/adapters/flatUIToOldLogic.js +1 -1
- package/dist/cjs/filters/adapters/flatUIToUI.js +4 -0
- package/dist/cjs/filters/helpers/OLD_getAggFilters.d.ts +1 -1
- package/dist/cjs/filters/helpers/OLD_getAggFilters.js +1 -1
- package/dist/cjs/filters/helpers/backend/getBackendProperty.js +1 -1
- package/dist/cjs/filters/helpers/backend/getBackendValues.js +1 -1
- package/dist/cjs/filters/helpers/common/getMergeValuesSettings.d.ts +7 -0
- package/dist/cjs/filters/helpers/common/getMergeValuesSettings.js +15 -0
- package/dist/cjs/filters/helpers/common/index.d.ts +1 -0
- package/dist/cjs/filters/helpers/common/index.js +1 -0
- package/dist/cjs/filters/helpers/common/mergeFilters.js +4 -58
- package/dist/cjs/filters/helpers/common/mergeValues.d.ts +11 -0
- package/dist/cjs/filters/helpers/common/mergeValues.js +92 -0
- package/dist/cjs/filters/interfaces/common/IFSValue.d.ts +1 -1
- package/dist/cjs/filters/interfaces/functions/IFFiltersMergeFilters.d.ts +2 -2
- package/dist/cjs/filters/interfaces/functions/IFFiltersMergeValues.d.ts +3 -0
- package/dist/cjs/filters/interfaces/functions/IFFiltersMergeValues.js +2 -0
- package/dist/cjs/filters/interfaces/functions/index.d.ts +1 -0
- package/dist/cjs/filters/interfaces/functions/index.js +1 -0
- package/dist/cjs/filters/interfaces/ui/IFUValue.d.ts +1 -1
- package/dist/cjs/filters/services/UChartPaginationApi.d.ts +2 -2
- package/dist/cjs/filters/services/UChartPaginationApi.js +2 -2
- package/dist/cjs/format/format.js +4 -2
- package/dist/cjs/format/localization.js +17 -3
- package/dist/cjs/globalization/interfaces/dashboard/II18nDashboardToast.d.ts +1 -0
- package/dist/cjs/globalization/labels/dashboard/I18N_DASHBOARD.js +1 -0
- package/dist/cjs/qrvey/helpers/transformValue.js +3 -0
- package/dist/cjs/services/adapters/BBranchesMapToUIBranchesMap.adapter.d.ts +3 -3
- package/dist/cjs/services/adapters/BBranchesMapToUIBranchesMap.adapter.js +3 -3
- package/dist/filters/adapters/adaptFilterValues.js +1 -1
- package/dist/filters/adapters/flatUIToFD.js +4 -0
- package/dist/filters/adapters/flatUIToOldLogic.js +1 -1
- package/dist/filters/adapters/flatUIToUI.js +4 -0
- package/dist/filters/helpers/OLD_getAggFilters.d.ts +1 -1
- package/dist/filters/helpers/OLD_getAggFilters.js +1 -1
- package/dist/filters/helpers/backend/getBackendProperty.js +1 -1
- package/dist/filters/helpers/backend/getBackendValues.js +1 -1
- package/dist/filters/helpers/common/getMergeValuesSettings.d.ts +7 -0
- package/dist/filters/helpers/common/getMergeValuesSettings.js +11 -0
- package/dist/filters/helpers/common/index.d.ts +1 -0
- package/dist/filters/helpers/common/index.js +1 -0
- package/dist/filters/helpers/common/mergeFilters.js +3 -57
- package/dist/filters/helpers/common/mergeValues.d.ts +11 -0
- package/dist/filters/helpers/common/mergeValues.js +88 -0
- package/dist/filters/interfaces/common/IFSValue.d.ts +1 -1
- package/dist/filters/interfaces/functions/IFFiltersMergeFilters.d.ts +2 -2
- package/dist/filters/interfaces/functions/IFFiltersMergeValues.d.ts +3 -0
- package/dist/filters/interfaces/functions/IFFiltersMergeValues.js +1 -0
- package/dist/filters/interfaces/functions/index.d.ts +1 -0
- package/dist/filters/interfaces/functions/index.js +1 -0
- package/dist/filters/interfaces/ui/IFUValue.d.ts +1 -1
- package/dist/filters/services/UChartPaginationApi.d.ts +2 -2
- package/dist/filters/services/UChartPaginationApi.js +2 -2
- package/dist/format/format.js +4 -2
- package/dist/format/localization.js +17 -3
- package/dist/globalization/interfaces/dashboard/II18nDashboardToast.d.ts +1 -0
- package/dist/globalization/labels/dashboard/I18N_DASHBOARD.js +1 -0
- package/dist/qrvey/helpers/transformValue.js +3 -0
- package/dist/services/adapters/BBranchesMapToUIBranchesMap.adapter.d.ts +3 -3
- package/dist/services/adapters/BBranchesMapToUIBranchesMap.adapter.js +3 -3
- package/package.json +10 -8
- package/publishing.js +15 -2
- package/src/filters/adapters/adaptFilterValues.ts +1 -1
- package/src/filters/adapters/flatUIToFD.ts +5 -0
- package/src/filters/adapters/flatUIToOldLogic.ts +1 -1
- package/src/filters/adapters/flatUIToUI.ts +5 -0
- package/src/filters/helpers/OLD_getAggFilters.ts +1 -1
- package/src/filters/helpers/backend/getBackendProperty.ts +2 -1
- package/src/filters/helpers/backend/getBackendValues.ts +1 -1
- package/src/filters/helpers/common/getMergeValuesSettings.ts +12 -0
- package/src/filters/helpers/common/index.ts +1 -0
- package/src/filters/helpers/common/mergeFilters.ts +5 -59
- package/src/filters/helpers/common/mergeValues.ts +87 -0
- package/src/filters/interfaces/common/IFSValue.ts +1 -1
- package/src/filters/interfaces/functions/IFFiltersMergeFilters.ts +2 -2
- package/src/filters/interfaces/functions/IFFiltersMergeValues.ts +3 -0
- package/src/filters/interfaces/functions/index.ts +1 -0
- package/src/filters/interfaces/ui/IFUValue.ts +1 -1
- package/src/filters/services/UChartPaginationApi.ts +2 -4
- package/src/format/format.ts +3 -2
- package/src/format/localization.ts +17 -3
- package/src/globalization/interfaces/dashboard/II18nDashboardToast.ts +1 -0
- package/src/globalization/labels/dashboard/I18N_DASHBOARD.ts +1 -0
- package/src/qrvey/helpers/transformValue.ts +3 -0
- package/src/services/adapters/BBranchesMapToUIBranchesMap.adapter.ts +3 -3
package/README.md
CHANGED
package/bitbucket-pipelines.yml
CHANGED
|
@@ -10,7 +10,7 @@ const COLUMN_1 = require("../../columns/constants/COLUMN");
|
|
|
10
10
|
* @returns A new value array with the filled properties.
|
|
11
11
|
*/
|
|
12
12
|
function adaptFilterValues(filter) {
|
|
13
|
-
const setValue = value => (Object.assign(Object.assign({}, value), { enabled: (0, isEmpty_1.isEmpty)(value.enabled) ? true : value.enabled }));
|
|
13
|
+
const setValue = value => (Object.assign(Object.assign({}, value), { value: (0, isEmpty_1.isEmpty)(value.value) ? undefined : value.value, enabled: (0, isEmpty_1.isEmpty)(value.enabled) ? true : value.enabled }));
|
|
14
14
|
if (filter.column.type === COLUMN_1.COLUMN.RANKING && (0, isEmpty_1.isEmpty)(filter.column.aggregate)) {
|
|
15
15
|
return (filter.values || []).map(rValues => rValues.map(setValue));
|
|
16
16
|
}
|
|
@@ -6,6 +6,7 @@ const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
|
6
6
|
const adaptFilterValues_1 = require("./adaptFilterValues");
|
|
7
7
|
const FILTER_SECTION_1 = require("../constants/common/FILTER_SECTION");
|
|
8
8
|
const FILTER_STRUCTURE_VERSION_1 = require("../constants/common/FILTER_STRUCTURE_VERSION");
|
|
9
|
+
const cloneDeep_1 = require("../../general/object/cloneDeep");
|
|
9
10
|
/**
|
|
10
11
|
* Generates a filter data structure from the flatttened UI filters.
|
|
11
12
|
* @param uFilters Array of flattened filters from UI
|
|
@@ -82,8 +83,11 @@ function buildDataset(uFilter) {
|
|
|
82
83
|
* @returns an filter structure
|
|
83
84
|
*/
|
|
84
85
|
function buildFilter(uFilter) {
|
|
86
|
+
uFilter = (0, cloneDeep_1.cloneDeep)(uFilter);
|
|
85
87
|
const info = !(0, isEmpty_1.isEmpty)(uFilter.extras.info) ? { icon: uFilter.extras.info.icon, label: uFilter.extras.info.label } : undefined;
|
|
86
88
|
const property = (0, adaptDateGroupingProperty_1.adaptDateGroupingProperty)(uFilter.property);
|
|
89
|
+
delete uFilter.extras.scopeInfo;
|
|
90
|
+
delete uFilter.extras.dataset;
|
|
87
91
|
return {
|
|
88
92
|
collapsed: uFilter.collapsed,
|
|
89
93
|
column: {
|
|
@@ -359,7 +359,7 @@ function getResultValues(values, props) {
|
|
|
359
359
|
return (values || []).map((value) => {
|
|
360
360
|
if (value.enabled) {
|
|
361
361
|
if (props.column.type === COLUMN_1.COLUMN.IMAGE) {
|
|
362
|
-
return value.valueid;
|
|
362
|
+
return value.valueid || value.imageUrl || value.value;
|
|
363
363
|
}
|
|
364
364
|
else {
|
|
365
365
|
return value.value;
|
|
@@ -7,6 +7,7 @@ const FILTER_SECTION_1 = require("../constants/common/FILTER_SECTION");
|
|
|
7
7
|
const FILTER_STRUCTURE_VERSION_1 = require("../constants/common/FILTER_STRUCTURE_VERSION");
|
|
8
8
|
const getLastIndexFromArray_1 = require("../../general/array/getLastIndexFromArray");
|
|
9
9
|
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
10
|
+
const cloneDeep_1 = require("../../general/object/cloneDeep");
|
|
10
11
|
/**
|
|
11
12
|
* Generates a UI filter data structure from the flatttened UI filters.
|
|
12
13
|
* @param uFilters Array of flattened filters from UI
|
|
@@ -89,8 +90,11 @@ function buildDataset(uFilter) {
|
|
|
89
90
|
* @returns an filter structure
|
|
90
91
|
*/
|
|
91
92
|
function buildFilter(uFilter) {
|
|
93
|
+
uFilter = (0, cloneDeep_1.cloneDeep)(uFilter);
|
|
92
94
|
const info = !(0, isEmpty_1.isEmpty)(uFilter.extras.info) ? { icon: uFilter.extras.info.icon, label: uFilter.extras.info.label } : undefined;
|
|
93
95
|
const property = (0, adaptDateGroupingProperty_1.adaptDateGroupingProperty)(uFilter.property);
|
|
96
|
+
delete uFilter.extras.scopeInfo;
|
|
97
|
+
delete uFilter.extras.dataset;
|
|
94
98
|
return {
|
|
95
99
|
collapsed: uFilter.collapsed,
|
|
96
100
|
column: {
|
|
@@ -4,6 +4,6 @@ import { OLD_IFilterLogic } from "../interfaces/OLD_IFilterLogic";
|
|
|
4
4
|
* @deprecated soon
|
|
5
5
|
* @param logics
|
|
6
6
|
* @param summaries
|
|
7
|
-
* @returns
|
|
7
|
+
* @returns the filter aggregate structure
|
|
8
8
|
*/
|
|
9
9
|
export declare function getAggFilters(logics?: OLD_IFilterLogic[], summaries?: any[]): IFBFilterAggregate;
|
|
@@ -10,7 +10,7 @@ const FILTER_OPERATOR_1 = require("../constants/common/FILTER_OPERATOR");
|
|
|
10
10
|
* @deprecated soon
|
|
11
11
|
* @param logics
|
|
12
12
|
* @param summaries
|
|
13
|
-
* @returns
|
|
13
|
+
* @returns the filter aggregate structure
|
|
14
14
|
*/
|
|
15
15
|
function getAggFilters(logics = [], summaries = []) {
|
|
16
16
|
const aggregateFilters = getAggregateFilters(logics);
|
|
@@ -23,7 +23,7 @@ function getBackendProperty(filter) {
|
|
|
23
23
|
return filter.property.concat('_').concat(filter.lookupDisplayIndex.toString());
|
|
24
24
|
}
|
|
25
25
|
else if (filter.column.type === COLUMN_1.COLUMN.IMAGE) {
|
|
26
|
-
return COLUMN_PROPERTY_1.COLUMN_PROPERTY.IMAGE_ANSWER_ID;
|
|
26
|
+
return filter.values.every(value => (0, isEmpty_1.isEmpty)(value.valueid)) ? undefined : COLUMN_PROPERTY_1.COLUMN_PROPERTY.IMAGE_ANSWER_ID;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
return filter.property;
|
|
@@ -77,7 +77,7 @@ function getResultValues(values, filter) {
|
|
|
77
77
|
return (values || []).map((value) => {
|
|
78
78
|
if (value.enabled) {
|
|
79
79
|
if (filter.column.type === COLUMN_1.COLUMN.IMAGE) {
|
|
80
|
-
return value.valueid;
|
|
80
|
+
return value.valueid || value.imageUrl || value.value;
|
|
81
81
|
}
|
|
82
82
|
else {
|
|
83
83
|
return value.value;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IFFiltersMergeValues } from "../../interfaces/functions/IFFiltersMergeValues";
|
|
2
|
+
/**
|
|
3
|
+
* Transforms the given MergeFilters settings object. Adds the missing properties if they do not exist.
|
|
4
|
+
* @param settings an object to the MergeFilters settings
|
|
5
|
+
* @returns a new MergeFilters settings object.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getMergeValuesSettings(settings?: IFFiltersMergeValues): IFFiltersMergeValues;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMergeValuesSettings = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Transforms the given MergeFilters settings object. Adds the missing properties if they do not exist.
|
|
6
|
+
* @param settings an object to the MergeFilters settings
|
|
7
|
+
* @returns a new MergeFilters settings object.
|
|
8
|
+
*/
|
|
9
|
+
function getMergeValuesSettings(settings) {
|
|
10
|
+
var _a;
|
|
11
|
+
return {
|
|
12
|
+
overwriteValues: (_a = settings === null || settings === void 0 ? void 0 : settings.overwriteValues) !== null && _a !== void 0 ? _a : false,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
exports.getMergeValuesSettings = getMergeValuesSettings;
|
|
@@ -22,6 +22,7 @@ export * from './isNullValidator';
|
|
|
22
22
|
export * from './isRangeValidator';
|
|
23
23
|
export * from './isRegularValidator';
|
|
24
24
|
export * from './mergeFilters';
|
|
25
|
+
export * from './mergeValues';
|
|
25
26
|
export * from './resolveDatasetConditions';
|
|
26
27
|
export * from './resolveFilterConditions';
|
|
27
28
|
export * from './resolveScopeConditions';
|
|
@@ -38,6 +38,7 @@ __exportStar(require("./isNullValidator"), exports);
|
|
|
38
38
|
__exportStar(require("./isRangeValidator"), exports);
|
|
39
39
|
__exportStar(require("./isRegularValidator"), exports);
|
|
40
40
|
__exportStar(require("./mergeFilters"), exports);
|
|
41
|
+
__exportStar(require("./mergeValues"), exports);
|
|
41
42
|
__exportStar(require("./resolveDatasetConditions"), exports);
|
|
42
43
|
__exportStar(require("./resolveFilterConditions"), exports);
|
|
43
44
|
__exportStar(require("./resolveScopeConditions"), exports);
|
|
@@ -6,10 +6,7 @@ const cloneDeep_1 = require("../../../general/object/cloneDeep");
|
|
|
6
6
|
const FILTER_GROUPED_COLUMN_OPERATOR_1 = require("../../constants/common/FILTER_GROUPED_COLUMN_OPERATOR");
|
|
7
7
|
const getFilterid_1 = require("./getFilterid");
|
|
8
8
|
const getMergeFiltersSettings_1 = require("./getMergeFiltersSettings");
|
|
9
|
-
const
|
|
10
|
-
const isNullValidator_1 = require("./isNullValidator");
|
|
11
|
-
const isRangeValidator_1 = require("./isRangeValidator");
|
|
12
|
-
const isRegularValidator_1 = require("./isRegularValidator");
|
|
9
|
+
const mergeValues_1 = require("./mergeValues");
|
|
13
10
|
const resolveDatasetConditions_1 = require("./resolveDatasetConditions");
|
|
14
11
|
const resolveFilterConditions_1 = require("./resolveFilterConditions");
|
|
15
12
|
const resolveScopeConditions_1 = require("./resolveScopeConditions");
|
|
@@ -92,7 +89,7 @@ function mergeFilterss(filters1 = [], filters2 = [], settings) {
|
|
|
92
89
|
let newFilters = filters1.reduce((filters, filter1) => {
|
|
93
90
|
const filter2Index = filters2.findIndex(filter2 => (0, resolveFilterConditions_1.resolveFilterConditions)(filter2, { column: filter1.column, dateSection: filter1.dateSection, panelid: filter1.extras.panelid, property: filter1.property, validator: filter1.validator }));
|
|
94
91
|
if (filter2Index > -1) {
|
|
95
|
-
filter1 = Object.assign(Object.assign({}, filter1), { values: mergeValues(filter1, filters2[filter2Index], settings) });
|
|
92
|
+
filter1 = Object.assign(Object.assign({}, filter1), { values: (0, mergeValues_1.mergeValues)(filter1, filters2[filter2Index], settings) });
|
|
96
93
|
filter1 = mergeFilterProps(filter1, filters2[filter2Index], settings);
|
|
97
94
|
filters2.splice(filter2Index, 1);
|
|
98
95
|
}
|
|
@@ -115,60 +112,9 @@ function mergeFilterss(filters1 = [], filters2 = [], settings) {
|
|
|
115
112
|
* @returns a new filter structure with overwritted props
|
|
116
113
|
*/
|
|
117
114
|
function mergeFilterProps(filter1, filter2, settings) {
|
|
115
|
+
var _a, _b, _c;
|
|
118
116
|
if (settings.overwriteFilterProps) {
|
|
119
|
-
filter1 = Object.assign(Object.assign({}, filter1), { extras: filter2.extras, enabled: filter2.enabled
|
|
117
|
+
filter1 = Object.assign(Object.assign({}, filter1), { collapsed: (_a = filter2.collapsed) !== null && _a !== void 0 ? _a : filter1.collapsed, displayed: (_b = filter2.displayed) !== null && _b !== void 0 ? _b : filter1.displayed, dateSection: filter2.dateSection, extras: filter2.extras, enabled: (_c = filter2.enabled) !== null && _c !== void 0 ? _c : filter1.enabled, filterid: filter2.filterid, lookupDisplayIndex: filter2.lookupDisplayIndex, nullValues: filter2.nullValues, selectAll: filter2.selectAll });
|
|
120
118
|
}
|
|
121
119
|
return filter1;
|
|
122
120
|
}
|
|
123
|
-
/**
|
|
124
|
-
* Gets a new value structure array by merging two value structures
|
|
125
|
-
* @param filter1 the target filter structure
|
|
126
|
-
* @param filter2 the filter to be used to merge the values
|
|
127
|
-
* @param settings configuration of the mergeFilter
|
|
128
|
-
* @returns a new value structure array
|
|
129
|
-
*/
|
|
130
|
-
function mergeValues(filter1, filter2, settings) {
|
|
131
|
-
if ((0, isEmpty_1.isEmpty)(filter1) && (0, isEmpty_1.isEmpty)(filter2))
|
|
132
|
-
return [];
|
|
133
|
-
let newValues = [];
|
|
134
|
-
let filter1Values = filter1.values || [];
|
|
135
|
-
const filter2Values = filter2.values || [];
|
|
136
|
-
if (!settings.overwriteValues) {
|
|
137
|
-
if ((0, isInValidator_1.isInValidator)(filter1.validator)) {
|
|
138
|
-
newValues = filter2Values.reduce((values, value2) => {
|
|
139
|
-
const value1Index = filter1Values.findIndex(value1 => value2.anchor === value1.anchor && value2.cursor === value1.cursor && value2.includeCurrent === value1.includeCurrent && value2.isCalendarDate === value1.isCalendarDate && value2.number === value1.number && value2.unit === value1.unit);
|
|
140
|
-
if (value1Index === -1) {
|
|
141
|
-
values.push(value2);
|
|
142
|
-
}
|
|
143
|
-
return values;
|
|
144
|
-
}, filter1Values);
|
|
145
|
-
}
|
|
146
|
-
else if ((0, isRangeValidator_1.isRangeValidator)(filter1.validator)) {
|
|
147
|
-
newValues = filter2Values.reduce((values, value2) => {
|
|
148
|
-
const value1Index = filter1Values.findIndex(value1 => value2.max === value1.max && value2.min === value1.min);
|
|
149
|
-
if (value1Index === -1) {
|
|
150
|
-
values.push(value2);
|
|
151
|
-
}
|
|
152
|
-
return values;
|
|
153
|
-
}, filter1Values);
|
|
154
|
-
}
|
|
155
|
-
else if ((0, isRegularValidator_1.isRegularValidator)(filter1.validator) || (0, isNullValidator_1.isNullValidator)(filter1.validator)) {
|
|
156
|
-
newValues = filter2Values.reduce((values, value2) => {
|
|
157
|
-
const value1Index = filter1Values.findIndex(value1 => value2.imageUrl === value1.imageUrl && value2.value === value1.value);
|
|
158
|
-
if (value1Index === -1) {
|
|
159
|
-
values.push(value2);
|
|
160
|
-
}
|
|
161
|
-
return values;
|
|
162
|
-
}, filter1Values);
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
filter1Values = filter1Values.concat(filter2Values);
|
|
166
|
-
newValues = filter1Values;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
filter1Values = filter2Values;
|
|
171
|
-
newValues = filter1Values;
|
|
172
|
-
}
|
|
173
|
-
return newValues;
|
|
174
|
-
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IFSFilter } from "../../interfaces/common/IFSFilter";
|
|
2
|
+
import { IFFiltersMergeValues } from "../../interfaces/functions/IFFiltersMergeValues";
|
|
3
|
+
import { IFValue } from "../../interfaces/IFValue";
|
|
4
|
+
/**
|
|
5
|
+
* Gets a new value structure array by merging two value structures
|
|
6
|
+
* @param filter1 the target filter structure
|
|
7
|
+
* @param filter2 the filter to be used to merge the values
|
|
8
|
+
* @param settings configuration of the mergeFilter
|
|
9
|
+
* @returns a new value structure array
|
|
10
|
+
*/
|
|
11
|
+
export declare function mergeValues(filter1: IFSFilter, filter2: IFSFilter, settings?: IFFiltersMergeValues): IFValue[];
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeValues = void 0;
|
|
4
|
+
const isEmpty_1 = require("../../../general/mix/isEmpty");
|
|
5
|
+
const getMergeValuesSettings_1 = require("./getMergeValuesSettings");
|
|
6
|
+
const isInValidator_1 = require("./isInValidator");
|
|
7
|
+
const isNullValidator_1 = require("./isNullValidator");
|
|
8
|
+
const isRangeValidator_1 = require("./isRangeValidator");
|
|
9
|
+
const isRegularValidator_1 = require("./isRegularValidator");
|
|
10
|
+
/**
|
|
11
|
+
* Gets a new value structure array by merging two value structures
|
|
12
|
+
* @param filter1 the target filter structure
|
|
13
|
+
* @param filter2 the filter to be used to merge the values
|
|
14
|
+
* @param settings configuration of the mergeFilter
|
|
15
|
+
* @returns a new value structure array
|
|
16
|
+
*/
|
|
17
|
+
function mergeValues(filter1, filter2, settings) {
|
|
18
|
+
if ((0, isEmpty_1.isEmpty)(filter1) && (0, isEmpty_1.isEmpty)(filter2))
|
|
19
|
+
return [];
|
|
20
|
+
settings = (0, getMergeValuesSettings_1.getMergeValuesSettings)(settings);
|
|
21
|
+
let newValues = [];
|
|
22
|
+
let filter1Values = filter1.values || [];
|
|
23
|
+
const filter2Values = filter2.values || [];
|
|
24
|
+
if (settings.overwriteValues) {
|
|
25
|
+
filter1Values = filter2Values;
|
|
26
|
+
newValues = filter1Values;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
if ((0, isInValidator_1.isInValidator)(filter1.validator)) {
|
|
30
|
+
newValues = filter2Values.reduce((values, value2) => {
|
|
31
|
+
var _a;
|
|
32
|
+
const value1Index = filter1Values.findIndex(value1 => value2.anchor === value1.anchor && value2.cursor === value1.cursor && value2.includeCurrent === value1.includeCurrent && value2.isCalendarDate === value1.isCalendarDate && value2.number === value1.number && value2.unit === value1.unit);
|
|
33
|
+
if (value1Index === -1) {
|
|
34
|
+
values.push(value2);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
values[value1Index] = {
|
|
38
|
+
anchor: value2.anchor,
|
|
39
|
+
cursor: value2.cursor,
|
|
40
|
+
enabled: (_a = value2.enabled) !== null && _a !== void 0 ? _a : values[value1Index].enabled,
|
|
41
|
+
includeCurrent: value2.includeCurrent,
|
|
42
|
+
isCalendarDate: value2.isCalendarDate,
|
|
43
|
+
number: value2.number,
|
|
44
|
+
unit: value2.unit,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return values;
|
|
48
|
+
}, filter1Values);
|
|
49
|
+
}
|
|
50
|
+
else if ((0, isRangeValidator_1.isRangeValidator)(filter1.validator)) {
|
|
51
|
+
newValues = filter2Values.reduce((values, value2) => {
|
|
52
|
+
var _a;
|
|
53
|
+
const value1Index = filter1Values.findIndex(value1 => value2.max === value1.max && value2.min === value1.min);
|
|
54
|
+
if (value1Index === -1) {
|
|
55
|
+
values.push(value2);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
values[value1Index] = {
|
|
59
|
+
enabled: (_a = value2.enabled) !== null && _a !== void 0 ? _a : values[value1Index].enabled,
|
|
60
|
+
max: value2.max,
|
|
61
|
+
min: value2.min,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return values;
|
|
65
|
+
}, filter1Values);
|
|
66
|
+
}
|
|
67
|
+
else if ((0, isRegularValidator_1.isRegularValidator)(filter1.validator) || (0, isNullValidator_1.isNullValidator)(filter1.validator)) {
|
|
68
|
+
newValues = filter2Values.reduce((values, value2) => {
|
|
69
|
+
var _a;
|
|
70
|
+
const value1Index = filter1Values.findIndex(value1 => value2.imageUrl === value1.imageUrl && value2.value === value1.value);
|
|
71
|
+
if (value1Index === -1) {
|
|
72
|
+
values.push(value2);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
values[value1Index] = {
|
|
76
|
+
enabled: (_a = value2.enabled) !== null && _a !== void 0 ? _a : values[value1Index].enabled,
|
|
77
|
+
imageUrl: value2.imageUrl,
|
|
78
|
+
value: value2.value,
|
|
79
|
+
valueid: value2.valueid,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return values;
|
|
83
|
+
}, filter1Values);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
filter1Values = filter1Values.concat(filter2Values);
|
|
87
|
+
newValues = filter1Values;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return newValues;
|
|
91
|
+
}
|
|
92
|
+
exports.mergeValues = mergeValues;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { IFFiltersMergeValues } from "./IFFiltersMergeValues";
|
|
1
2
|
/**
|
|
2
3
|
* Structure for MergeFilters property settings
|
|
3
4
|
*/
|
|
4
|
-
export interface IFFiltersMergeFilters {
|
|
5
|
+
export interface IFFiltersMergeFilters extends IFFiltersMergeValues {
|
|
5
6
|
overwriteFilterProps?: boolean;
|
|
6
|
-
overwriteValues?: boolean;
|
|
7
7
|
setGroupedColumnOperator?: boolean;
|
|
8
8
|
}
|
|
@@ -18,4 +18,5 @@ __exportStar(require("./IFFiltersGetData"), exports);
|
|
|
18
18
|
__exportStar(require("./IFFiltersGetValuesFromDataset"), exports);
|
|
19
19
|
__exportStar(require("./IFFiltersGetValuesFromModel"), exports);
|
|
20
20
|
__exportStar(require("./IFFiltersMergeFilters"), exports);
|
|
21
|
+
__exportStar(require("./IFFiltersMergeValues"), exports);
|
|
21
22
|
__exportStar(require("./IFFiltersParamsToGetFilter"), exports);
|
|
@@ -9,7 +9,7 @@ export default class UChartPaginationApi {
|
|
|
9
9
|
uFilter: IFUFlattenedFilter;
|
|
10
10
|
/**
|
|
11
11
|
* Gets afterKey object
|
|
12
|
-
* @returns
|
|
12
|
+
* @returns the afterKey object
|
|
13
13
|
*/
|
|
14
14
|
getAfterKey: () => any;
|
|
15
15
|
/**
|
|
@@ -38,7 +38,7 @@ export default class UChartPaginationApi {
|
|
|
38
38
|
/**
|
|
39
39
|
* Get a dimension body structure foor pagination endpoint
|
|
40
40
|
* @param dimensions
|
|
41
|
-
* @returns
|
|
41
|
+
* @returns the dimension body structure
|
|
42
42
|
*/
|
|
43
43
|
private _getDimensionsBodyAdapter;
|
|
44
44
|
/**
|
|
@@ -21,7 +21,7 @@ class UChartPaginationApi {
|
|
|
21
21
|
constructor() {
|
|
22
22
|
/**
|
|
23
23
|
* Gets afterKey object
|
|
24
|
-
* @returns
|
|
24
|
+
* @returns the afterKey object
|
|
25
25
|
*/
|
|
26
26
|
this.getAfterKey = () => {
|
|
27
27
|
return this.afterKey;
|
|
@@ -100,7 +100,7 @@ class UChartPaginationApi {
|
|
|
100
100
|
/**
|
|
101
101
|
* Get a dimension body structure foor pagination endpoint
|
|
102
102
|
* @param dimensions
|
|
103
|
-
* @returns
|
|
103
|
+
* @returns the dimension body structure
|
|
104
104
|
*/
|
|
105
105
|
this._getDimensionsBodyAdapter = (dimensions = []) => {
|
|
106
106
|
return dimensions.map(dimension => ({
|
|
@@ -27,7 +27,8 @@ function formatDate(dateString, format) {
|
|
|
27
27
|
return dateString;
|
|
28
28
|
if (!isValidDateString(dateString))
|
|
29
29
|
return dateString;
|
|
30
|
-
|
|
30
|
+
const dateValue = dateString === null || dateString === void 0 ? void 0 : dateString.replace(/Z$/i, '');
|
|
31
|
+
return (0, dayjs_1.default)(dateValue.split('.')[0]).format(format.replace('HH24:', 'HH:').replace('MI:SS', 'mm:ss').replace('MM:SS', 'mm:ss'));
|
|
31
32
|
}
|
|
32
33
|
exports.formatDate = formatDate;
|
|
33
34
|
function formatAbbreviated(num, decimals) {
|
|
@@ -85,12 +86,13 @@ function formatFileSize(bytes) {
|
|
|
85
86
|
}
|
|
86
87
|
exports.formatFileSize = formatFileSize;
|
|
87
88
|
const addFormat = (value, outputFormat = 'None', config) => {
|
|
89
|
+
var _a, _b;
|
|
88
90
|
if ((0, isEmpty_1.isEmpty)(value) || typeof value === 'object' && (0, isEmpty_1.isEmpty)(value[0]))
|
|
89
91
|
return value;
|
|
90
92
|
switch (outputFormat.type) {
|
|
91
93
|
case 'DATE':
|
|
92
94
|
case 'DATETIME':
|
|
93
|
-
return (config === null || config === void 0 ? void 0 : config.lang) && outputFormat.format === 'Default' ? (0, localization_1.formatWithLocale)(value, outputFormat, config) : formatDate(value, outputFormat.format);
|
|
95
|
+
return (config === null || config === void 0 ? void 0 : config.lang) && outputFormat.format === 'Default' ? (0, localization_1.formatWithLocale)(value, outputFormat, config) : formatDate(value, (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === 'Default' && ((_a = outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) === null || _a === void 0 ? void 0 : _a.format) ? (_b = outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) === null || _b === void 0 ? void 0 : _b.format : outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format);
|
|
94
96
|
case 'NUMERIC': {
|
|
95
97
|
const parse = parseFloat(value);
|
|
96
98
|
const withLocale = outputFormat !== 'None' && (config === null || config === void 0 ? void 0 : config.lang);
|
|
@@ -30,9 +30,10 @@ const formatWithLocale = (value, outputFormat, config = {}) => {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
exports.formatWithLocale = formatWithLocale;
|
|
33
|
+
const DATE_FORMAT_CACHE = [];
|
|
33
34
|
function formatLocaleDate(value, outputFormat, config) {
|
|
34
35
|
const { lang = definition_1.LANG_DEFAULT, options } = config;
|
|
35
|
-
const dateValue = value === null || value === void 0 ? void 0 : value.replace(
|
|
36
|
+
const dateValue = value === null || value === void 0 ? void 0 : value.replace(/Z$/i, '');
|
|
36
37
|
const dateParam = new Date(dateValue);
|
|
37
38
|
let langOpts = options;
|
|
38
39
|
if (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.originalFormat) {
|
|
@@ -41,18 +42,31 @@ function formatLocaleDate(value, outputFormat, config) {
|
|
|
41
42
|
langOpts = definition_1.DATETIME_OPTIONS;
|
|
42
43
|
}
|
|
43
44
|
try {
|
|
44
|
-
|
|
45
|
+
const key = lang + JSON.stringify(langOpts);
|
|
46
|
+
let formatter = DATE_FORMAT_CACHE[key];
|
|
47
|
+
if (!formatter) {
|
|
48
|
+
formatter = new Intl.DateTimeFormat([lang, definition_1.LANG_DEFAULT], langOpts);
|
|
49
|
+
DATE_FORMAT_CACHE[key] = formatter;
|
|
50
|
+
}
|
|
51
|
+
return formatter.format(dateParam);
|
|
45
52
|
}
|
|
46
53
|
catch (error) {
|
|
47
54
|
return (0, isEmpty_1.isEmpty)(dateParam) ? value : new Intl.DateTimeFormat(definition_1.LANG_DEFAULT, langOpts).format(dateParam);
|
|
48
55
|
}
|
|
49
56
|
}
|
|
57
|
+
const NUMBER_FORMAT_CACHE = [];
|
|
50
58
|
function formatLocaleNumber(value, outputFormat, config) {
|
|
51
59
|
const { lang = definition_1.LANG_DEFAULT, options } = config;
|
|
52
60
|
const langOpts = options || getLocaleOptions(outputFormat);
|
|
53
61
|
const valueToFormat = (outputFormat === null || outputFormat === void 0 ? void 0 : outputFormat.format) === "Percentage" /* PERCENTAGE */ ? value / 100 : value;
|
|
54
62
|
try {
|
|
55
|
-
|
|
63
|
+
const key = lang + JSON.stringify(langOpts);
|
|
64
|
+
let formatter = NUMBER_FORMAT_CACHE[key];
|
|
65
|
+
if (!formatter) {
|
|
66
|
+
formatter = new Intl.NumberFormat([lang, definition_1.LANG_DEFAULT], langOpts);
|
|
67
|
+
NUMBER_FORMAT_CACHE[key] = formatter;
|
|
68
|
+
}
|
|
69
|
+
return formatter.format(valueToFormat);
|
|
56
70
|
}
|
|
57
71
|
catch (e) {
|
|
58
72
|
return new Intl.NumberFormat(definition_1.LANG_DEFAULT, langOpts).format(valueToFormat);
|
|
@@ -26,6 +26,7 @@ exports.I18N_DASHBOARD = {
|
|
|
26
26
|
data_views_updated_message: 'Data views updated successfully.',
|
|
27
27
|
delete_record_message: 'Record Successfully Deleted.',
|
|
28
28
|
refresh_table_message: 'Record Successfully Edited.',
|
|
29
|
+
failed_download: 'The file(s) could not be exported at this time.',
|
|
29
30
|
},
|
|
30
31
|
tooltips: {
|
|
31
32
|
buckets: "Buckets",
|
|
@@ -6,6 +6,7 @@ const isNumericalColumn_1 = require("../../columns/helpers/isNumericalColumn");
|
|
|
6
6
|
const DATE_GROUPING_PROPERTY_1 = require("../../dates/constants/DATE_GROUPING_PROPERTY");
|
|
7
7
|
const DATE_GROUPING_TIME_PROPERTY_1 = require("../../dates/constants/DATE_GROUPING_TIME_PROPERTY");
|
|
8
8
|
const format_1 = require("../../format/format");
|
|
9
|
+
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
9
10
|
const getI18nDateGroupLabel_1 = require("../../globalization/helpers/getI18nDateGroupLabel");
|
|
10
11
|
const getValueWithSuffixes_1 = require("./getValueWithSuffixes");
|
|
11
12
|
/**
|
|
@@ -15,6 +16,8 @@ const getValueWithSuffixes_1 = require("./getValueWithSuffixes");
|
|
|
15
16
|
* @returns A transformed value
|
|
16
17
|
*/
|
|
17
18
|
function transformValue(value, settings) {
|
|
19
|
+
if ((0, isEmpty_1.isEmpty)(value))
|
|
20
|
+
return value;
|
|
18
21
|
const valueWithI18n = (0, getI18nDateGroupLabel_1.getI18nDateGroupLabel)(value, settings.property, settings.translate);
|
|
19
22
|
const valueWithLocalization = (0, format_1.addFormat)(valueWithI18n, getOutputFormat(settings), getFormatConfig(settings));
|
|
20
23
|
return (0, getValueWithSuffixes_1.getValueWithSuffixes)(valueWithLocalization, { suffixTranslateLabel: settings.suffixTranslateLabel, translate: settings.translate });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { IBModelBranchesMap } from "../../qrvey/interfaces/IBModelBranchesMap";
|
|
2
2
|
import { IModelBranchesMap } from "../../qrvey/interfaces/IModelBranchesMap";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @param branchesMap
|
|
6
|
-
* @returns
|
|
4
|
+
* Adapts the branches map from backend to the UI branches map
|
|
5
|
+
* @param branchesMap the backend branches map
|
|
6
|
+
* @returns The Branches map array
|
|
7
7
|
*/
|
|
8
8
|
export declare function BBranchesMapToUIBranchesMap(branchesMap: IBModelBranchesMap[]): IModelBranchesMap[];
|
|
@@ -4,9 +4,9 @@ exports.BBranchesMapToUIBranchesMap = void 0;
|
|
|
4
4
|
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
5
5
|
const BColumnsToUIColumns_adapter_1 = require("./BColumnsToUIColumns.adapter");
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @param branchesMap
|
|
9
|
-
* @returns
|
|
7
|
+
* Adapts the branches map from backend to the UI branches map
|
|
8
|
+
* @param branchesMap the backend branches map
|
|
9
|
+
* @returns The Branches map array
|
|
10
10
|
*/
|
|
11
11
|
function BBranchesMapToUIBranchesMap(branchesMap) {
|
|
12
12
|
if ((0, isEmpty_1.isEmpty)(branchesMap))
|
|
@@ -7,7 +7,7 @@ import { COLUMN } from "../../columns/constants/COLUMN";
|
|
|
7
7
|
* @returns A new value array with the filled properties.
|
|
8
8
|
*/
|
|
9
9
|
export function adaptFilterValues(filter) {
|
|
10
|
-
const setValue = value => (Object.assign(Object.assign({}, value), { enabled: isEmpty(value.enabled) ? true : value.enabled }));
|
|
10
|
+
const setValue = value => (Object.assign(Object.assign({}, value), { value: isEmpty(value.value) ? undefined : value.value, enabled: isEmpty(value.enabled) ? true : value.enabled }));
|
|
11
11
|
if (filter.column.type === COLUMN.RANKING && isEmpty(filter.column.aggregate)) {
|
|
12
12
|
return (filter.values || []).map(rValues => rValues.map(setValue));
|
|
13
13
|
}
|
|
@@ -3,6 +3,7 @@ import { isEmpty } from "../../general/mix/isEmpty";
|
|
|
3
3
|
import { adaptFilterValues } from "./adaptFilterValues";
|
|
4
4
|
import { FILTER_SECTION } from "../constants/common/FILTER_SECTION";
|
|
5
5
|
import { FILTER_STRUCTURE_VERSION } from "../constants/common/FILTER_STRUCTURE_VERSION";
|
|
6
|
+
import { cloneDeep } from "../../general/object/cloneDeep";
|
|
6
7
|
/**
|
|
7
8
|
* Generates a filter data structure from the flatttened UI filters.
|
|
8
9
|
* @param uFilters Array of flattened filters from UI
|
|
@@ -78,8 +79,11 @@ function buildDataset(uFilter) {
|
|
|
78
79
|
* @returns an filter structure
|
|
79
80
|
*/
|
|
80
81
|
function buildFilter(uFilter) {
|
|
82
|
+
uFilter = cloneDeep(uFilter);
|
|
81
83
|
const info = !isEmpty(uFilter.extras.info) ? { icon: uFilter.extras.info.icon, label: uFilter.extras.info.label } : undefined;
|
|
82
84
|
const property = adaptDateGroupingProperty(uFilter.property);
|
|
85
|
+
delete uFilter.extras.scopeInfo;
|
|
86
|
+
delete uFilter.extras.dataset;
|
|
83
87
|
return {
|
|
84
88
|
collapsed: uFilter.collapsed,
|
|
85
89
|
column: {
|
|
@@ -353,7 +353,7 @@ function getResultValues(values, props) {
|
|
|
353
353
|
return (values || []).map((value) => {
|
|
354
354
|
if (value.enabled) {
|
|
355
355
|
if (props.column.type === COLUMN.IMAGE) {
|
|
356
|
-
return value.valueid;
|
|
356
|
+
return value.valueid || value.imageUrl || value.value;
|
|
357
357
|
}
|
|
358
358
|
else {
|
|
359
359
|
return value.value;
|
|
@@ -4,6 +4,7 @@ import { FILTER_SECTION } from "../constants/common/FILTER_SECTION";
|
|
|
4
4
|
import { FILTER_STRUCTURE_VERSION } from "../constants/common/FILTER_STRUCTURE_VERSION";
|
|
5
5
|
import { getLastIndexFromArray } from "../../general/array/getLastIndexFromArray";
|
|
6
6
|
import { isEmpty } from "../../general/mix/isEmpty";
|
|
7
|
+
import { cloneDeep } from "../../general/object/cloneDeep";
|
|
7
8
|
/**
|
|
8
9
|
* Generates a UI filter data structure from the flatttened UI filters.
|
|
9
10
|
* @param uFilters Array of flattened filters from UI
|
|
@@ -85,8 +86,11 @@ function buildDataset(uFilter) {
|
|
|
85
86
|
* @returns an filter structure
|
|
86
87
|
*/
|
|
87
88
|
function buildFilter(uFilter) {
|
|
89
|
+
uFilter = cloneDeep(uFilter);
|
|
88
90
|
const info = !isEmpty(uFilter.extras.info) ? { icon: uFilter.extras.info.icon, label: uFilter.extras.info.label } : undefined;
|
|
89
91
|
const property = adaptDateGroupingProperty(uFilter.property);
|
|
92
|
+
delete uFilter.extras.scopeInfo;
|
|
93
|
+
delete uFilter.extras.dataset;
|
|
90
94
|
return {
|
|
91
95
|
collapsed: uFilter.collapsed,
|
|
92
96
|
column: {
|