@qrvey/utils 1.7.0-3 → 1.7.0-4
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/filters/adapters/adaptFilterValues.js +2 -6
- package/dist/cjs/filters/adapters/flatUIToOldLogic.js +4 -5
- package/dist/cjs/filters/adapters/logicToFlatUI.js +2 -2
- package/dist/cjs/filters/helpers/backend/getBackendValues.js +2 -3
- 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/isRankingFilter.d.ts +9 -0
- package/dist/cjs/filters/helpers/common/isRankingFilter.js +19 -0
- package/dist/cjs/filters/helpers/ui/getUIValues.js +2 -3
- package/dist/cjs/filters/helpers/ui/transformFilterValues.js +2 -1
- package/dist/filters/adapters/adaptFilterValues.js +2 -6
- package/dist/filters/adapters/flatUIToOldLogic.js +4 -5
- package/dist/filters/adapters/logicToFlatUI.js +2 -2
- package/dist/filters/helpers/backend/getBackendValues.js +2 -3
- package/dist/filters/helpers/common/index.d.ts +1 -0
- package/dist/filters/helpers/common/index.js +1 -0
- package/dist/filters/helpers/common/isRankingFilter.d.ts +9 -0
- package/dist/filters/helpers/common/isRankingFilter.js +15 -0
- package/dist/filters/helpers/ui/getUIValues.js +2 -3
- package/dist/filters/helpers/ui/transformFilterValues.js +2 -1
- package/package.json +1 -1
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.adaptFilterValues = void 0;
|
|
4
4
|
const isEmpty_1 = require("../../general/mix/isEmpty");
|
|
5
|
-
const
|
|
6
|
-
const constants_1 = require("../constants");
|
|
5
|
+
const isRankingFilter_1 = require("../helpers/common/isRankingFilter");
|
|
7
6
|
/**
|
|
8
7
|
* [TODO: For 2022, eliminate this adapter]
|
|
9
8
|
* Gets an adapted filter value array. Validates the enabled property and sets
|
|
@@ -12,10 +11,7 @@ const constants_1 = require("../constants");
|
|
|
12
11
|
*/
|
|
13
12
|
function adaptFilterValues(filter) {
|
|
14
13
|
const setValue = (value) => (Object.assign(Object.assign({}, value), { value: (0, isEmpty_1.isEmpty)(value.value) ? undefined : value.value, displayed: (0, isEmpty_1.isEmpty)(value.displayed) ? true : value.displayed, enabled: (0, isEmpty_1.isEmpty)(value.enabled) ? true : value.enabled }));
|
|
15
|
-
if (
|
|
16
|
-
(0, isEmpty_1.isEmpty)(filter.column.aggregate) &&
|
|
17
|
-
filter.validator !== constants_1.FILTER_VALIDATOR.IS_NULL &&
|
|
18
|
-
filter.validator !== constants_1.FILTER_VALIDATOR.IS_NOT_NULL) {
|
|
14
|
+
if ((0, isRankingFilter_1.isRankingFilter)(filter)) {
|
|
19
15
|
return (filter.values || []).map((rValues) => rValues.map(setValue));
|
|
20
16
|
}
|
|
21
17
|
return ((filter.values || []) || []).map(setValue);
|
|
@@ -17,6 +17,7 @@ const isNull_1 = require("../../general/mix/isNull");
|
|
|
17
17
|
const flattenDeep_1 = require("../../general/array/flattenDeep");
|
|
18
18
|
const getBackendGroupValue_1 = require("../helpers/backend/getBackendGroupValue");
|
|
19
19
|
const getBackendProperty_1 = require("../helpers/backend/getBackendProperty");
|
|
20
|
+
const isRankingFilter_1 = require("../helpers/common/isRankingFilter");
|
|
20
21
|
/**
|
|
21
22
|
* Generates a Logic structure from flattened UI filters
|
|
22
23
|
* @param uFilters Array of flat filters from UI
|
|
@@ -114,7 +115,7 @@ function getLogicBody(uFilters) {
|
|
|
114
115
|
exports.getLogicBody = getLogicBody;
|
|
115
116
|
function getExpressions(props) {
|
|
116
117
|
let expressions = [];
|
|
117
|
-
if (
|
|
118
|
+
if ((0, isRankingFilter_1.isRankingFilter)(props)) {
|
|
118
119
|
expressions = expressions.concat(getRankingExpressions(props));
|
|
119
120
|
}
|
|
120
121
|
else {
|
|
@@ -168,8 +169,7 @@ function getValues(props, rankingGroupIndex) {
|
|
|
168
169
|
switch (props.validator) {
|
|
169
170
|
case FILTER_VALIDATOR_1.FILTER_VALIDATOR.EQUALS:
|
|
170
171
|
case FILTER_VALIDATOR_1.FILTER_VALIDATOR.NOT_EQUAL:
|
|
171
|
-
if (
|
|
172
|
-
(0, isEmpty_1.isEmpty)(props.column.aggregate))
|
|
172
|
+
if ((0, isRankingFilter_1.isRankingFilter)(props))
|
|
173
173
|
return getRankingValues(values, rankingGroupIndex);
|
|
174
174
|
return getResultValues(values, props);
|
|
175
175
|
case FILTER_VALIDATOR_1.FILTER_VALIDATOR.CONTAINS:
|
|
@@ -253,8 +253,7 @@ function getUIValuess(props, rankingGroupIndex) {
|
|
|
253
253
|
? `from ${value.anchor || "current date"}`
|
|
254
254
|
: ""}`, displayed: value.displayed != null ? value.displayed : true, enabled: props.enabled })));
|
|
255
255
|
default:
|
|
256
|
-
if (
|
|
257
|
-
(0, isEmpty_1.isEmpty)(props.column.aggregate)) {
|
|
256
|
+
if ((0, isRankingFilter_1.isRankingFilter)(props)) {
|
|
258
257
|
return getRankingUIValues(values, rankingGroupIndex);
|
|
259
258
|
}
|
|
260
259
|
return values.map((val) => (Object.assign(Object.assign({}, val), { enabled: val.enabled != null ? val.enabled : true })));
|
|
@@ -13,6 +13,7 @@ const FILTER_SCOPE_1 = require("../constants/common/FILTER_SCOPE");
|
|
|
13
13
|
const get_1 = require("../../general/object/get");
|
|
14
14
|
const isNullValidator_1 = require("../helpers/common/isNullValidator");
|
|
15
15
|
const FILTER_VALIDATOR_INFO_1 = require("../constants/common/FILTER_VALIDATOR_INFO");
|
|
16
|
+
const isRankingFilter_1 = require("../helpers/common/isRankingFilter");
|
|
16
17
|
/**
|
|
17
18
|
* Adapts the Old logic structure (v2.0) to the flattened UI filter Structure.
|
|
18
19
|
* @param logics The old logic structure (v2.0)
|
|
@@ -50,8 +51,7 @@ function buildFilterByExpression(expression, scopeItem, uFilters) {
|
|
|
50
51
|
uFilter.filterid = (0, getFilterid_1.getFilterid)(uFilter);
|
|
51
52
|
uFilters.push(uFilter);
|
|
52
53
|
}
|
|
53
|
-
if (
|
|
54
|
-
(0, isEmpty_1.isEmpty)(uiExtras.column.aggregate)) {
|
|
54
|
+
if ((0, isRankingFilter_1.isRankingFilter)(uiExtras)) {
|
|
55
55
|
// Restore uiExtras.values array into single IFilterDetail object values array
|
|
56
56
|
if (index > -1)
|
|
57
57
|
uFilters[index].values.push(uiExtras.values[0]);
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getBackendValues = void 0;
|
|
4
4
|
const COLUMN_1 = require("../../../columns/constants/COLUMN");
|
|
5
5
|
const flattenDeep_1 = require("../../../general/array/flattenDeep");
|
|
6
|
-
const isEmpty_1 = require("../../../general/mix/isEmpty");
|
|
7
6
|
const FILTER_VALIDATOR_1 = require("../../constants/common/FILTER_VALIDATOR");
|
|
8
7
|
const FILTER_VALIDATOR_INFO_1 = require("../../constants/common/FILTER_VALIDATOR_INFO");
|
|
8
|
+
const isRankingFilter_1 = require("../common/isRankingFilter");
|
|
9
9
|
/**
|
|
10
10
|
* Gets the expresion values in the logic format
|
|
11
11
|
* @param filter The filter structure
|
|
@@ -22,8 +22,7 @@ function getBackendValues(filter) {
|
|
|
22
22
|
case FILTER_VALIDATOR_1.FILTER_VALIDATOR.NOT_START_WITH:
|
|
23
23
|
case FILTER_VALIDATOR_1.FILTER_VALIDATOR.ENDS_WITH:
|
|
24
24
|
case FILTER_VALIDATOR_1.FILTER_VALIDATOR.NOT_END_WITH:
|
|
25
|
-
if (
|
|
26
|
-
(0, isEmpty_1.isEmpty)(filter.column.aggregate))
|
|
25
|
+
if ((0, isRankingFilter_1.isRankingFilter)(filter))
|
|
27
26
|
return getRankingValues(values);
|
|
28
27
|
return getResultValues(values, filter);
|
|
29
28
|
case FILTER_VALIDATOR_1.FILTER_VALIDATOR.BETWEEN_INCLUSIVE:
|
|
@@ -21,6 +21,7 @@ export * from "./isDateDistinctProperty";
|
|
|
21
21
|
export * from "./isInValidator";
|
|
22
22
|
export * from "./isNullValidator";
|
|
23
23
|
export * from "./isRangeValidator";
|
|
24
|
+
export * from "./isRankingFilter";
|
|
24
25
|
export * from "./isRegularValidator";
|
|
25
26
|
export * from "./mergeFilters";
|
|
26
27
|
export * from "./mergeValues";
|
|
@@ -37,6 +37,7 @@ __exportStar(require("./isDateDistinctProperty"), exports);
|
|
|
37
37
|
__exportStar(require("./isInValidator"), exports);
|
|
38
38
|
__exportStar(require("./isNullValidator"), exports);
|
|
39
39
|
__exportStar(require("./isRangeValidator"), exports);
|
|
40
|
+
__exportStar(require("./isRankingFilter"), exports);
|
|
40
41
|
__exportStar(require("./isRegularValidator"), exports);
|
|
41
42
|
__exportStar(require("./mergeFilters"), exports);
|
|
42
43
|
__exportStar(require("./mergeValues"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IFSFilter } from "../../interfaces/common/IFSFilter";
|
|
2
|
+
import { IFUFilter } from "../../interfaces/ui/IFUFilter";
|
|
3
|
+
/**
|
|
4
|
+
* Validates if the given filter is considering a ranking filter type.
|
|
5
|
+
* - Filters with Null and Is Not Null for ranking column are not considering as Ranking Filters.
|
|
6
|
+
* @param filter The filter object
|
|
7
|
+
* @returns a true if the filter is a ranking filter.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isRankingFilter(filter: IFUFilter | IFSFilter): boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRankingFilter = void 0;
|
|
4
|
+
const COLUMN_1 = require("../../../columns/constants/COLUMN");
|
|
5
|
+
const isEmpty_1 = require("../../../general/mix/isEmpty");
|
|
6
|
+
const FILTER_VALIDATOR_1 = require("../../constants/common/FILTER_VALIDATOR");
|
|
7
|
+
/**
|
|
8
|
+
* Validates if the given filter is considering a ranking filter type.
|
|
9
|
+
* - Filters with Null and Is Not Null for ranking column are not considering as Ranking Filters.
|
|
10
|
+
* @param filter The filter object
|
|
11
|
+
* @returns a true if the filter is a ranking filter.
|
|
12
|
+
*/
|
|
13
|
+
function isRankingFilter(filter) {
|
|
14
|
+
return (filter.column.type === COLUMN_1.COLUMN.RANKING &&
|
|
15
|
+
(0, isEmpty_1.isEmpty)(filter.column.aggregate) &&
|
|
16
|
+
filter.validator !== FILTER_VALIDATOR_1.FILTER_VALIDATOR.IS_NULL &&
|
|
17
|
+
filter.validator !== FILTER_VALIDATOR_1.FILTER_VALIDATOR.IS_NOT_NULL);
|
|
18
|
+
}
|
|
19
|
+
exports.isRankingFilter = isRankingFilter;
|
|
@@ -4,12 +4,12 @@ exports.getUIValues = void 0;
|
|
|
4
4
|
const RELATIVE_CURSOR_1 = require("../../../dates/relative/constants/RELATIVE_CURSOR");
|
|
5
5
|
const FILTER_VALIDATOR_1 = require("../../constants/common/FILTER_VALIDATOR");
|
|
6
6
|
const FILTER_VALIDATOR_INFO_1 = require("../../constants/common/FILTER_VALIDATOR_INFO");
|
|
7
|
-
const COLUMN_1 = require("../../../columns/constants/COLUMN");
|
|
8
7
|
const isEmpty_1 = require("../../../general/mix/isEmpty");
|
|
9
8
|
const flattenDeep_1 = require("../../../general/array/flattenDeep");
|
|
10
9
|
const RELATIVE_CURSOR_INFO_1 = require("../../../dates/relative/constants/RELATIVE_CURSOR_INFO");
|
|
11
10
|
const getI18nDateGroupLabel_1 = require("../../../globalization/helpers/getI18nDateGroupLabel");
|
|
12
11
|
const I18N_RELATIVE_CONTAINER_1 = require("../../../globalization/labels/filters/I18N_RELATIVE_CONTAINER");
|
|
12
|
+
const isRankingFilter_1 = require("../common/isRankingFilter");
|
|
13
13
|
/**
|
|
14
14
|
* Gets the UI Values generated depending on the validator
|
|
15
15
|
* @param filter the filter structure
|
|
@@ -82,8 +82,7 @@ function getUiInValues(values, settings) {
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
function getUiEqualValues(values, filter, settings) {
|
|
85
|
-
if (
|
|
86
|
-
(0, isEmpty_1.isEmpty)(filter.column.aggregate)) {
|
|
85
|
+
if ((0, isRankingFilter_1.isRankingFilter)(filter)) {
|
|
87
86
|
return getRankingUIValues(values, settings.addEnableds, settings.rankingGroupIndex);
|
|
88
87
|
}
|
|
89
88
|
return values.map((value) => getRegularValue(Object.assign(Object.assign({}, value), { value: getValueLabel(value.value, filter, settings) }), settings));
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.transformFilterValues = void 0;
|
|
4
4
|
const isEmpty_1 = require("../../../general/mix/isEmpty");
|
|
5
5
|
const transformValue_1 = require("../../../qrvey/helpers/transformValue");
|
|
6
|
+
const common_1 = require("../common");
|
|
6
7
|
const isRangeValidator_1 = require("../common/isRangeValidator");
|
|
7
8
|
const isRegularValidator_1 = require("../common/isRegularValidator");
|
|
8
9
|
function transformFilterValues(filter, settings) {
|
|
@@ -10,7 +11,7 @@ function transformFilterValues(filter, settings) {
|
|
|
10
11
|
if ((0, isEmpty_1.isEmpty)(filter))
|
|
11
12
|
return [];
|
|
12
13
|
const values = filter.values || [];
|
|
13
|
-
if ((0, isRegularValidator_1.isRegularValidator)(filter.validator)) {
|
|
14
|
+
if ((0, isRegularValidator_1.isRegularValidator)(filter.validator) && !(0, common_1.isRankingFilter)(filter)) {
|
|
14
15
|
return values.map((value) => (Object.assign(Object.assign({}, value), { value: (0, transformValue_1.transformValue)(value.value, transformValueSettings) })));
|
|
15
16
|
}
|
|
16
17
|
else if ((0, isRangeValidator_1.isRangeValidator)(filter.validator)) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isEmpty } from "../../general/mix/isEmpty";
|
|
2
|
-
import {
|
|
3
|
-
import { FILTER_VALIDATOR } from "../constants";
|
|
2
|
+
import { isRankingFilter } from "../helpers/common/isRankingFilter";
|
|
4
3
|
/**
|
|
5
4
|
* [TODO: For 2022, eliminate this adapter]
|
|
6
5
|
* Gets an adapted filter value array. Validates the enabled property and sets
|
|
@@ -9,10 +8,7 @@ import { FILTER_VALIDATOR } from "../constants";
|
|
|
9
8
|
*/
|
|
10
9
|
export function adaptFilterValues(filter) {
|
|
11
10
|
const setValue = (value) => (Object.assign(Object.assign({}, value), { value: isEmpty(value.value) ? undefined : value.value, displayed: isEmpty(value.displayed) ? true : value.displayed, enabled: isEmpty(value.enabled) ? true : value.enabled }));
|
|
12
|
-
if (filter
|
|
13
|
-
isEmpty(filter.column.aggregate) &&
|
|
14
|
-
filter.validator !== FILTER_VALIDATOR.IS_NULL &&
|
|
15
|
-
filter.validator !== FILTER_VALIDATOR.IS_NOT_NULL) {
|
|
11
|
+
if (isRankingFilter(filter)) {
|
|
16
12
|
return (filter.values || []).map((rValues) => rValues.map(setValue));
|
|
17
13
|
}
|
|
18
14
|
return ((filter.values || []) || []).map(setValue);
|
|
@@ -14,6 +14,7 @@ import { isNull } from "../../general/mix/isNull";
|
|
|
14
14
|
import { flattenDeep } from "../../general/array/flattenDeep";
|
|
15
15
|
import { getBackendGroupValue } from "../helpers/backend/getBackendGroupValue";
|
|
16
16
|
import { getBackendProperty } from "../helpers/backend/getBackendProperty";
|
|
17
|
+
import { isRankingFilter } from "../helpers/common/isRankingFilter";
|
|
17
18
|
/**
|
|
18
19
|
* Generates a Logic structure from flattened UI filters
|
|
19
20
|
* @param uFilters Array of flat filters from UI
|
|
@@ -109,7 +110,7 @@ export function getLogicBody(uFilters) {
|
|
|
109
110
|
}
|
|
110
111
|
function getExpressions(props) {
|
|
111
112
|
let expressions = [];
|
|
112
|
-
if (
|
|
113
|
+
if (isRankingFilter(props)) {
|
|
113
114
|
expressions = expressions.concat(getRankingExpressions(props));
|
|
114
115
|
}
|
|
115
116
|
else {
|
|
@@ -162,8 +163,7 @@ function getValues(props, rankingGroupIndex) {
|
|
|
162
163
|
switch (props.validator) {
|
|
163
164
|
case FILTER_VALIDATOR.EQUALS:
|
|
164
165
|
case FILTER_VALIDATOR.NOT_EQUAL:
|
|
165
|
-
if (props
|
|
166
|
-
isEmpty(props.column.aggregate))
|
|
166
|
+
if (isRankingFilter(props))
|
|
167
167
|
return getRankingValues(values, rankingGroupIndex);
|
|
168
168
|
return getResultValues(values, props);
|
|
169
169
|
case FILTER_VALIDATOR.CONTAINS:
|
|
@@ -247,8 +247,7 @@ function getUIValuess(props, rankingGroupIndex) {
|
|
|
247
247
|
? `from ${value.anchor || "current date"}`
|
|
248
248
|
: ""}`, displayed: value.displayed != null ? value.displayed : true, enabled: props.enabled })));
|
|
249
249
|
default:
|
|
250
|
-
if (props
|
|
251
|
-
isEmpty(props.column.aggregate)) {
|
|
250
|
+
if (isRankingFilter(props)) {
|
|
252
251
|
return getRankingUIValues(values, rankingGroupIndex);
|
|
253
252
|
}
|
|
254
253
|
return values.map((val) => (Object.assign(Object.assign({}, val), { enabled: val.enabled != null ? val.enabled : true })));
|
|
@@ -10,6 +10,7 @@ import { FILTER_SCOPE } from "../constants/common/FILTER_SCOPE";
|
|
|
10
10
|
import { _get } from "../../general/object/get";
|
|
11
11
|
import { isNullValidator } from "../helpers/common/isNullValidator";
|
|
12
12
|
import { FILTER_VALIDATOR_INFO } from "../constants/common/FILTER_VALIDATOR_INFO";
|
|
13
|
+
import { isRankingFilter } from "../helpers/common/isRankingFilter";
|
|
13
14
|
/**
|
|
14
15
|
* Adapts the Old logic structure (v2.0) to the flattened UI filter Structure.
|
|
15
16
|
* @param logics The old logic structure (v2.0)
|
|
@@ -46,8 +47,7 @@ function buildFilterByExpression(expression, scopeItem, uFilters) {
|
|
|
46
47
|
uFilter.filterid = getFilterid(uFilter);
|
|
47
48
|
uFilters.push(uFilter);
|
|
48
49
|
}
|
|
49
|
-
if (uiExtras
|
|
50
|
-
isEmpty(uiExtras.column.aggregate)) {
|
|
50
|
+
if (isRankingFilter(uiExtras)) {
|
|
51
51
|
// Restore uiExtras.values array into single IFilterDetail object values array
|
|
52
52
|
if (index > -1)
|
|
53
53
|
uFilters[index].values.push(uiExtras.values[0]);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { COLUMN } from "../../../columns/constants/COLUMN";
|
|
2
2
|
import { flattenDeep } from "../../../general/array/flattenDeep";
|
|
3
|
-
import { isEmpty } from "../../../general/mix/isEmpty";
|
|
4
3
|
import { FILTER_VALIDATOR } from "../../constants/common/FILTER_VALIDATOR";
|
|
5
4
|
import { FILTER_VALIDATOR_INFO } from "../../constants/common/FILTER_VALIDATOR_INFO";
|
|
5
|
+
import { isRankingFilter } from "../common/isRankingFilter";
|
|
6
6
|
/**
|
|
7
7
|
* Gets the expresion values in the logic format
|
|
8
8
|
* @param filter The filter structure
|
|
@@ -19,8 +19,7 @@ export function getBackendValues(filter) {
|
|
|
19
19
|
case FILTER_VALIDATOR.NOT_START_WITH:
|
|
20
20
|
case FILTER_VALIDATOR.ENDS_WITH:
|
|
21
21
|
case FILTER_VALIDATOR.NOT_END_WITH:
|
|
22
|
-
if (filter
|
|
23
|
-
isEmpty(filter.column.aggregate))
|
|
22
|
+
if (isRankingFilter(filter))
|
|
24
23
|
return getRankingValues(values);
|
|
25
24
|
return getResultValues(values, filter);
|
|
26
25
|
case FILTER_VALIDATOR.BETWEEN_INCLUSIVE:
|
|
@@ -21,6 +21,7 @@ export * from "./isDateDistinctProperty";
|
|
|
21
21
|
export * from "./isInValidator";
|
|
22
22
|
export * from "./isNullValidator";
|
|
23
23
|
export * from "./isRangeValidator";
|
|
24
|
+
export * from "./isRankingFilter";
|
|
24
25
|
export * from "./isRegularValidator";
|
|
25
26
|
export * from "./mergeFilters";
|
|
26
27
|
export * from "./mergeValues";
|
|
@@ -21,6 +21,7 @@ export * from "./isDateDistinctProperty";
|
|
|
21
21
|
export * from "./isInValidator";
|
|
22
22
|
export * from "./isNullValidator";
|
|
23
23
|
export * from "./isRangeValidator";
|
|
24
|
+
export * from "./isRankingFilter";
|
|
24
25
|
export * from "./isRegularValidator";
|
|
25
26
|
export * from "./mergeFilters";
|
|
26
27
|
export * from "./mergeValues";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IFSFilter } from "../../interfaces/common/IFSFilter";
|
|
2
|
+
import { IFUFilter } from "../../interfaces/ui/IFUFilter";
|
|
3
|
+
/**
|
|
4
|
+
* Validates if the given filter is considering a ranking filter type.
|
|
5
|
+
* - Filters with Null and Is Not Null for ranking column are not considering as Ranking Filters.
|
|
6
|
+
* @param filter The filter object
|
|
7
|
+
* @returns a true if the filter is a ranking filter.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isRankingFilter(filter: IFUFilter | IFSFilter): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { COLUMN } from "../../../columns/constants/COLUMN";
|
|
2
|
+
import { isEmpty } from "../../../general/mix/isEmpty";
|
|
3
|
+
import { FILTER_VALIDATOR } from "../../constants/common/FILTER_VALIDATOR";
|
|
4
|
+
/**
|
|
5
|
+
* Validates if the given filter is considering a ranking filter type.
|
|
6
|
+
* - Filters with Null and Is Not Null for ranking column are not considering as Ranking Filters.
|
|
7
|
+
* @param filter The filter object
|
|
8
|
+
* @returns a true if the filter is a ranking filter.
|
|
9
|
+
*/
|
|
10
|
+
export function isRankingFilter(filter) {
|
|
11
|
+
return (filter.column.type === COLUMN.RANKING &&
|
|
12
|
+
isEmpty(filter.column.aggregate) &&
|
|
13
|
+
filter.validator !== FILTER_VALIDATOR.IS_NULL &&
|
|
14
|
+
filter.validator !== FILTER_VALIDATOR.IS_NOT_NULL);
|
|
15
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { RELATIVE_CURSOR } from "../../../dates/relative/constants/RELATIVE_CURSOR";
|
|
2
2
|
import { FILTER_VALIDATOR } from "../../constants/common/FILTER_VALIDATOR";
|
|
3
3
|
import { FILTER_VALIDATOR_INFO } from "../../constants/common/FILTER_VALIDATOR_INFO";
|
|
4
|
-
import { COLUMN } from "../../../columns/constants/COLUMN";
|
|
5
4
|
import { isEmpty } from "../../../general/mix/isEmpty";
|
|
6
5
|
import { flattenDeep } from "../../../general/array/flattenDeep";
|
|
7
6
|
import { RELATIVE_CURSOR_INFO } from "../../../dates/relative/constants/RELATIVE_CURSOR_INFO";
|
|
8
7
|
import { getI18nDateGroupLabel } from "../../../globalization/helpers/getI18nDateGroupLabel";
|
|
9
8
|
import { I18N_RELATIVE_CONTAINER } from "../../../globalization/labels/filters/I18N_RELATIVE_CONTAINER";
|
|
9
|
+
import { isRankingFilter } from "../common/isRankingFilter";
|
|
10
10
|
/**
|
|
11
11
|
* Gets the UI Values generated depending on the validator
|
|
12
12
|
* @param filter the filter structure
|
|
@@ -78,8 +78,7 @@ function getUiInValues(values, settings) {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
function getUiEqualValues(values, filter, settings) {
|
|
81
|
-
if (filter
|
|
82
|
-
isEmpty(filter.column.aggregate)) {
|
|
81
|
+
if (isRankingFilter(filter)) {
|
|
83
82
|
return getRankingUIValues(values, settings.addEnableds, settings.rankingGroupIndex);
|
|
84
83
|
}
|
|
85
84
|
return values.map((value) => getRegularValue(Object.assign(Object.assign({}, value), { value: getValueLabel(value.value, filter, settings) }), settings));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isEmpty } from "../../../general/mix/isEmpty";
|
|
2
2
|
import { transformValue } from "../../../qrvey/helpers/transformValue";
|
|
3
|
+
import { isRankingFilter } from "../common";
|
|
3
4
|
import { isRangeValidator } from "../common/isRangeValidator";
|
|
4
5
|
import { isRegularValidator } from "../common/isRegularValidator";
|
|
5
6
|
export function transformFilterValues(filter, settings) {
|
|
@@ -7,7 +8,7 @@ export function transformFilterValues(filter, settings) {
|
|
|
7
8
|
if (isEmpty(filter))
|
|
8
9
|
return [];
|
|
9
10
|
const values = filter.values || [];
|
|
10
|
-
if (isRegularValidator(filter.validator)) {
|
|
11
|
+
if (isRegularValidator(filter.validator) && !isRankingFilter(filter)) {
|
|
11
12
|
return values.map((value) => (Object.assign(Object.assign({}, value), { value: transformValue(value.value, transformValueSettings) })));
|
|
12
13
|
}
|
|
13
14
|
else if (isRangeValidator(filter.validator)) {
|