@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,139 +1,25 @@
|
|
|
1
1
|
import { IColumnVsFormulaType, IDTimezone } from "@qrvey/utils";
|
|
2
2
|
import { IFilterGroupingInfoByColumnTypeSettings, IFilterGroupingInfoByFilterSettings, IFilterGroupingInfoListByColumnSettings } from "../resources/filter-functions.resources";
|
|
3
3
|
import { IFilterGrouping, IFilterGroupingInfo } from "../resources/filter-grouping.resources";
|
|
4
|
+
import { IFilterScope } from "../resources/filter-scopes.resources";
|
|
4
5
|
import { IFilterValidator, IFilterValidatorInfo } from "../resources/filter-validators.resources";
|
|
5
6
|
import { IFilter } from "../resources/filters.resources";
|
|
6
|
-
import { IFilterScope } from "../resources/filter-scopes.resources";
|
|
7
|
-
/**
|
|
8
|
-
* Class to search, build and get resources for the filters.
|
|
9
|
-
*/
|
|
10
7
|
export declare class FilterResources {
|
|
11
|
-
/**
|
|
12
|
-
* **************************************************************************************************
|
|
13
|
-
**************************************** Grouping **************************************************
|
|
14
|
-
****************************************************************************************************
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Gets a grouping info by a grouping type
|
|
18
|
-
* @param grouping the grouping type
|
|
19
|
-
* @returns a single grouping info
|
|
20
|
-
*/
|
|
21
8
|
static getGroupingInfo(grouping: IFilterGrouping): IFilterGroupingInfo;
|
|
22
|
-
/**
|
|
23
|
-
* Gets a collection of groupings info by a column type
|
|
24
|
-
* @param type the object with column and formula type
|
|
25
|
-
* @param settings settings for the function
|
|
26
|
-
* @returns a collection of grouping info
|
|
27
|
-
*/
|
|
28
9
|
static getGroupingInfoListByColumnType(type: IColumnVsFormulaType, settings?: IFilterGroupingInfoListByColumnSettings): IFilterGroupingInfo[];
|
|
29
|
-
/**
|
|
30
|
-
* Gets a grouping info by a column type and grouping
|
|
31
|
-
* @param type the object with column and formula type
|
|
32
|
-
* @param grouping the grouping type
|
|
33
|
-
* @param settings settings for the function
|
|
34
|
-
* @returns the grouping info
|
|
35
|
-
*/
|
|
36
10
|
static getGroupingInfoByColumnType(type: IColumnVsFormulaType, grouping?: IFilterGrouping, settings?: IFilterGroupingInfoByColumnTypeSettings): IFilterGroupingInfo | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* Gets a grouping info by a filter
|
|
39
|
-
* @param filter the filter object
|
|
40
|
-
* @returns the grouping info
|
|
41
|
-
*/
|
|
42
11
|
static getGroupingInfoByFilter(filter: IFilter, settings?: IFilterGroupingInfoByFilterSettings): IFilterGroupingInfo | undefined;
|
|
43
|
-
/**
|
|
44
|
-
* Gets a collection of groupings info by a column type
|
|
45
|
-
* - The resulting grouping info collection is an intersection of mulitple grouping info collections
|
|
46
|
-
* @param types the collection of objects with column and formula types
|
|
47
|
-
* @param settings settings for the function
|
|
48
|
-
* @returns a collection of grouping info
|
|
49
|
-
*/
|
|
50
12
|
static getGroupingInfoListByColumnTypes(types: IColumnVsFormulaType[], settings?: IFilterGroupingInfoListByColumnSettings[]): IFilterGroupingInfo[];
|
|
51
|
-
/**
|
|
52
|
-
* Gets the grouping info of Date column type
|
|
53
|
-
* @param groupinInfoList the original grouping info list
|
|
54
|
-
* @param settings settings for the function
|
|
55
|
-
* @returns the new grouping info list
|
|
56
|
-
*/
|
|
57
13
|
static getGroupingInfoListOnDates(groupinInfoList: IFilterGroupingInfo[], settings: IFilterGroupingInfoListByColumnSettings): IFilterGroupingInfo[];
|
|
58
|
-
/**
|
|
59
|
-
* Gets the grouping info of Expression column type
|
|
60
|
-
* @param groupinInfoList the original grouping info list
|
|
61
|
-
* @param settings settings for the function
|
|
62
|
-
* @returns the new grouping info list
|
|
63
|
-
*/
|
|
64
14
|
static getGroupingInfoListOnExpressions(groupinInfoList: IFilterGroupingInfo[], settings: IFilterGroupingInfoListByColumnSettings): IFilterGroupingInfo[];
|
|
65
|
-
/**
|
|
66
|
-
* Gets the grouping info of Image Upload column type
|
|
67
|
-
* @param groupinInfoList the original grouping info list
|
|
68
|
-
* @param settings settings for the function
|
|
69
|
-
* @returns the new grouping info list
|
|
70
|
-
*/
|
|
71
15
|
static getGroupingInfoListOnImageUploads(groupinInfoList: IFilterGroupingInfo[], settings: IFilterGroupingInfoListByColumnSettings): IFilterGroupingInfo[];
|
|
72
|
-
/**
|
|
73
|
-
* Gets the complete collection of grouping types
|
|
74
|
-
* @returns the collection of grouping types
|
|
75
|
-
*/
|
|
76
16
|
static getGroupings(): IFilterGrouping[];
|
|
77
|
-
/**
|
|
78
|
-
* Gets the complete collection of validator info
|
|
79
|
-
* @returns the collection of validator info
|
|
80
|
-
*/
|
|
81
17
|
static getGroupingsInfoList(): IFilterGroupingInfo[];
|
|
82
|
-
/**
|
|
83
|
-
* **************************************************************************************************
|
|
84
|
-
**************************************** Scopes *************************************************
|
|
85
|
-
****************************************************************************************************
|
|
86
|
-
*/
|
|
87
|
-
/**
|
|
88
|
-
* Gets the collection of filter scopes in order of hierarchy
|
|
89
|
-
* @returns the collection of validator info
|
|
90
|
-
*/
|
|
91
18
|
static getHierarchyScopes(): IFilterScope[];
|
|
92
|
-
/**
|
|
93
|
-
* **************************************************************************************************
|
|
94
|
-
**************************************** Timezone *************************************************
|
|
95
|
-
****************************************************************************************************
|
|
96
|
-
*/
|
|
97
|
-
/**
|
|
98
|
-
* Gets the filters transformed by the given timezone
|
|
99
|
-
* @param filters the filters to transform
|
|
100
|
-
* @param timezone the timezone info
|
|
101
|
-
* @returns the transformed filters to a new timezone
|
|
102
|
-
*/
|
|
103
19
|
static getFiltersByTimezone(filters: IFilter[], timezone: IDTimezone): IFilter[];
|
|
104
|
-
/**
|
|
105
|
-
* **************************************************************************************************
|
|
106
|
-
**************************************** Validator *************************************************
|
|
107
|
-
****************************************************************************************************
|
|
108
|
-
*/
|
|
109
|
-
/**
|
|
110
|
-
* Gets a validator info by a validator type
|
|
111
|
-
* @param validator the validator type
|
|
112
|
-
* @returns a single validator info
|
|
113
|
-
*/
|
|
114
20
|
static getValidatorInfo(validator: IFilterValidator): IFilterValidatorInfo;
|
|
115
|
-
/**
|
|
116
|
-
* Gets the complete collection of validator info
|
|
117
|
-
* @returns the collection of validator info
|
|
118
|
-
*/
|
|
119
21
|
static getValidatorInfoList(): IFilterValidatorInfo[];
|
|
120
|
-
/**
|
|
121
|
-
* Gets a collection of validator info by a column type
|
|
122
|
-
* @param type the object with column and formula type
|
|
123
|
-
* @returns a collection of validator info
|
|
124
|
-
*/
|
|
125
22
|
static getValidatorInfoListByColumnType(type: IColumnVsFormulaType): IFilterValidatorInfo[];
|
|
126
|
-
/**
|
|
127
|
-
* Gets a collection of validator info by a mutiple column types
|
|
128
|
-
* - The resulting validator info collection is an intersection of mulitple validator info collections
|
|
129
|
-
* @param types a collection of objects with column and formula types
|
|
130
|
-
* @returns a collection of validator info
|
|
131
|
-
*/
|
|
132
23
|
static getValidatorInfoListByColumnTypes(types: IColumnVsFormulaType[]): IFilterValidatorInfo[];
|
|
133
|
-
/**
|
|
134
|
-
* Gets the complete collection of validator types
|
|
135
|
-
* @returns the collection of validator types
|
|
136
|
-
*/
|
|
137
24
|
static getValidators(): IFilterValidator[];
|
|
138
25
|
}
|
|
139
|
-
//# sourceMappingURL=FilterResources.d.ts.map
|
|
@@ -1,34 +1,15 @@
|
|
|
1
1
|
import { COLUMN, COLUMN_BY_FORMULA, FORMULA, getDateByTimezone, intersectObjectArrays, isEmpty, objectCopy, } from "@qrvey/utils";
|
|
2
|
-
import {
|
|
2
|
+
import { FilterValidation } from "./FilterValidation";
|
|
3
3
|
import { getInfoGroupingsByColumnTypeSettings } from "../helpers/filter-settings.helpers";
|
|
4
|
+
import { getFilterType } from "../helpers/getFilterType";
|
|
4
5
|
import { FILTER_GROUPING, FILTER_GROUPING_INFO, FILTER_GROUPING_INFO_BY_COLUMN_TYPE, FILTER_GROUPING_INFO_BY_DATE_TIME, FILTER_GROUPING_INFO_BY_DISTINCT_DATE, FILTER_GROUPING_INFO_BY_DISTINCT_DATE_TIME, FILTER_GROUPING_INFO_LIST, FILTER_GROUPINGS, } from "../resources/filter-grouping.resources";
|
|
6
|
+
import { FILTER_SCOPES, } from "../resources/filter-scopes.resources";
|
|
5
7
|
import { FILTER_VALIDATOR_INFO, FILTER_VALIDATOR_INFO_LIST, FILTER_VALIDATORS, FILTER_VALIDATORS_INFO_BY_COLUMN_TYPE, } from "../resources/filter-validators.resources";
|
|
6
8
|
import { FILTER_TYPE } from "../resources/filters.resources";
|
|
7
|
-
import { FILTER_SCOPES, } from "../resources/filter-scopes.resources";
|
|
8
|
-
import { FilterValidation } from "./FilterValidation";
|
|
9
|
-
/**
|
|
10
|
-
* Class to search, build and get resources for the filters.
|
|
11
|
-
*/
|
|
12
9
|
export class FilterResources {
|
|
13
|
-
/**
|
|
14
|
-
* **************************************************************************************************
|
|
15
|
-
**************************************** Grouping **************************************************
|
|
16
|
-
****************************************************************************************************
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* Gets a grouping info by a grouping type
|
|
20
|
-
* @param grouping the grouping type
|
|
21
|
-
* @returns a single grouping info
|
|
22
|
-
*/
|
|
23
10
|
static getGroupingInfo(grouping) {
|
|
24
11
|
return FILTER_GROUPING_INFO[grouping];
|
|
25
12
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Gets a collection of groupings info by a column type
|
|
28
|
-
* @param type the object with column and formula type
|
|
29
|
-
* @param settings settings for the function
|
|
30
|
-
* @returns a collection of grouping info
|
|
31
|
-
*/
|
|
32
13
|
static getGroupingInfoListByColumnType(type, settings) {
|
|
33
14
|
const { type: columnType, formulaType } = type;
|
|
34
15
|
const completeSettings = getInfoGroupingsByColumnTypeSettings(settings);
|
|
@@ -47,13 +28,6 @@ export class FilterResources {
|
|
|
47
28
|
groupinInfoList = this.getGroupingInfoListOnDates(groupinInfoList, completeSettings);
|
|
48
29
|
return groupinInfoList;
|
|
49
30
|
}
|
|
50
|
-
/**
|
|
51
|
-
* Gets a grouping info by a column type and grouping
|
|
52
|
-
* @param type the object with column and formula type
|
|
53
|
-
* @param grouping the grouping type
|
|
54
|
-
* @param settings settings for the function
|
|
55
|
-
* @returns the grouping info
|
|
56
|
-
*/
|
|
57
31
|
static getGroupingInfoByColumnType(type, grouping, settings) {
|
|
58
32
|
if (grouping == null)
|
|
59
33
|
return;
|
|
@@ -61,35 +35,17 @@ export class FilterResources {
|
|
|
61
35
|
const groupingInfo = groupingInfoList.find((gInfo) => gInfo.value === grouping);
|
|
62
36
|
return groupingInfo == null ? groupingInfoList[0] : groupingInfo;
|
|
63
37
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Gets a grouping info by a filter
|
|
66
|
-
* @param filter the filter object
|
|
67
|
-
* @returns the grouping info
|
|
68
|
-
*/
|
|
69
38
|
static getGroupingInfoByFilter(filter, settings) {
|
|
70
39
|
if (!FilterValidation.isGroupingValid(filter.columnType, filter.validator))
|
|
71
40
|
return;
|
|
72
41
|
return this.getGroupingInfoByColumnType({ type: filter.columnType, formulaType: filter.formulaType }, filter.grouping, settings);
|
|
73
42
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Gets a collection of groupings info by a column type
|
|
76
|
-
* - The resulting grouping info collection is an intersection of mulitple grouping info collections
|
|
77
|
-
* @param types the collection of objects with column and formula types
|
|
78
|
-
* @param settings settings for the function
|
|
79
|
-
* @returns a collection of grouping info
|
|
80
|
-
*/
|
|
81
43
|
static getGroupingInfoListByColumnTypes(types, settings) {
|
|
82
44
|
if (!Array.isArray(types))
|
|
83
45
|
return [];
|
|
84
46
|
const infoGroupings = types.map((type, index) => FilterResources.getGroupingInfoListByColumnType(type, settings?.[index]));
|
|
85
47
|
return intersectObjectArrays(infoGroupings, "value");
|
|
86
48
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Gets the grouping info of Date column type
|
|
89
|
-
* @param groupinInfoList the original grouping info list
|
|
90
|
-
* @param settings settings for the function
|
|
91
|
-
* @returns the new grouping info list
|
|
92
|
-
*/
|
|
93
49
|
static getGroupingInfoListOnDates(groupinInfoList, settings) {
|
|
94
50
|
let newGroupInfoList = groupinInfoList;
|
|
95
51
|
if (settings.hasDateTime) {
|
|
@@ -112,65 +68,25 @@ export class FilterResources {
|
|
|
112
68
|
}
|
|
113
69
|
return newGroupInfoList;
|
|
114
70
|
}
|
|
115
|
-
/**
|
|
116
|
-
* Gets the grouping info of Expression column type
|
|
117
|
-
* @param groupinInfoList the original grouping info list
|
|
118
|
-
* @param settings settings for the function
|
|
119
|
-
* @returns the new grouping info list
|
|
120
|
-
*/
|
|
121
71
|
static getGroupingInfoListOnExpressions(groupinInfoList, settings) {
|
|
122
72
|
if (!settings.isExpressionCategorizable)
|
|
123
73
|
return [];
|
|
124
74
|
return groupinInfoList;
|
|
125
75
|
}
|
|
126
|
-
/**
|
|
127
|
-
* Gets the grouping info of Image Upload column type
|
|
128
|
-
* @param groupinInfoList the original grouping info list
|
|
129
|
-
* @param settings settings for the function
|
|
130
|
-
* @returns the new grouping info list
|
|
131
|
-
*/
|
|
132
76
|
static getGroupingInfoListOnImageUploads(groupinInfoList, settings) {
|
|
133
77
|
if (settings.hasImageUploadAnalysis)
|
|
134
78
|
return groupinInfoList;
|
|
135
79
|
return groupinInfoList.filter((groupingInfo) => groupingInfo.value !== FILTER_GROUPING.IMAGEUPLOAD_IMAGEWORDS);
|
|
136
80
|
}
|
|
137
|
-
/**
|
|
138
|
-
* Gets the complete collection of grouping types
|
|
139
|
-
* @returns the collection of grouping types
|
|
140
|
-
*/
|
|
141
81
|
static getGroupings() {
|
|
142
82
|
return FILTER_GROUPINGS;
|
|
143
83
|
}
|
|
144
|
-
/**
|
|
145
|
-
* Gets the complete collection of validator info
|
|
146
|
-
* @returns the collection of validator info
|
|
147
|
-
*/
|
|
148
84
|
static getGroupingsInfoList() {
|
|
149
85
|
return FILTER_GROUPING_INFO_LIST;
|
|
150
86
|
}
|
|
151
|
-
/**
|
|
152
|
-
* **************************************************************************************************
|
|
153
|
-
**************************************** Scopes *************************************************
|
|
154
|
-
****************************************************************************************************
|
|
155
|
-
*/
|
|
156
|
-
/**
|
|
157
|
-
* Gets the collection of filter scopes in order of hierarchy
|
|
158
|
-
* @returns the collection of validator info
|
|
159
|
-
*/
|
|
160
87
|
static getHierarchyScopes() {
|
|
161
88
|
return FILTER_SCOPES;
|
|
162
89
|
}
|
|
163
|
-
/**
|
|
164
|
-
* **************************************************************************************************
|
|
165
|
-
**************************************** Timezone *************************************************
|
|
166
|
-
****************************************************************************************************
|
|
167
|
-
*/
|
|
168
|
-
/**
|
|
169
|
-
* Gets the filters transformed by the given timezone
|
|
170
|
-
* @param filters the filters to transform
|
|
171
|
-
* @param timezone the timezone info
|
|
172
|
-
* @returns the transformed filters to a new timezone
|
|
173
|
-
*/
|
|
174
90
|
static getFiltersByTimezone(filters, timezone) {
|
|
175
91
|
if (isEmpty(filters) || !Array.isArray(filters))
|
|
176
92
|
return [];
|
|
@@ -213,31 +129,12 @@ export class FilterResources {
|
|
|
213
129
|
};
|
|
214
130
|
});
|
|
215
131
|
}
|
|
216
|
-
/**
|
|
217
|
-
* **************************************************************************************************
|
|
218
|
-
**************************************** Validator *************************************************
|
|
219
|
-
****************************************************************************************************
|
|
220
|
-
*/
|
|
221
|
-
/**
|
|
222
|
-
* Gets a validator info by a validator type
|
|
223
|
-
* @param validator the validator type
|
|
224
|
-
* @returns a single validator info
|
|
225
|
-
*/
|
|
226
132
|
static getValidatorInfo(validator) {
|
|
227
133
|
return FILTER_VALIDATOR_INFO[validator];
|
|
228
134
|
}
|
|
229
|
-
/**
|
|
230
|
-
* Gets the complete collection of validator info
|
|
231
|
-
* @returns the collection of validator info
|
|
232
|
-
*/
|
|
233
135
|
static getValidatorInfoList() {
|
|
234
136
|
return FILTER_VALIDATOR_INFO_LIST;
|
|
235
137
|
}
|
|
236
|
-
/**
|
|
237
|
-
* Gets a collection of validator info by a column type
|
|
238
|
-
* @param type the object with column and formula type
|
|
239
|
-
* @returns a collection of validator info
|
|
240
|
-
*/
|
|
241
138
|
static getValidatorInfoListByColumnType(type) {
|
|
242
139
|
const { type: colummType, formulaType } = type;
|
|
243
140
|
let newType = colummType;
|
|
@@ -246,22 +143,12 @@ export class FilterResources {
|
|
|
246
143
|
}
|
|
247
144
|
return FILTER_VALIDATORS_INFO_BY_COLUMN_TYPE[newType];
|
|
248
145
|
}
|
|
249
|
-
/**
|
|
250
|
-
* Gets a collection of validator info by a mutiple column types
|
|
251
|
-
* - The resulting validator info collection is an intersection of mulitple validator info collections
|
|
252
|
-
* @param types a collection of objects with column and formula types
|
|
253
|
-
* @returns a collection of validator info
|
|
254
|
-
*/
|
|
255
146
|
static getValidatorInfoListByColumnTypes(types) {
|
|
256
147
|
if (!Array.isArray(types))
|
|
257
148
|
return [];
|
|
258
149
|
const infoValidators = types.map((type) => FilterResources.getValidatorInfoListByColumnType(type));
|
|
259
150
|
return intersectObjectArrays(infoValidators, "value");
|
|
260
151
|
}
|
|
261
|
-
/**
|
|
262
|
-
* Gets the complete collection of validator types
|
|
263
|
-
* @returns the collection of validator types
|
|
264
|
-
*/
|
|
265
152
|
static getValidators() {
|
|
266
153
|
return FILTER_VALIDATORS;
|
|
267
154
|
}
|
|
@@ -1,90 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IFilterSearchEngine } from "../models/filter-searcher.models";
|
|
2
2
|
import { IFilterFindLastIndexReturn, IFilterParamSettings } from "../resources/filter-functions.resources";
|
|
3
3
|
import { IFilter } from "../resources/filters.resources";
|
|
4
|
-
|
|
5
|
-
* Class to search filters.
|
|
6
|
-
*/
|
|
7
|
-
export declare class FilterSearcher implements IFilterSearcherParams {
|
|
4
|
+
export declare class FilterSearcher implements IFilterSearchEngine {
|
|
8
5
|
protected filters: IFilter[];
|
|
9
|
-
/**
|
|
10
|
-
* Constructor
|
|
11
|
-
* @param filters the collection of filters
|
|
12
|
-
*/
|
|
13
6
|
constructor(filters?: IFilter[]);
|
|
14
|
-
/**
|
|
15
|
-
* **************************************************************************************************
|
|
16
|
-
**************************************** By Params *************************************************
|
|
17
|
-
****************************************************************************************************
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* Searchs and excludes filters by the given params
|
|
21
|
-
* @param params params to exclude the filters
|
|
22
|
-
* @param settings settings for this function
|
|
23
|
-
* @returns the new collection of filters
|
|
24
|
-
*/
|
|
25
7
|
excludeByParams(params: Partial<IFilter>, settings?: IFilterParamSettings): IFilter[];
|
|
26
|
-
/**
|
|
27
|
-
* Searchs filters by the given params
|
|
28
|
-
* @param params params to search the filters
|
|
29
|
-
* @param settings settings for this function
|
|
30
|
-
* @returns the new collection of filters
|
|
31
|
-
*/
|
|
32
8
|
filterByParams(params: Partial<IFilter>, settings?: IFilterParamSettings): IFilter[];
|
|
33
|
-
/**
|
|
34
|
-
* Searchs filters by the given params and returns the indexes
|
|
35
|
-
* @param params params to search the filters
|
|
36
|
-
* @param settings settings for this function
|
|
37
|
-
* @returns the new collection of filters
|
|
38
|
-
*/
|
|
39
9
|
filterIndexesByParams(params: Partial<IFilter>, settings?: IFilterParamSettings): number[];
|
|
40
|
-
/**
|
|
41
|
-
* Searchs filters by the given params.
|
|
42
|
-
* Gets the first match of the searching
|
|
43
|
-
* @param params params to search the filters
|
|
44
|
-
* @param settings settings for this function
|
|
45
|
-
* @returns the new collection of filters
|
|
46
|
-
*/
|
|
47
10
|
findByParams(params: Partial<IFilter>, settings?: IFilterParamSettings): IFilter | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* Searchs filters by the given params.
|
|
50
|
-
* Gets the first match of the searching and returns the related index
|
|
51
|
-
* @param params params to search the filters
|
|
52
|
-
* @param settings settings for this function
|
|
53
|
-
* @returns the new collection of filters
|
|
54
|
-
*/
|
|
55
11
|
findIndexByParams(params: Partial<IFilter>, settings?: IFilterParamSettings): number;
|
|
56
|
-
/**
|
|
57
|
-
* **************************************************************************************************
|
|
58
|
-
**************************************** By Filters *************************************************
|
|
59
|
-
****************************************************************************************************
|
|
60
|
-
*/
|
|
61
|
-
/**
|
|
62
|
-
* Gets an index where the new filter is going to be added
|
|
63
|
-
* If an index is given, the searching is skipped
|
|
64
|
-
* @param newFilter the new filter to add
|
|
65
|
-
* @param index a custom index
|
|
66
|
-
* @returns the index result object
|
|
67
|
-
*/
|
|
68
12
|
findLastIndexByFilter(newFilter: IFilter, index?: number): IFilterFindLastIndexReturn;
|
|
69
|
-
/**
|
|
70
|
-
* **************************************************************************************************
|
|
71
|
-
****************************************** Getters *************************************************
|
|
72
|
-
****************************************************************************************************
|
|
73
|
-
*/
|
|
74
|
-
/**
|
|
75
|
-
* Gets the filter collection
|
|
76
|
-
* @returns the collection of filters of the context
|
|
77
|
-
*/
|
|
78
13
|
getFilters(): IFilter[];
|
|
79
|
-
/**
|
|
80
|
-
* **************************************************************************************************
|
|
81
|
-
****************************************** Setters *************************************************
|
|
82
|
-
****************************************************************************************************
|
|
83
|
-
*/
|
|
84
|
-
/**
|
|
85
|
-
* Sets the filters
|
|
86
|
-
* @param filters the new collection of filters to set
|
|
87
|
-
*/
|
|
88
14
|
setFilters(filters: IFilter[]): void;
|
|
89
15
|
}
|
|
90
|
-
//# sourceMappingURL=FilterSearcher.d.ts.map
|
|
@@ -1,54 +1,24 @@
|
|
|
1
1
|
import { getLastIndexFromArray, isEmpty, isNaNV2, objectCopy, } from "@qrvey/utils";
|
|
2
2
|
import { getParamFiltersSettings } from "../helpers/filter-settings.helpers";
|
|
3
3
|
import { resolveFilterConditions } from "../helpers/resolveFilterConditions";
|
|
4
|
-
/**
|
|
5
|
-
* Class to search filters.
|
|
6
|
-
*/
|
|
7
4
|
export class FilterSearcher {
|
|
8
5
|
filters;
|
|
9
|
-
/**
|
|
10
|
-
* Constructor
|
|
11
|
-
* @param filters the collection of filters
|
|
12
|
-
*/
|
|
13
6
|
constructor(filters = []) {
|
|
14
7
|
this.filters = filters;
|
|
15
8
|
this.setFilters(Array.isArray(filters) ? filters : []);
|
|
16
9
|
}
|
|
17
|
-
/**
|
|
18
|
-
* **************************************************************************************************
|
|
19
|
-
**************************************** By Params *************************************************
|
|
20
|
-
****************************************************************************************************
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Searchs and excludes filters by the given params
|
|
24
|
-
* @param params params to exclude the filters
|
|
25
|
-
* @param settings settings for this function
|
|
26
|
-
* @returns the new collection of filters
|
|
27
|
-
*/
|
|
28
10
|
excludeByParams(params, settings) {
|
|
29
11
|
if (isEmpty(this.filters) || isEmpty(params))
|
|
30
12
|
return this.filters;
|
|
31
13
|
const completeSettings = getParamFiltersSettings(settings);
|
|
32
14
|
return this.filters.filter((filter) => !resolveFilterConditions(filter, params, completeSettings));
|
|
33
15
|
}
|
|
34
|
-
/**
|
|
35
|
-
* Searchs filters by the given params
|
|
36
|
-
* @param params params to search the filters
|
|
37
|
-
* @param settings settings for this function
|
|
38
|
-
* @returns the new collection of filters
|
|
39
|
-
*/
|
|
40
16
|
filterByParams(params, settings) {
|
|
41
17
|
if (isEmpty(this.filters) || isEmpty(params))
|
|
42
18
|
return this.filters;
|
|
43
19
|
const completeSettings = getParamFiltersSettings(settings);
|
|
44
20
|
return this.filters.filter((filter) => resolveFilterConditions(filter, params, completeSettings));
|
|
45
21
|
}
|
|
46
|
-
/**
|
|
47
|
-
* Searchs filters by the given params and returns the indexes
|
|
48
|
-
* @param params params to search the filters
|
|
49
|
-
* @param settings settings for this function
|
|
50
|
-
* @returns the new collection of filters
|
|
51
|
-
*/
|
|
52
22
|
filterIndexesByParams(params, settings) {
|
|
53
23
|
if (isEmpty(this.filters) || isEmpty(params))
|
|
54
24
|
return [];
|
|
@@ -61,42 +31,16 @@ export class FilterSearcher {
|
|
|
61
31
|
return indexes;
|
|
62
32
|
}, []);
|
|
63
33
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Searchs filters by the given params.
|
|
66
|
-
* Gets the first match of the searching
|
|
67
|
-
* @param params params to search the filters
|
|
68
|
-
* @param settings settings for this function
|
|
69
|
-
* @returns the new collection of filters
|
|
70
|
-
*/
|
|
71
34
|
findByParams(params, settings) {
|
|
72
35
|
if (isEmpty(this.filters) || isEmpty(params))
|
|
73
36
|
return undefined;
|
|
74
37
|
return this.filters.find((filter) => resolveFilterConditions(filter, params, getParamFiltersSettings(settings)));
|
|
75
38
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Searchs filters by the given params.
|
|
78
|
-
* Gets the first match of the searching and returns the related index
|
|
79
|
-
* @param params params to search the filters
|
|
80
|
-
* @param settings settings for this function
|
|
81
|
-
* @returns the new collection of filters
|
|
82
|
-
*/
|
|
83
39
|
findIndexByParams(params, settings) {
|
|
84
40
|
if (isEmpty(this.filters) || isEmpty(params))
|
|
85
41
|
return -1;
|
|
86
42
|
return this.filters.findIndex((filter) => resolveFilterConditions(filter, params, getParamFiltersSettings(settings)));
|
|
87
43
|
}
|
|
88
|
-
/**
|
|
89
|
-
* **************************************************************************************************
|
|
90
|
-
**************************************** By Filters *************************************************
|
|
91
|
-
****************************************************************************************************
|
|
92
|
-
*/
|
|
93
|
-
/**
|
|
94
|
-
* Gets an index where the new filter is going to be added
|
|
95
|
-
* If an index is given, the searching is skipped
|
|
96
|
-
* @param newFilter the new filter to add
|
|
97
|
-
* @param index a custom index
|
|
98
|
-
* @returns the index result object
|
|
99
|
-
*/
|
|
100
44
|
findLastIndexByFilter(newFilter, index = -1) {
|
|
101
45
|
const result = {
|
|
102
46
|
index: -1,
|
|
@@ -111,47 +55,26 @@ export class FilterSearcher {
|
|
|
111
55
|
return { ...result, index: this.filters.length - 1 };
|
|
112
56
|
if (newIndex > -1)
|
|
113
57
|
return { ...result, index: newIndex };
|
|
114
|
-
// Look index next to Scope - Dataset - column
|
|
115
58
|
let lastIndex = getLastIndexFromArray(this.filters, (aFilter) => aFilter.columnId === newFilter.columnId &&
|
|
116
59
|
aFilter.datasetId === newFilter.datasetId &&
|
|
117
60
|
aFilter.scope === newFilter.scope &&
|
|
118
61
|
aFilter.scopeId === newFilter.scopeId);
|
|
119
62
|
if (lastIndex > -1)
|
|
120
63
|
return { ...result, index: lastIndex, nextToColumnFilter: true };
|
|
121
|
-
// Look index next to Scope - Dataset
|
|
122
64
|
lastIndex = getLastIndexFromArray(this.filters, (aFilter) => aFilter.datasetId === newFilter.datasetId &&
|
|
123
65
|
aFilter.scope === newFilter.scope &&
|
|
124
66
|
aFilter.scopeId === newFilter.scopeId);
|
|
125
67
|
if (lastIndex > -1)
|
|
126
68
|
return { ...result, index: lastIndex, nextToDatasetFilter: true };
|
|
127
|
-
// Look index next to Scope
|
|
128
69
|
lastIndex = getLastIndexFromArray(this.filters, (aFilter) => aFilter.scope === newFilter.scope &&
|
|
129
70
|
aFilter.scopeId === newFilter.scopeId);
|
|
130
71
|
if (lastIndex > -1)
|
|
131
72
|
return { ...result, index: lastIndex, nextToScopeFilter: true };
|
|
132
73
|
return result;
|
|
133
74
|
}
|
|
134
|
-
/**
|
|
135
|
-
* **************************************************************************************************
|
|
136
|
-
****************************************** Getters *************************************************
|
|
137
|
-
****************************************************************************************************
|
|
138
|
-
*/
|
|
139
|
-
/**
|
|
140
|
-
* Gets the filter collection
|
|
141
|
-
* @returns the collection of filters of the context
|
|
142
|
-
*/
|
|
143
75
|
getFilters() {
|
|
144
76
|
return this.filters;
|
|
145
77
|
}
|
|
146
|
-
/**
|
|
147
|
-
* **************************************************************************************************
|
|
148
|
-
****************************************** Setters *************************************************
|
|
149
|
-
****************************************************************************************************
|
|
150
|
-
*/
|
|
151
|
-
/**
|
|
152
|
-
* Sets the filters
|
|
153
|
-
* @param filters the new collection of filters to set
|
|
154
|
-
*/
|
|
155
78
|
setFilters(filters) {
|
|
156
79
|
this.filters = objectCopy(filters);
|
|
157
80
|
}
|
|
@@ -1,58 +1,12 @@
|
|
|
1
|
+
import { IFilterValidator } from "../resources";
|
|
1
2
|
import { IColumnTypeWithGrouping } from "../resources/filter-grouping.resources";
|
|
2
3
|
import { IFilter } from "../resources/filters.resources";
|
|
3
|
-
import { IFilterValidator } from "../resources";
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
4
|
export declare class FilterValidation {
|
|
8
|
-
/**
|
|
9
|
-
* Validated if the given filter exists into the filter collection
|
|
10
|
-
* @param filters the collection of filters
|
|
11
|
-
* @param filter the filter to validate
|
|
12
|
-
* @returns True when the filter is duplicated in the collection
|
|
13
|
-
*/
|
|
14
5
|
static isDuplicated(filters: IFilter[], filter: IFilter): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Validates if the given regular value is duplicated with another value collection
|
|
17
|
-
* @param filter1 the filter info
|
|
18
|
-
* @param filter2 the filter info to compare
|
|
19
|
-
* @returns true when the value is duplicated
|
|
20
|
-
*/
|
|
21
6
|
static isFilterValueDuplicated(filter1: IFilter, filter2: IFilter): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Validates if the given regular value is duplicated with another value collection
|
|
24
|
-
* @param values1 the filter regular values collection
|
|
25
|
-
* @param values2 the filter regular values collection
|
|
26
|
-
* @returns true when the regular value is duplicated
|
|
27
|
-
*/
|
|
28
7
|
private static isFilterRegularValueDuplicated;
|
|
29
|
-
/**
|
|
30
|
-
* Validates if the given range value is duplicated with another value collection
|
|
31
|
-
* @param values1 the filter range values collection
|
|
32
|
-
* @param values2 the filter range values colleciton
|
|
33
|
-
* @returns true when the range value is duplicated
|
|
34
|
-
*/
|
|
35
8
|
private static isFilterRangeValueDuplicated;
|
|
36
|
-
/**
|
|
37
|
-
* Validates if the given relative value is duplicated with another value collection
|
|
38
|
-
* @param values1 the filter relative values collection
|
|
39
|
-
* @param values2 the filter relative values collection
|
|
40
|
-
* @returns true when the relative value is duplicated
|
|
41
|
-
*/
|
|
42
9
|
private static isFilterRelativeValueDuplicated;
|
|
43
|
-
/**
|
|
44
|
-
* Validates if the given ranking value is duplicated with another value collection
|
|
45
|
-
* @param _values1 the filter ranking values collection
|
|
46
|
-
* @param _values2 the filter ranking values collection
|
|
47
|
-
* @returns true when the ranking value is duplicated
|
|
48
|
-
*/
|
|
49
10
|
private static isFilterRankingValueDuplicated;
|
|
50
|
-
/**
|
|
51
|
-
* Validates if the grouping is valid to set for the given params
|
|
52
|
-
* @param columnType the column type
|
|
53
|
-
* @param validator the filter validator
|
|
54
|
-
* @returns true when the grouping is valid
|
|
55
|
-
*/
|
|
56
11
|
static isGroupingValid(columnType: IColumnTypeWithGrouping, validator: IFilterValidator): boolean;
|
|
57
12
|
}
|
|
58
|
-
//# sourceMappingURL=FilterValidation.d.ts.map
|