@qrvey/utils 1.4.5 → 1.4.6
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/cjs/filters/helpers/common/excludeFiltersByParams.js +4 -3
- package/dist/cjs/filters/helpers/common/resolveScopeConditions.js +1 -1
- package/dist/filters/helpers/common/excludeFiltersByParams.js +4 -3
- package/dist/filters/helpers/common/resolveScopeConditions.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.excludeFiltersByParams = void 0;
|
|
4
4
|
const isEmpty_1 = require("../../../general/mix/isEmpty");
|
|
5
|
+
const cloneDeep_1 = require("../../../general/object/cloneDeep");
|
|
5
6
|
/**
|
|
6
7
|
* Excludes filters from the given Filters.
|
|
7
8
|
* The validation to filter the stored filter is depending on:
|
|
@@ -22,6 +23,7 @@ function excludeFiltersByParams(filterData, params) {
|
|
|
22
23
|
return;
|
|
23
24
|
if ((0, isEmpty_1.isEmpty)(params))
|
|
24
25
|
return filterData;
|
|
26
|
+
filterData = (0, cloneDeep_1.cloneDeep)(filterData);
|
|
25
27
|
filterData.scopes = filterData.scopes
|
|
26
28
|
.map((scope) => {
|
|
27
29
|
if (resolveScopeConditions(scope, params)) {
|
|
@@ -55,8 +57,7 @@ function excludeFiltersByParams(filterData, params) {
|
|
|
55
57
|
.filter((filter) => {
|
|
56
58
|
var _a;
|
|
57
59
|
return !(0, isEmpty_1.isEmpty)(filter) &&
|
|
58
|
-
filter.selectAll
|
|
59
|
-
((_a = filter.values) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
60
|
+
(filter.selectAll || ((_a = filter.values) === null || _a === void 0 ? void 0 : _a.length) > 0);
|
|
60
61
|
}) });
|
|
61
62
|
}
|
|
62
63
|
})
|
|
@@ -71,7 +72,7 @@ function resolveScopeConditions(scope, params) {
|
|
|
71
72
|
return ((params.enableds == null || params.enableds !== scope.enabled) &&
|
|
72
73
|
((0, isEmpty_1.isEmpty)(params.scope) || scope.scope !== params.scope) &&
|
|
73
74
|
((0, isEmpty_1.isEmpty)(params.scopeid) || scope.scopeid !== params.scopeid) &&
|
|
74
|
-
scope.datasets.
|
|
75
|
+
scope.datasets.length > 0);
|
|
75
76
|
}
|
|
76
77
|
function resolveDatasetConditions(dataset, params) {
|
|
77
78
|
return ((params.enableds == null || params.enableds !== dataset.enabled) &&
|
|
@@ -25,6 +25,6 @@ function resolveScopeConditions(scope, params, letPassUndefinedProperties = fals
|
|
|
25
25
|
(letPassUndefinedProperties && scope.scopeid == null) ||
|
|
26
26
|
(letPassUndefinedParams && (0, isEmpty_1.isEmpty)(params.scopeid)) ||
|
|
27
27
|
scope.scopeid === params.scopeid) &&
|
|
28
|
-
scope.datasets.
|
|
28
|
+
scope.datasets.length > 0);
|
|
29
29
|
}
|
|
30
30
|
exports.resolveScopeConditions = resolveScopeConditions;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isEmpty } from "../../../general/mix/isEmpty";
|
|
2
|
+
import { cloneDeep } from "../../../general/object/cloneDeep";
|
|
2
3
|
/**
|
|
3
4
|
* Excludes filters from the given Filters.
|
|
4
5
|
* The validation to filter the stored filter is depending on:
|
|
@@ -19,6 +20,7 @@ export function excludeFiltersByParams(filterData, params) {
|
|
|
19
20
|
return;
|
|
20
21
|
if (isEmpty(params))
|
|
21
22
|
return filterData;
|
|
23
|
+
filterData = cloneDeep(filterData);
|
|
22
24
|
filterData.scopes = filterData.scopes
|
|
23
25
|
.map((scope) => {
|
|
24
26
|
if (resolveScopeConditions(scope, params)) {
|
|
@@ -52,8 +54,7 @@ export function excludeFiltersByParams(filterData, params) {
|
|
|
52
54
|
.filter((filter) => {
|
|
53
55
|
var _a;
|
|
54
56
|
return !isEmpty(filter) &&
|
|
55
|
-
filter.selectAll
|
|
56
|
-
((_a = filter.values) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
57
|
+
(filter.selectAll || ((_a = filter.values) === null || _a === void 0 ? void 0 : _a.length) > 0);
|
|
57
58
|
}) });
|
|
58
59
|
}
|
|
59
60
|
})
|
|
@@ -67,7 +68,7 @@ function resolveScopeConditions(scope, params) {
|
|
|
67
68
|
return ((params.enableds == null || params.enableds !== scope.enabled) &&
|
|
68
69
|
(isEmpty(params.scope) || scope.scope !== params.scope) &&
|
|
69
70
|
(isEmpty(params.scopeid) || scope.scopeid !== params.scopeid) &&
|
|
70
|
-
scope.datasets.
|
|
71
|
+
scope.datasets.length > 0);
|
|
71
72
|
}
|
|
72
73
|
function resolveDatasetConditions(dataset, params) {
|
|
73
74
|
return ((params.enableds == null || params.enableds !== dataset.enabled) &&
|
|
@@ -22,5 +22,5 @@ export function resolveScopeConditions(scope, params, letPassUndefinedProperties
|
|
|
22
22
|
(letPassUndefinedProperties && scope.scopeid == null) ||
|
|
23
23
|
(letPassUndefinedParams && isEmpty(params.scopeid)) ||
|
|
24
24
|
scope.scopeid === params.scopeid) &&
|
|
25
|
-
scope.datasets.
|
|
25
|
+
scope.datasets.length > 0);
|
|
26
26
|
}
|