@qrvey/filters 0.0.45 → 0.1.0
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 +63 -1
- package/dist/cjs/classes/FilterAdapter.js +1 -80
- package/dist/cjs/classes/FilterBuilder.js +32 -251
- package/dist/cjs/classes/FilterManager.js +7 -64
- package/dist/cjs/classes/FilterResources.js +3 -116
- package/dist/cjs/classes/FilterSearcher.js +0 -77
- package/dist/cjs/classes/FilterValidation.js +0 -93
- package/dist/cjs/classes/FilterValues.js +0 -24
- package/dist/cjs/classes/index.js +8 -21
- package/dist/cjs/helpers/filter-adapt.helpers.js +3 -46
- package/dist/cjs/helpers/filter-adapt.legacy.helpers.js +6 -53
- package/dist/cjs/helpers/filter-adapt.logic.helpers.js +7 -128
- package/dist/cjs/helpers/filter-builder.helpers.js +1 -8
- package/dist/cjs/helpers/filter-settings.helpers.js +6 -41
- package/dist/cjs/helpers/filter-validators.helpers.js +15 -9
- package/dist/cjs/helpers/filter-verbose.helpers.js +211 -0
- package/dist/cjs/helpers/getAggregateFilters.js +11 -0
- package/dist/cjs/helpers/getFilterId.js +1 -17
- package/dist/cjs/helpers/getFilterType.js +1 -8
- package/dist/cjs/helpers/index.js +12 -20
- package/dist/cjs/helpers/isDateDistinctGrouping.js +15 -0
- package/dist/cjs/helpers/isRankingFilter.js +10 -0
- package/dist/cjs/helpers/resolveFilterConditions.js +2 -10
- package/dist/cjs/helpers/utils.helpers.js +2 -19
- package/dist/cjs/index.js +5 -18
- package/dist/cjs/models/index.js +4 -17
- package/dist/cjs/resources/filter-grouping.resources.js +0 -18
- package/dist/cjs/resources/filter-logic.resources.js +0 -3
- package/dist/cjs/resources/filter-scopes.resources.js +10 -27
- package/dist/cjs/resources/filter-validators.resources.js +0 -3
- package/dist/cjs/resources/filter-verbose.resources.js +13 -0
- package/dist/cjs/resources/filters.resources.js +0 -12
- package/dist/cjs/resources/index.js +12 -24
- package/dist/classes/FilterAdapter.d.ts +0 -80
- package/dist/classes/FilterAdapter.js +1 -80
- package/dist/classes/FilterBuilder.d.ts +2 -177
- package/dist/classes/FilterBuilder.js +32 -251
- package/dist/classes/FilterManager.d.ts +7 -62
- package/dist/classes/FilterManager.js +7 -64
- package/dist/classes/FilterResources.d.ts +1 -115
- package/dist/classes/FilterResources.js +3 -116
- package/dist/classes/FilterSearcher.d.ts +2 -77
- package/dist/classes/FilterSearcher.js +0 -77
- package/dist/classes/FilterValidation.d.ts +1 -47
- package/dist/classes/FilterValidation.js +0 -93
- package/dist/classes/FilterValues.d.ts +0 -25
- package/dist/classes/FilterValues.js +0 -24
- package/dist/classes/index.d.ts +0 -1
- package/dist/helpers/filter-adapt.helpers.d.ts +0 -15
- package/dist/helpers/filter-adapt.helpers.js +1 -43
- package/dist/helpers/filter-adapt.legacy.helpers.d.ts +0 -20
- package/dist/helpers/filter-adapt.legacy.helpers.js +3 -49
- package/dist/helpers/filter-adapt.logic.helpers.d.ts +0 -22
- package/dist/helpers/filter-adapt.logic.helpers.js +3 -123
- package/dist/helpers/filter-builder.helpers.d.ts +0 -7
- package/dist/helpers/filter-builder.helpers.js +0 -6
- package/dist/helpers/filter-settings.helpers.d.ts +0 -35
- package/dist/helpers/filter-settings.helpers.js +0 -34
- package/dist/helpers/filter-validators.helpers.d.ts +3 -6
- package/dist/helpers/filter-validators.helpers.js +11 -7
- package/dist/helpers/filter-verbose.helpers.d.ts +6 -0
- package/dist/helpers/filter-verbose.helpers.js +206 -0
- package/dist/helpers/getAggregateFilters.d.ts +3 -0
- package/dist/helpers/getAggregateFilters.js +7 -0
- package/dist/helpers/getFilterId.d.ts +0 -16
- package/dist/helpers/getFilterId.js +0 -15
- package/dist/helpers/getFilterType.d.ts +0 -7
- package/dist/helpers/getFilterType.js +0 -6
- package/dist/helpers/index.d.ts +5 -1
- package/dist/helpers/index.js +5 -0
- package/dist/helpers/isDateDistinctGrouping.d.ts +2 -0
- package/dist/helpers/isDateDistinctGrouping.js +12 -0
- package/dist/helpers/isRankingFilter.d.ts +2 -0
- package/dist/helpers/isRankingFilter.js +7 -0
- package/dist/helpers/resolveFilterConditions.d.ts +0 -8
- package/dist/helpers/resolveFilterConditions.js +1 -8
- package/dist/helpers/utils.helpers.d.ts +0 -17
- package/dist/helpers/utils.helpers.js +0 -16
- package/dist/index.d.ts +0 -1
- package/dist/models/filter-builder.models.d.ts +0 -156
- package/dist/models/filter-resources.models.d.ts +0 -53
- package/dist/models/filter-searcher.models.d.ts +5 -34
- package/dist/models/filter-validation.models.d.ts +0 -40
- package/dist/models/index.d.ts +0 -1
- package/dist/resources/filter-functions.resources.d.ts +0 -49
- package/dist/resources/filter-grouping.resources.d.ts +0 -7
- package/dist/resources/filter-grouping.resources.js +0 -18
- package/dist/resources/filter-logic.resources.d.ts +0 -79
- package/dist/resources/filter-logic.resources.js +0 -3
- package/dist/resources/filter-operators.resources.d.ts +0 -1
- package/dist/resources/filter-panel.interfaces.d.ts +0 -49
- package/dist/resources/filter-scopes.resources.d.ts +2 -25
- package/dist/resources/filter-scopes.resources.js +10 -27
- package/dist/resources/filter-validation.resources.d.ts +0 -1
- package/dist/resources/filter-validators.resources.d.ts +0 -1
- package/dist/resources/filter-validators.resources.js +0 -3
- package/dist/resources/filter-values.resources.d.ts +0 -13
- package/dist/resources/filter-verbose.resources.d.ts +23 -0
- package/dist/resources/filter-verbose.resources.js +10 -0
- package/dist/resources/filter-visual.resources.d.ts +0 -50
- package/dist/resources/filters.resources.d.ts +1 -102
- package/dist/resources/filters.resources.js +0 -12
- package/dist/resources/index.d.ts +1 -1
- package/dist/resources/index.js +1 -0
- package/package.json +59 -44
- package/.eslintignore +0 -6
- package/.eslintrc.json +0 -122
- package/.husky/pre-commit +0 -4
- package/.lintstagedrc +0 -7
- package/.prettierignore +0 -6
- package/.prettierrc.json +0 -1
- package/CHANGELOG.md +0 -274
- package/CODE_OF_CONDUCT.md +0 -132
- package/bitbucket-pipelines.yml +0 -92
- package/dist/cjs/classes/FilterAdapter.d.ts +0 -107
- package/dist/cjs/classes/FilterAdapter.d.ts.map +0 -1
- package/dist/cjs/classes/FilterBuilder.d.ts +0 -206
- package/dist/cjs/classes/FilterBuilder.d.ts.map +0 -1
- package/dist/cjs/classes/FilterManager.d.ts +0 -84
- package/dist/cjs/classes/FilterManager.d.ts.map +0 -1
- package/dist/cjs/classes/FilterResources.d.ts +0 -139
- package/dist/cjs/classes/FilterResources.d.ts.map +0 -1
- package/dist/cjs/classes/FilterSearcher.d.ts +0 -90
- package/dist/cjs/classes/FilterSearcher.d.ts.map +0 -1
- package/dist/cjs/classes/FilterValidation.d.ts +0 -58
- package/dist/cjs/classes/FilterValidation.d.ts.map +0 -1
- package/dist/cjs/classes/FilterValues.d.ts +0 -33
- package/dist/cjs/classes/FilterValues.d.ts.map +0 -1
- package/dist/cjs/classes/index.d.ts +0 -8
- package/dist/cjs/classes/index.d.ts.map +0 -1
- package/dist/cjs/helpers/filter-adapt.helpers.d.ts +0 -21
- package/dist/cjs/helpers/filter-adapt.helpers.d.ts.map +0 -1
- package/dist/cjs/helpers/filter-adapt.legacy.helpers.d.ts +0 -26
- package/dist/cjs/helpers/filter-adapt.legacy.helpers.d.ts.map +0 -1
- package/dist/cjs/helpers/filter-adapt.logic.helpers.d.ts +0 -29
- package/dist/cjs/helpers/filter-adapt.logic.helpers.d.ts.map +0 -1
- package/dist/cjs/helpers/filter-builder.helpers.d.ts +0 -11
- package/dist/cjs/helpers/filter-builder.helpers.d.ts.map +0 -1
- package/dist/cjs/helpers/filter-settings.helpers.d.ts +0 -42
- package/dist/cjs/helpers/filter-settings.helpers.d.ts.map +0 -1
- package/dist/cjs/helpers/filter-validators.helpers.d.ts +0 -8
- package/dist/cjs/helpers/filter-validators.helpers.d.ts.map +0 -1
- package/dist/cjs/helpers/getFilterId.d.ts +0 -18
- package/dist/cjs/helpers/getFilterId.d.ts.map +0 -1
- package/dist/cjs/helpers/getFilterType.d.ts +0 -11
- package/dist/cjs/helpers/getFilterType.d.ts.map +0 -1
- package/dist/cjs/helpers/index.d.ts +0 -7
- package/dist/cjs/helpers/index.d.ts.map +0 -1
- package/dist/cjs/helpers/resolveFilterConditions.d.ts +0 -11
- package/dist/cjs/helpers/resolveFilterConditions.d.ts.map +0 -1
- package/dist/cjs/helpers/utils.helpers.d.ts +0 -26
- package/dist/cjs/helpers/utils.helpers.d.ts.map +0 -1
- package/dist/cjs/index.d.ts +0 -5
- package/dist/cjs/index.d.ts.map +0 -1
- package/dist/cjs/models/filter-builder.models.d.ts +0 -203
- package/dist/cjs/models/filter-builder.models.d.ts.map +0 -1
- package/dist/cjs/models/filter-resources.models.d.ts +0 -71
- package/dist/cjs/models/filter-resources.models.d.ts.map +0 -1
- package/dist/cjs/models/filter-searcher.models.d.ts +0 -42
- package/dist/cjs/models/filter-searcher.models.d.ts.map +0 -1
- package/dist/cjs/models/filter-validation.models.d.ts +0 -59
- package/dist/cjs/models/filter-validation.models.d.ts.map +0 -1
- package/dist/cjs/models/index.d.ts +0 -4
- package/dist/cjs/models/index.d.ts.map +0 -1
- package/dist/cjs/resources/filter-functions.resources.d.ts +0 -94
- package/dist/cjs/resources/filter-functions.resources.d.ts.map +0 -1
- package/dist/cjs/resources/filter-grouping.resources.d.ts +0 -103
- package/dist/cjs/resources/filter-grouping.resources.d.ts.map +0 -1
- package/dist/cjs/resources/filter-logic.resources.d.ts +0 -135
- package/dist/cjs/resources/filter-logic.resources.d.ts.map +0 -1
- package/dist/cjs/resources/filter-operators.resources.d.ts +0 -16
- package/dist/cjs/resources/filter-operators.resources.d.ts.map +0 -1
- package/dist/cjs/resources/filter-panel.interfaces.d.ts +0 -80
- package/dist/cjs/resources/filter-panel.interfaces.d.ts.map +0 -1
- package/dist/cjs/resources/filter-scopes.resources.d.ts +0 -62
- package/dist/cjs/resources/filter-scopes.resources.d.ts.map +0 -1
- package/dist/cjs/resources/filter-validation.resources.d.ts +0 -20
- package/dist/cjs/resources/filter-validation.resources.d.ts.map +0 -1
- package/dist/cjs/resources/filter-validators.resources.d.ts +0 -80
- package/dist/cjs/resources/filter-validators.resources.d.ts.map +0 -1
- package/dist/cjs/resources/filter-values.resources.d.ts +0 -40
- package/dist/cjs/resources/filter-values.resources.d.ts.map +0 -1
- package/dist/cjs/resources/filter-visual.resources.d.ts +0 -77
- package/dist/cjs/resources/filter-visual.resources.d.ts.map +0 -1
- package/dist/cjs/resources/filters.resources.d.ts +0 -168
- package/dist/cjs/resources/filters.resources.d.ts.map +0 -1
- package/dist/cjs/resources/index.d.ts +0 -11
- package/dist/cjs/resources/index.d.ts.map +0 -1
- package/dist/classes/FilterAdapter.d.ts.map +0 -1
- package/dist/classes/FilterBuilder.d.ts.map +0 -1
- package/dist/classes/FilterManager.d.ts.map +0 -1
- package/dist/classes/FilterResources.d.ts.map +0 -1
- package/dist/classes/FilterSearcher.d.ts.map +0 -1
- package/dist/classes/FilterValidation.d.ts.map +0 -1
- package/dist/classes/FilterValues.d.ts.map +0 -1
- package/dist/classes/index.d.ts.map +0 -1
- package/dist/helpers/filter-adapt.helpers.d.ts.map +0 -1
- package/dist/helpers/filter-adapt.legacy.helpers.d.ts.map +0 -1
- package/dist/helpers/filter-adapt.logic.helpers.d.ts.map +0 -1
- package/dist/helpers/filter-builder.helpers.d.ts.map +0 -1
- package/dist/helpers/filter-settings.helpers.d.ts.map +0 -1
- package/dist/helpers/filter-validators.helpers.d.ts.map +0 -1
- package/dist/helpers/getFilterId.d.ts.map +0 -1
- package/dist/helpers/getFilterType.d.ts.map +0 -1
- package/dist/helpers/index.d.ts.map +0 -1
- package/dist/helpers/resolveFilterConditions.d.ts.map +0 -1
- package/dist/helpers/utils.helpers.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/models/filter-builder.models.d.ts.map +0 -1
- package/dist/models/filter-resources.models.d.ts.map +0 -1
- package/dist/models/filter-searcher.models.d.ts.map +0 -1
- package/dist/models/filter-validation.models.d.ts.map +0 -1
- package/dist/models/index.d.ts.map +0 -1
- package/dist/resources/filter-functions.resources.d.ts.map +0 -1
- package/dist/resources/filter-grouping.resources.d.ts.map +0 -1
- package/dist/resources/filter-logic.resources.d.ts.map +0 -1
- package/dist/resources/filter-operators.resources.d.ts.map +0 -1
- package/dist/resources/filter-panel.interfaces.d.ts.map +0 -1
- package/dist/resources/filter-scopes.resources.d.ts.map +0 -1
- package/dist/resources/filter-validation.resources.d.ts.map +0 -1
- package/dist/resources/filter-validators.resources.d.ts.map +0 -1
- package/dist/resources/filter-values.resources.d.ts.map +0 -1
- package/dist/resources/filter-visual.resources.d.ts.map +0 -1
- package/dist/resources/filters.resources.d.ts.map +0 -1
- package/dist/resources/index.d.ts.map +0 -1
- package/jest.config.js +0 -10
- package/jsdoc.config.json +0 -14
- package/scripts/clean-build/index.js +0 -62
- package/sonar-project.properties +0 -2
- package/src/classes/FilterAdapter.ts +0 -208
- package/src/classes/FilterBuilder.ts +0 -822
- package/src/classes/FilterManager.ts +0 -126
- package/src/classes/FilterResources.ts +0 -411
- package/src/classes/FilterSearcher.ts +0 -243
- package/src/classes/FilterValidation.ts +0 -221
- package/src/classes/FilterValues.ts +0 -89
- package/src/classes/index.ts +0 -7
- package/src/helpers/filter-adapt.helpers.ts +0 -204
- package/src/helpers/filter-adapt.legacy.helpers.ts +0 -298
- package/src/helpers/filter-adapt.logic.helpers.ts +0 -631
- package/src/helpers/filter-builder.helpers.ts +0 -28
- package/src/helpers/filter-settings.helpers.ts +0 -133
- package/src/helpers/filter-validators.helpers.ts +0 -15
- package/src/helpers/getFilterId.ts +0 -35
- package/src/helpers/getFilterType.ts +0 -23
- package/src/helpers/index.ts +0 -6
- package/src/helpers/resolveFilterConditions.ts +0 -29
- package/src/helpers/utils.helpers.ts +0 -37
- package/src/index.ts +0 -4
- package/src/models/filter-builder.models.ts +0 -256
- package/src/models/filter-resources.models.ts +0 -89
- package/src/models/filter-searcher.models.ts +0 -61
- package/src/models/filter-validation.models.ts +0 -71
- package/src/models/index.ts +0 -3
- package/src/resources/filter-functions.resources.ts +0 -132
- package/src/resources/filter-grouping.resources.ts +0 -531
- package/src/resources/filter-logic.resources.ts +0 -148
- package/src/resources/filter-operators.resources.ts +0 -40
- package/src/resources/filter-panel.interfaces.ts +0 -86
- package/src/resources/filter-scopes.resources.ts +0 -152
- package/src/resources/filter-validation.resources.ts +0 -90
- package/src/resources/filter-validators.resources.ts +0 -411
- package/src/resources/filter-values.resources.ts +0 -57
- package/src/resources/filter-visual.resources.ts +0 -86
- package/src/resources/filters.resources.ts +0 -232
- package/src/resources/index.ts +0 -10
- package/tests/classes/FilterAdapter.test.ts +0 -124
- package/tests/classes/FilterBuilder.test.ts +0 -903
- package/tests/classes/FilterResources.test.ts +0 -267
- package/tests/classes/FilterSearcher.test.ts +0 -188
- package/tests/classes/FilterValidation.test.ts +0 -54
- package/tests/helpers/getFilterId.test.ts +0 -121
- package/tests/mock/datasets.mock.ts +0 -61
- package/tests/mock/filters-adapter.mock.ts +0 -646
- package/tests/mock/filters-interactive-table.mock.ts +0 -59
- package/tests/mock/filters.mock.ts +0 -277
- package/tsconfig.doc.json +0 -4
- package/tsconfig.eslint.json +0 -4
- package/tsconfig.json +0 -113
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.filterToVisual = filterToVisual;
|
|
4
|
+
exports.legacyVisualToInteractiveTable = legacyVisualToInteractiveTable;
|
|
4
5
|
const utils_1 = require("@qrvey/utils");
|
|
5
6
|
const utils_helpers_1 = require("./utils.helpers");
|
|
6
7
|
const filter_visual_resources_1 = require("../resources/filter-visual.resources");
|
|
7
8
|
const filters_resources_1 = require("../resources/filters.resources");
|
|
8
|
-
/**
|
|
9
|
-
* Generates a visual filter structure from the filter collection.
|
|
10
|
-
* @param filters Array of filters
|
|
11
|
-
* @param datasets Array of the dataset info
|
|
12
|
-
* @param interactiveTable table of interaction properties for each section
|
|
13
|
-
* @returns a Filter Data structure
|
|
14
|
-
*/
|
|
15
9
|
function filterToVisual(filters, datasets = [], interactiveTable) {
|
|
16
10
|
if ((0, utils_1.isEmpty)(filters) || !Array.isArray(filters))
|
|
17
11
|
return;
|
|
@@ -19,14 +13,6 @@ function filterToVisual(filters, datasets = [], interactiveTable) {
|
|
|
19
13
|
scopes: buildScopes(filters, datasets, interactiveTable),
|
|
20
14
|
};
|
|
21
15
|
}
|
|
22
|
-
exports.filterToVisual = filterToVisual;
|
|
23
|
-
/**
|
|
24
|
-
* Gets the Interactive Table object from the visual filters
|
|
25
|
-
* If an interactive table object is given, it will be merged with the new one
|
|
26
|
-
* @param visual the visual filters
|
|
27
|
-
* @param interactiveTable the interactive table object
|
|
28
|
-
* @returns the interactive table object
|
|
29
|
-
*/
|
|
30
16
|
function legacyVisualToInteractiveTable(visual, interactiveTable) {
|
|
31
17
|
if ((0, utils_1.isEmpty)(visual) || (0, utils_1.isEmpty)(visual?.scopes))
|
|
32
18
|
return;
|
|
@@ -58,17 +44,7 @@ function legacyVisualToInteractiveTable(visual, interactiveTable) {
|
|
|
58
44
|
delete newInteractiveTable.interactDatasets;
|
|
59
45
|
return newInteractiveTable;
|
|
60
46
|
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Gets a collection of scopes for the visual filter data.
|
|
64
|
-
* The scopes are organized by scope types and IDs
|
|
65
|
-
* Also, adds and organizes filters by datasets
|
|
66
|
-
* @param filters Collection of filters
|
|
67
|
-
* @param datasets Array of the dataset info
|
|
68
|
-
* @param interactiveTable table of interaction properties for each section
|
|
69
|
-
* @returns an array of visual scopes.
|
|
70
|
-
*/
|
|
71
|
-
function buildScopes(filters = [], datasets = [], interactiveTable) {
|
|
47
|
+
function buildScopes(filters, datasets, interactiveTable) {
|
|
72
48
|
return filters.reduce((scopes, filter) => {
|
|
73
49
|
const datasetInfo = (0, utils_helpers_1.getDatasetInfo)({ columnId: filter.columnId, datasetId: filter.datasetId }, datasets);
|
|
74
50
|
const uiFilter = buildFilter(filter, datasetInfo);
|
|
@@ -93,12 +69,6 @@ function buildScopes(filters = [], datasets = [], interactiveTable) {
|
|
|
93
69
|
return scopes;
|
|
94
70
|
}, []);
|
|
95
71
|
}
|
|
96
|
-
/**
|
|
97
|
-
* Gets an scope structure for the filter data
|
|
98
|
-
* @param filter the filter
|
|
99
|
-
* @param interactiveTable table of interaction properties for each section
|
|
100
|
-
* @returns the visual scope structure
|
|
101
|
-
*/
|
|
102
72
|
function buildScope(filter, interactiveTable) {
|
|
103
73
|
const { collapsed } = interactiveTable?.interactScopes?.find((interactive) => interactive.scope === filter.scope &&
|
|
104
74
|
interactive.scopeId === filter.scopeId) ?? {};
|
|
@@ -109,13 +79,6 @@ function buildScope(filter, interactiveTable) {
|
|
|
109
79
|
id: filter.scopeId,
|
|
110
80
|
};
|
|
111
81
|
}
|
|
112
|
-
/**
|
|
113
|
-
* Gets an dataset structure for the visual filter
|
|
114
|
-
* @param filter the filter
|
|
115
|
-
* @param dataset the dataset info
|
|
116
|
-
* @param interactiveTable table of interaction properties for each section
|
|
117
|
-
* @returns an dataset structure
|
|
118
|
-
*/
|
|
119
82
|
function buildDataset(filter, dataset, interactiveTable) {
|
|
120
83
|
const { collapsed } = interactiveTable?.interactDatasets?.find((interactive) => interactive.datasetId === filter.datasetId) ?? {};
|
|
121
84
|
return {
|
|
@@ -125,12 +88,6 @@ function buildDataset(filter, dataset, interactiveTable) {
|
|
|
125
88
|
filters: [],
|
|
126
89
|
};
|
|
127
90
|
}
|
|
128
|
-
/**
|
|
129
|
-
* Gets an filter structure for the visual filter
|
|
130
|
-
* @param filter a UI structure filter
|
|
131
|
-
* @param dataset the dataset info
|
|
132
|
-
* @returns an filter structure
|
|
133
|
-
*/
|
|
134
91
|
function buildFilter(filter, dataset) {
|
|
135
92
|
const columnInfo = dataset == null
|
|
136
93
|
? undefined
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.filterToLegacyVisual = filterToLegacyVisual;
|
|
4
|
+
exports.legacyVisualToFilter = legacyVisualToFilter;
|
|
5
|
+
exports.legacyVisualToInteractiveTable = legacyVisualToInteractiveTable;
|
|
4
6
|
const utils_1 = require("@qrvey/utils");
|
|
5
7
|
const utils_helpers_1 = require("./utils.helpers");
|
|
6
8
|
const FilterBuilder_1 = require("../classes/FilterBuilder");
|
|
7
|
-
/**
|
|
8
|
-
* Generates a legacy visual filter structure from the filter collection.
|
|
9
|
-
* @param filters Array of filters
|
|
10
|
-
* @param datasets Array of the dataset info
|
|
11
|
-
* @param interactiveTable table of interaction properties for each section
|
|
12
|
-
* @returns a Filter Data structure
|
|
13
|
-
*/
|
|
14
9
|
function filterToLegacyVisual(filters, datasets = [], interactiveTable) {
|
|
15
10
|
if ((0, utils_1.isEmpty)(filters))
|
|
16
11
|
return;
|
|
@@ -21,12 +16,6 @@ function filterToLegacyVisual(filters, datasets = [], interactiveTable) {
|
|
|
21
16
|
scopes: buildLegacyScopes(filters, datasets, interactiveTable),
|
|
22
17
|
};
|
|
23
18
|
}
|
|
24
|
-
exports.filterToLegacyVisual = filterToLegacyVisual;
|
|
25
|
-
/**
|
|
26
|
-
* Generates a legacy visual filter structure from the filter collection.
|
|
27
|
-
* @param filterData the legacy filter
|
|
28
|
-
* @returns a Filter collection
|
|
29
|
-
*/
|
|
30
19
|
function legacyVisualToFilter(filterData) {
|
|
31
20
|
if ((0, utils_1.isEmpty)(filterData) || (0, utils_1.isEmpty)(filterData?.scopes))
|
|
32
21
|
return [];
|
|
@@ -68,14 +57,6 @@ function legacyVisualToFilter(filterData) {
|
|
|
68
57
|
});
|
|
69
58
|
return filters;
|
|
70
59
|
}
|
|
71
|
-
exports.legacyVisualToFilter = legacyVisualToFilter;
|
|
72
|
-
/**
|
|
73
|
-
* Gets the Interactive Table object from the legacy visual filters
|
|
74
|
-
* If an interactive table object is given, it will be merged with the new one
|
|
75
|
-
* @param legacyVisual the legacy visual filters
|
|
76
|
-
* @param interactiveTable the interactive table object
|
|
77
|
-
* @returns the interactive table object
|
|
78
|
-
*/
|
|
79
60
|
function legacyVisualToInteractiveTable(legacyVisual, interactiveTable) {
|
|
80
61
|
if ((0, utils_1.isEmpty)(legacyVisual) || (0, utils_1.isEmpty)(legacyVisual?.scopes))
|
|
81
62
|
return;
|
|
@@ -107,17 +88,7 @@ function legacyVisualToInteractiveTable(legacyVisual, interactiveTable) {
|
|
|
107
88
|
delete newInteractiveTable.interactDatasets;
|
|
108
89
|
return newInteractiveTable;
|
|
109
90
|
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Gets a collection of legacy scopes for the legacy visual filters.
|
|
113
|
-
* The scopes are organized by scope types and IDs
|
|
114
|
-
* Also, adds and organizes filters by datasets
|
|
115
|
-
* @param filters Collection of filters
|
|
116
|
-
* @param datasets Array of the dataset info
|
|
117
|
-
* @param interactiveTable table of interaction properties for each section
|
|
118
|
-
* @returns an array of visual scopes.
|
|
119
|
-
*/
|
|
120
|
-
function buildLegacyScopes(filters = [], datasets = [], interactiveTable) {
|
|
91
|
+
function buildLegacyScopes(filters, datasets, interactiveTable) {
|
|
121
92
|
return filters.reduce((scopes, filter) => {
|
|
122
93
|
const datasetInfo = (0, utils_helpers_1.getDatasetInfo)({ columnId: filter.columnId, datasetId: filter.datasetId }, datasets);
|
|
123
94
|
const uiFilter = buildLegacyFilter(filter, datasetInfo);
|
|
@@ -142,12 +113,6 @@ function buildLegacyScopes(filters = [], datasets = [], interactiveTable) {
|
|
|
142
113
|
return scopes;
|
|
143
114
|
}, []);
|
|
144
115
|
}
|
|
145
|
-
/**
|
|
146
|
-
* Gets an legacy scope structure for the legacy filter data
|
|
147
|
-
* @param filter the filter
|
|
148
|
-
* @param interactiveTable table of interaction properties for each section
|
|
149
|
-
* @returns the legacy visual scope structure
|
|
150
|
-
*/
|
|
151
116
|
function buildLegacyScope(filter, interactiveTable) {
|
|
152
117
|
const { collapsed } = interactiveTable?.interactScopes?.find((interactive) => interactive.scope === filter.scope &&
|
|
153
118
|
interactive.scopeId === filter.scopeId) ?? {};
|
|
@@ -160,13 +125,6 @@ function buildLegacyScope(filter, interactiveTable) {
|
|
|
160
125
|
scopeid: filter.scopeId,
|
|
161
126
|
};
|
|
162
127
|
}
|
|
163
|
-
/**
|
|
164
|
-
* Gets an legacy dataset structure for the legacy visual filter
|
|
165
|
-
* @param filter the filter
|
|
166
|
-
* @param dataset the dataset info
|
|
167
|
-
* @param interactiveTable table of interaction properties for each section
|
|
168
|
-
* @returns an legacy dataset structure
|
|
169
|
-
*/
|
|
170
128
|
function buildLegacyDataset(filter, dataset, interactiveTable) {
|
|
171
129
|
const { collapsed } = interactiveTable?.interactDatasets?.find((interactive) => interactive.datasetId === filter.datasetId &&
|
|
172
130
|
interactive.scope === filter.scope &&
|
|
@@ -180,22 +138,17 @@ function buildLegacyDataset(filter, dataset, interactiveTable) {
|
|
|
180
138
|
filters: [],
|
|
181
139
|
};
|
|
182
140
|
}
|
|
183
|
-
/**
|
|
184
|
-
* Gets an legacy filter structure for the legacy visual filter
|
|
185
|
-
* @param filter a UI structure filter
|
|
186
|
-
* @param dataset the dataset info
|
|
187
|
-
* @returns an legacy filter structure
|
|
188
|
-
*/
|
|
189
141
|
function buildLegacyFilter(filter, dataset) {
|
|
190
142
|
const columnInfo = dataset == null
|
|
191
143
|
? undefined
|
|
192
144
|
: (0, utils_helpers_1.getColumnInfo)({ columnId: filter.columnId, datasetId: filter.datasetId }, [dataset]);
|
|
145
|
+
const columnLabel = columnInfo?.label ?? "";
|
|
193
146
|
return {
|
|
194
147
|
collapsed: filter.collapsed ?? false,
|
|
195
148
|
column: {
|
|
196
149
|
id: filter.columnId,
|
|
197
150
|
formulaType: columnInfo?.formulaType,
|
|
198
|
-
label:
|
|
151
|
+
label: columnLabel,
|
|
199
152
|
qrveyid: filter.datasetId,
|
|
200
153
|
aggregate: filter.aggregateType,
|
|
201
154
|
type: filter.columnType,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.filterToLogic = filterToLogic;
|
|
4
|
+
exports.visualToLogic = visualToLogic;
|
|
5
|
+
exports.buildLogicExpression = buildLogicExpression;
|
|
6
|
+
exports.getFilterLogicValues = getFilterLogicValues;
|
|
4
7
|
const utils_1 = require("@qrvey/utils");
|
|
5
8
|
const filter_adapt_helpers_1 = require("./filter-adapt.helpers");
|
|
6
9
|
const filter_validators_helpers_1 = require("./filter-validators.helpers");
|
|
@@ -10,23 +13,12 @@ const filter_logic_resources_1 = require("../resources/filter-logic.resources");
|
|
|
10
13
|
const filter_operators_resources_1 = require("../resources/filter-operators.resources");
|
|
11
14
|
const filter_validators_resources_1 = require("../resources/filter-validators.resources");
|
|
12
15
|
const filters_resources_1 = require("../resources/filters.resources");
|
|
13
|
-
/**
|
|
14
|
-
* Generates a Logic structure from the filter collection
|
|
15
|
-
* @param filters the filter collection
|
|
16
|
-
* @returns the logic structure
|
|
17
|
-
*/
|
|
18
16
|
function filterToLogic(filters) {
|
|
19
17
|
if ((0, utils_1.isEmpty)(filters))
|
|
20
18
|
return [];
|
|
21
19
|
const visual = (0, filter_adapt_helpers_1.filterToVisual)(filters);
|
|
22
20
|
return visualToLogic(visual);
|
|
23
21
|
}
|
|
24
|
-
exports.filterToLogic = filterToLogic;
|
|
25
|
-
/**
|
|
26
|
-
* Generates a Logic structure from the visual filter structure
|
|
27
|
-
* @param visual the visual filter structure
|
|
28
|
-
* @returns the logic structure
|
|
29
|
-
*/
|
|
30
22
|
function visualToLogic(visual) {
|
|
31
23
|
return visual.scopes.reduce((logics, scope) => {
|
|
32
24
|
const logic = buildLogic(scope);
|
|
@@ -41,12 +33,6 @@ function visualToLogic(visual) {
|
|
|
41
33
|
return logics;
|
|
42
34
|
}, []);
|
|
43
35
|
}
|
|
44
|
-
exports.visualToLogic = visualToLogic;
|
|
45
|
-
/**
|
|
46
|
-
* Gets the Logic structure for the given scope
|
|
47
|
-
* @param scope the visual filter scope object
|
|
48
|
-
* @returns a logic structure
|
|
49
|
-
*/
|
|
50
36
|
function buildLogic(scope) {
|
|
51
37
|
return {
|
|
52
38
|
filters: [],
|
|
@@ -54,13 +40,7 @@ function buildLogic(scope) {
|
|
|
54
40
|
scopeid: scope.id,
|
|
55
41
|
};
|
|
56
42
|
}
|
|
57
|
-
|
|
58
|
-
* Gets the Logic Filters collection based on filters
|
|
59
|
-
* @param filters the filter collection
|
|
60
|
-
* @param groupColumns a flag to know if the
|
|
61
|
-
* @returns the logic filter collection
|
|
62
|
-
*/
|
|
63
|
-
function buildLogicFilters(filters, groupColumns = false) {
|
|
43
|
+
function buildLogicFilters(filters, groupColumns) {
|
|
64
44
|
const expression = numericExpression(filters, groupColumns);
|
|
65
45
|
const orOperators = expression.split("+");
|
|
66
46
|
const getFilter = (fi) => {
|
|
@@ -102,11 +82,6 @@ function buildLogicFilters(filters, groupColumns = false) {
|
|
|
102
82
|
},
|
|
103
83
|
];
|
|
104
84
|
}
|
|
105
|
-
/**
|
|
106
|
-
*
|
|
107
|
-
* @param group
|
|
108
|
-
* @param getFilter
|
|
109
|
-
*/
|
|
110
85
|
function getColumnExpressions(group, getFilter) {
|
|
111
86
|
const columnOrOperators = group.split("/");
|
|
112
87
|
if (columnOrOperators.length > 1) {
|
|
@@ -119,23 +94,13 @@ function getColumnExpressions(group, getFilter) {
|
|
|
119
94
|
}
|
|
120
95
|
return getFilter(group);
|
|
121
96
|
}
|
|
122
|
-
|
|
123
|
-
*
|
|
124
|
-
* @param operator
|
|
125
|
-
* @param priority
|
|
126
|
-
*/
|
|
127
|
-
function logicToNumeric(operator, priority = false) {
|
|
97
|
+
function logicToNumeric(operator, priority) {
|
|
128
98
|
if (operator === filter_operators_resources_1.FILTER_OPERATOR.AND) {
|
|
129
99
|
return "*";
|
|
130
100
|
}
|
|
131
101
|
return priority ? "/" : "+";
|
|
132
102
|
}
|
|
133
|
-
|
|
134
|
-
*
|
|
135
|
-
* @param filters
|
|
136
|
-
* @param groupColumns
|
|
137
|
-
*/
|
|
138
|
-
function numericExpression(filters, groupColumns = false) {
|
|
103
|
+
function numericExpression(filters, groupColumns) {
|
|
139
104
|
let expression = "";
|
|
140
105
|
filters.forEach((item, index) => {
|
|
141
106
|
const filter = filters[index + 1] || {};
|
|
@@ -144,12 +109,6 @@ function numericExpression(filters, groupColumns = false) {
|
|
|
144
109
|
});
|
|
145
110
|
return expression.substring(0, expression.length - 1);
|
|
146
111
|
}
|
|
147
|
-
/**
|
|
148
|
-
* Builds filter expression by the filter data.
|
|
149
|
-
* - If the resulting value array is empty the enabled property will be false.
|
|
150
|
-
* @param filter The filter to transform
|
|
151
|
-
* @returns a filter expression
|
|
152
|
-
*/
|
|
153
112
|
function buildLogicExpression(filter) {
|
|
154
113
|
const expression = {
|
|
155
114
|
enabled: filter.enabled,
|
|
@@ -163,12 +122,6 @@ function buildLogicExpression(filter) {
|
|
|
163
122
|
filter.selectAll || expression.value.length > 0 ? filter.enabled : false;
|
|
164
123
|
return expression;
|
|
165
124
|
}
|
|
166
|
-
exports.buildLogicExpression = buildLogicExpression;
|
|
167
|
-
/**
|
|
168
|
-
* Gets a group value for the backend logic structure
|
|
169
|
-
* @param filter The filter object
|
|
170
|
-
* @returns the group value
|
|
171
|
-
*/
|
|
172
125
|
function getLogicExpressionGroupValue(filter) {
|
|
173
126
|
if (filter.aggregateType == null &&
|
|
174
127
|
(0, utils_1.isDateColumn)({
|
|
@@ -182,11 +135,6 @@ function getLogicExpressionGroupValue(filter) {
|
|
|
182
135
|
}
|
|
183
136
|
return undefined;
|
|
184
137
|
}
|
|
185
|
-
/**
|
|
186
|
-
* Gets a property for the logic expression structure
|
|
187
|
-
* @param filter The filter
|
|
188
|
-
* @returns a property
|
|
189
|
-
*/
|
|
190
138
|
function getLogicExpressionProperty(filter) {
|
|
191
139
|
if ((0, utils_1.isEmpty)(filter.aggregateType)) {
|
|
192
140
|
if ((0, filter_validators_helpers_1.isNullValidator)(filter.validator) ||
|
|
@@ -217,11 +165,6 @@ function getLogicExpressionProperty(filter) {
|
|
|
217
165
|
}
|
|
218
166
|
return filter.grouping;
|
|
219
167
|
}
|
|
220
|
-
/**
|
|
221
|
-
* Gets the filter logic Validator
|
|
222
|
-
* @param filter the filter object
|
|
223
|
-
* @returns the Filter Logic Validator
|
|
224
|
-
*/
|
|
225
168
|
function getLogicExpressionValidator(filter) {
|
|
226
169
|
let logicValidator = filter_validators_resources_1.FILTER_LOGIC_VALIDATOR_BY_VALIDATOR[filter.validator];
|
|
227
170
|
if (filter.selectAll && filter.validator === filter_validators_resources_1.FILTER_VALIDATOR.EQUALS)
|
|
@@ -230,11 +173,6 @@ function getLogicExpressionValidator(filter) {
|
|
|
230
173
|
logicValidator = filter_logic_resources_1.FILTER_LOGIC_VALIDATOR.EQUALS;
|
|
231
174
|
return logicValidator;
|
|
232
175
|
}
|
|
233
|
-
/**
|
|
234
|
-
* Gets the expresion values in the logic format
|
|
235
|
-
* @param filter The filter structure
|
|
236
|
-
* @returns A collection of backend expression value
|
|
237
|
-
*/
|
|
238
176
|
function getFilterLogicValues(filter) {
|
|
239
177
|
const values = filter.values || [];
|
|
240
178
|
switch (filter.validator) {
|
|
@@ -275,12 +213,6 @@ function getFilterLogicValues(filter) {
|
|
|
275
213
|
return [];
|
|
276
214
|
}
|
|
277
215
|
}
|
|
278
|
-
exports.getFilterLogicValues = getFilterLogicValues;
|
|
279
|
-
/**
|
|
280
|
-
* Gets the expression values for Exclusive Ranges
|
|
281
|
-
* @param values the collection of values
|
|
282
|
-
* @returns the logic expression values
|
|
283
|
-
*/
|
|
284
216
|
function getExclusiveRange(values) {
|
|
285
217
|
return values.reduce((expressionValues, value) => {
|
|
286
218
|
const expressionValue = getValue(value, {
|
|
@@ -292,11 +224,6 @@ function getExclusiveRange(values) {
|
|
|
292
224
|
return expressionValues;
|
|
293
225
|
}, []);
|
|
294
226
|
}
|
|
295
|
-
/**
|
|
296
|
-
* Gets the expression values for Inclusive Ranges
|
|
297
|
-
* @param values the collection of values
|
|
298
|
-
* @returns the logic expression values
|
|
299
|
-
*/
|
|
300
227
|
function getInclusiveRange(values) {
|
|
301
228
|
return values.reduce((expressionValues, value) => {
|
|
302
229
|
const expressionValue = getValue(value, {
|
|
@@ -308,11 +235,6 @@ function getInclusiveRange(values) {
|
|
|
308
235
|
return expressionValues;
|
|
309
236
|
}, []);
|
|
310
237
|
}
|
|
311
|
-
/**
|
|
312
|
-
* Gets the expression values for Before Ranges
|
|
313
|
-
* @param values the collection of values
|
|
314
|
-
* @returns the logic expression values
|
|
315
|
-
*/
|
|
316
238
|
function getBeforeValues(values) {
|
|
317
239
|
return values.reduce((expressionValues, value) => {
|
|
318
240
|
const expressionValue = getValue(value, {
|
|
@@ -323,11 +245,6 @@ function getBeforeValues(values) {
|
|
|
323
245
|
return expressionValues;
|
|
324
246
|
}, []);
|
|
325
247
|
}
|
|
326
|
-
/**
|
|
327
|
-
* Gets the expression values for BeforeOn Ranges
|
|
328
|
-
* @param values the collection of values
|
|
329
|
-
* @returns the logic expression values
|
|
330
|
-
*/
|
|
331
248
|
function getBeforeOnValues(values) {
|
|
332
249
|
return values.reduce((expressionValues, value) => {
|
|
333
250
|
const expressionValue = getValue(value, {
|
|
@@ -338,11 +255,6 @@ function getBeforeOnValues(values) {
|
|
|
338
255
|
return expressionValues;
|
|
339
256
|
}, []);
|
|
340
257
|
}
|
|
341
|
-
/**
|
|
342
|
-
* Gets the expression values for After Ranges
|
|
343
|
-
* @param values the collection of values
|
|
344
|
-
* @returns the logic expression values
|
|
345
|
-
*/
|
|
346
258
|
function getAfterValues(values) {
|
|
347
259
|
return values.reduce((expressionValues, value) => {
|
|
348
260
|
const expressionValue = getValue(value, {
|
|
@@ -353,11 +265,6 @@ function getAfterValues(values) {
|
|
|
353
265
|
return expressionValues;
|
|
354
266
|
}, []);
|
|
355
267
|
}
|
|
356
|
-
/**
|
|
357
|
-
* Gets the expression values for AfterOn Ranges
|
|
358
|
-
* @param values the collection of values
|
|
359
|
-
* @returns the logic expression values
|
|
360
|
-
*/
|
|
361
268
|
function getAfterOnValues(values) {
|
|
362
269
|
return values.reduce((expressionValues, value) => {
|
|
363
270
|
const expressionValue = getValue(value, {
|
|
@@ -368,21 +275,10 @@ function getAfterOnValues(values) {
|
|
|
368
275
|
return expressionValues;
|
|
369
276
|
}, []);
|
|
370
277
|
}
|
|
371
|
-
/**
|
|
372
|
-
* Gets the expression values for Nulls
|
|
373
|
-
* @param values the collection of values
|
|
374
|
-
* @param filter the filter structure
|
|
375
|
-
* @returns the logic expression values
|
|
376
|
-
*/
|
|
377
278
|
function getNullValues(values, filter) {
|
|
378
279
|
const addValue = values.length > 0 && values.every((value) => value.enabled);
|
|
379
280
|
return addValue ? [filter.validator] : [];
|
|
380
281
|
}
|
|
381
|
-
/**
|
|
382
|
-
* Gets the expression values for Relative Dates
|
|
383
|
-
* @param values the collection of values
|
|
384
|
-
* @returns the logic expression values
|
|
385
|
-
*/
|
|
386
282
|
function getInValues(values) {
|
|
387
283
|
return values.reduce((expressionValues, value) => {
|
|
388
284
|
const expressionValue = getValue(value, value);
|
|
@@ -391,21 +287,9 @@ function getInValues(values) {
|
|
|
391
287
|
return expressionValues;
|
|
392
288
|
}, []);
|
|
393
289
|
}
|
|
394
|
-
/**
|
|
395
|
-
* Gets the value on the filter values
|
|
396
|
-
* @param objectValue The filter structure
|
|
397
|
-
* @param value The filter structure
|
|
398
|
-
* @returns the value
|
|
399
|
-
*/
|
|
400
290
|
function getValue(objectValue, value) {
|
|
401
291
|
return objectValue.enabled ? value : undefined;
|
|
402
292
|
}
|
|
403
|
-
/**
|
|
404
|
-
* Gets the expression values. Depending on the column type
|
|
405
|
-
* @param values a collection of filter values
|
|
406
|
-
* @param filter The filter structure
|
|
407
|
-
* @returns Expression values
|
|
408
|
-
*/
|
|
409
293
|
function getResultValues(values, filter) {
|
|
410
294
|
return values.reduce((expressionValues, value) => {
|
|
411
295
|
let expressionValue = "";
|
|
@@ -420,11 +304,6 @@ function getResultValues(values, filter) {
|
|
|
420
304
|
return expressionValues;
|
|
421
305
|
}, []);
|
|
422
306
|
}
|
|
423
|
-
/**
|
|
424
|
-
* Gets the Ranking values.
|
|
425
|
-
* @param values a collection of filter values in the ranking structure
|
|
426
|
-
* @returns Expression values for ranking
|
|
427
|
-
*/
|
|
428
307
|
function getRankingValues(values) {
|
|
429
308
|
const flattenValues = (0, utils_1.flattenDeep)(values);
|
|
430
309
|
return flattenValues.reduce((expressionValues, value) => {
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFilterGrouping =
|
|
3
|
+
exports.getFilterGrouping = getFilterGrouping;
|
|
4
4
|
const FilterResources_1 = require("../classes/FilterResources");
|
|
5
5
|
const filters_resources_1 = require("../resources/filters.resources");
|
|
6
|
-
/**
|
|
7
|
-
* Gets the filter grouping for a given filter.
|
|
8
|
-
* @param filter The filter to get the grouping for.
|
|
9
|
-
* @param settings Settings for the filter grouping.
|
|
10
|
-
* @returns The filter grouping.
|
|
11
|
-
*/
|
|
12
6
|
function getFilterGrouping(filter, settings) {
|
|
13
7
|
return ((settings?.strictValidation
|
|
14
8
|
? FilterResources_1.FilterResources.getGroupingInfoByColumnType({
|
|
@@ -17,4 +11,3 @@ function getFilterGrouping(filter, settings) {
|
|
|
17
11
|
}, filter.grouping, settings)?.value
|
|
18
12
|
: filter.grouping) || filters_resources_1.DEFAULT_FILTER.grouping);
|
|
19
13
|
}
|
|
20
|
-
exports.getFilterGrouping = getFilterGrouping;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getEditFiltersSettings = getEditFiltersSettings;
|
|
4
|
+
exports.getFilterAddSettings = getFilterAddSettings;
|
|
5
|
+
exports.getFilterCreateSettings = getFilterCreateSettings;
|
|
6
|
+
exports.getInfoGroupingsByColumnTypeSettings = getInfoGroupingsByColumnTypeSettings;
|
|
7
|
+
exports.getParamFiltersSettings = getParamFiltersSettings;
|
|
8
|
+
exports.getReplaceByParamsSettings = getReplaceByParamsSettings;
|
|
4
9
|
const filter_functions_resources_1 = require("../resources/filter-functions.resources");
|
|
5
|
-
/**
|
|
6
|
-
* Gets a complete settings for the edit filters settings
|
|
7
|
-
* - Fills the missing properties with default ones
|
|
8
|
-
* @param settings the settings
|
|
9
|
-
* @returns the complete settings
|
|
10
|
-
*/
|
|
11
10
|
function getEditFiltersSettings(settings) {
|
|
12
11
|
return {
|
|
13
12
|
automaticId: settings?.automaticId ?? filter_functions_resources_1.DEFAULT_FILTERS_EDIT_SETTINGS.automaticId,
|
|
@@ -15,12 +14,6 @@ function getEditFiltersSettings(settings) {
|
|
|
15
14
|
filter_functions_resources_1.DEFAULT_FILTERS_EDIT_SETTINGS.strictValidation,
|
|
16
15
|
};
|
|
17
16
|
}
|
|
18
|
-
exports.getEditFiltersSettings = getEditFiltersSettings;
|
|
19
|
-
/**
|
|
20
|
-
* Gets a complete settings for the filter-create settings
|
|
21
|
-
* @param settings the filter-create settings
|
|
22
|
-
* @returns the complete filter-create settings
|
|
23
|
-
*/
|
|
24
17
|
function getFilterAddSettings(settings) {
|
|
25
18
|
return {
|
|
26
19
|
automaticId: settings?.automaticId ?? filter_functions_resources_1.DEFAULT_FILTER_ADD_SETTINGS.automaticId,
|
|
@@ -28,12 +21,6 @@ function getFilterAddSettings(settings) {
|
|
|
28
21
|
filter_functions_resources_1.DEFAULT_FILTER_ADD_SETTINGS.automaticOperator,
|
|
29
22
|
};
|
|
30
23
|
}
|
|
31
|
-
exports.getFilterAddSettings = getFilterAddSettings;
|
|
32
|
-
/**
|
|
33
|
-
* Gets a complete settings for the filter-create settings
|
|
34
|
-
* @param settings the filter-create settings
|
|
35
|
-
* @returns the complete filter-create settings
|
|
36
|
-
*/
|
|
37
24
|
function getFilterCreateSettings(settings) {
|
|
38
25
|
return {
|
|
39
26
|
automaticId: settings?.automaticId ?? filter_functions_resources_1.DEFAULT_FILTER_CREATE_SETTINGS.automaticId,
|
|
@@ -43,13 +30,6 @@ function getFilterCreateSettings(settings) {
|
|
|
43
30
|
...getInfoGroupingsByColumnTypeSettings(settings),
|
|
44
31
|
};
|
|
45
32
|
}
|
|
46
|
-
exports.getFilterCreateSettings = getFilterCreateSettings;
|
|
47
|
-
/**
|
|
48
|
-
* Gets a complete settings for the info grouping by column settings
|
|
49
|
-
* - Fills the missing properties with default ones
|
|
50
|
-
* @param settings the settings
|
|
51
|
-
* @returns the complete settings
|
|
52
|
-
*/
|
|
53
33
|
function getInfoGroupingsByColumnTypeSettings(settings) {
|
|
54
34
|
return {
|
|
55
35
|
hasDateTime: settings?.hasDateTime ??
|
|
@@ -64,13 +44,6 @@ function getInfoGroupingsByColumnTypeSettings(settings) {
|
|
|
64
44
|
filter_functions_resources_1.DEFAULT_FILTERS_GROUPING_INFO_BY_COLUMN_SETTINGS.isExpressionCategorizable,
|
|
65
45
|
};
|
|
66
46
|
}
|
|
67
|
-
exports.getInfoGroupingsByColumnTypeSettings = getInfoGroupingsByColumnTypeSettings;
|
|
68
|
-
/**
|
|
69
|
-
* Gets a complete settings for the param settings
|
|
70
|
-
* - Fills the missing properties with default ones
|
|
71
|
-
* @param settings the settings
|
|
72
|
-
* @returns the complete settings
|
|
73
|
-
*/
|
|
74
47
|
function getParamFiltersSettings(settings) {
|
|
75
48
|
return {
|
|
76
49
|
letPassUndefinedParams: settings?.letPassUndefinedParams ??
|
|
@@ -81,13 +54,6 @@ function getParamFiltersSettings(settings) {
|
|
|
81
54
|
filter_functions_resources_1.DEFAULT_FILTERS_PARAM_SETTINGS.removeEmptyArrays,
|
|
82
55
|
};
|
|
83
56
|
}
|
|
84
|
-
exports.getParamFiltersSettings = getParamFiltersSettings;
|
|
85
|
-
/**
|
|
86
|
-
* Gets a complete settings for the replaceByParams settings
|
|
87
|
-
* - Fills the missing properties with default ones
|
|
88
|
-
* @param settings the settings
|
|
89
|
-
* @returns the complete settings
|
|
90
|
-
*/
|
|
91
57
|
function getReplaceByParamsSettings(settings) {
|
|
92
58
|
return {
|
|
93
59
|
...settings,
|
|
@@ -95,4 +61,3 @@ function getReplaceByParamsSettings(settings) {
|
|
|
95
61
|
addingInSameIndex: settings?.addingInSameIndex ?? false,
|
|
96
62
|
};
|
|
97
63
|
}
|
|
98
|
-
exports.getReplaceByParamsSettings = getReplaceByParamsSettings;
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isNullValidator =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* @returns True: It is a Null Validator
|
|
9
|
-
*/
|
|
3
|
+
exports.isNullValidator = isNullValidator;
|
|
4
|
+
exports.isRegularValidator = isRegularValidator;
|
|
5
|
+
exports.isRangeValidator = isRangeValidator;
|
|
6
|
+
exports.isInValidator = isInValidator;
|
|
7
|
+
const filters_resources_1 = require("../resources/filters.resources");
|
|
10
8
|
function isNullValidator(validator) {
|
|
11
|
-
return [
|
|
9
|
+
return filters_resources_1.FILTER_TYPE_BY_VALIDATOR[validator] === filters_resources_1.FILTER_TYPE.NULL;
|
|
10
|
+
}
|
|
11
|
+
function isRegularValidator(validator) {
|
|
12
|
+
return filters_resources_1.FILTER_TYPE_BY_VALIDATOR[validator] === filters_resources_1.FILTER_TYPE.REGULAR;
|
|
13
|
+
}
|
|
14
|
+
function isRangeValidator(validator) {
|
|
15
|
+
return filters_resources_1.FILTER_TYPE_BY_VALIDATOR[validator] === filters_resources_1.FILTER_TYPE.RANGE;
|
|
16
|
+
}
|
|
17
|
+
function isInValidator(validator) {
|
|
18
|
+
return filters_resources_1.FILTER_TYPE_BY_VALIDATOR[validator] === filters_resources_1.FILTER_TYPE.RELATIVE;
|
|
12
19
|
}
|
|
13
|
-
exports.isNullValidator = isNullValidator;
|