@qrvey/filters 0.0.28 → 0.0.30
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/CHANGELOG.md +13 -0
- package/dist/cjs/classes/FilterBuilder.d.ts +18 -12
- package/dist/cjs/classes/FilterBuilder.d.ts.map +1 -1
- package/dist/cjs/classes/FilterBuilder.js +48 -22
- package/dist/cjs/classes/FilterSearcher.d.ts +1 -1
- package/dist/cjs/classes/FilterSearcher.js +1 -1
- package/dist/cjs/classes/FilterValues.d.ts +33 -0
- package/dist/cjs/classes/FilterValues.d.ts.map +1 -0
- package/dist/cjs/classes/FilterValues.js +67 -0
- package/dist/cjs/classes/index.d.ts +1 -0
- package/dist/cjs/classes/index.d.ts.map +1 -1
- package/dist/cjs/classes/index.js +1 -0
- package/dist/cjs/helpers/filter-settings.helpers.d.ts +26 -7
- package/dist/cjs/helpers/filter-settings.helpers.d.ts.map +1 -1
- package/dist/cjs/helpers/filter-settings.helpers.js +57 -18
- package/dist/cjs/models/filter-builder.models.d.ts +15 -11
- package/dist/cjs/models/filter-builder.models.d.ts.map +1 -1
- package/dist/cjs/resources/filter-functions.resources.d.ts +45 -0
- package/dist/cjs/resources/filter-functions.resources.d.ts.map +1 -1
- package/dist/cjs/resources/filter-functions.resources.js +9 -1
- package/dist/classes/FilterBuilder.d.ts +18 -12
- package/dist/classes/FilterBuilder.d.ts.map +1 -1
- package/dist/classes/FilterBuilder.js +50 -24
- package/dist/classes/FilterSearcher.d.ts +1 -1
- package/dist/classes/FilterSearcher.js +1 -1
- package/dist/classes/FilterValues.d.ts +33 -0
- package/dist/classes/FilterValues.d.ts.map +1 -0
- package/dist/classes/FilterValues.js +63 -0
- package/dist/classes/index.d.ts +1 -0
- package/dist/classes/index.d.ts.map +1 -1
- package/dist/classes/index.js +1 -0
- package/dist/helpers/filter-settings.helpers.d.ts +26 -7
- package/dist/helpers/filter-settings.helpers.d.ts.map +1 -1
- package/dist/helpers/filter-settings.helpers.js +53 -17
- package/dist/models/filter-builder.models.d.ts +15 -11
- package/dist/models/filter-builder.models.d.ts.map +1 -1
- package/dist/resources/filter-functions.resources.d.ts +45 -0
- package/dist/resources/filter-functions.resources.d.ts.map +1 -1
- package/dist/resources/filter-functions.resources.js +8 -0
- package/package.json +2 -2
- package/src/classes/FilterBuilder.ts +101 -31
- package/src/classes/FilterSearcher.ts +1 -1
- package/src/classes/FilterValues.ts +89 -0
- package/src/classes/index.ts +1 -0
- package/src/helpers/filter-settings.helpers.ts +75 -22
- package/src/models/filter-builder.models.ts +25 -11
- package/src/resources/filter-functions.resources.ts +57 -0
- package/tests/classes/FilterBuilder.test.ts +154 -16
package/CHANGELOG.md
CHANGED
|
@@ -4,8 +4,21 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [v0.0.30](https://bitbucket.org/qrvey/qrvey_filters/compare/v0.0.30..v0.0.29)
|
|
8
|
+
|
|
9
|
+
- fix: added new config to order the given filters manually [`#7`](https://bitbucket.org/qrvey/qrvey_filters/pull-requests/7)
|
|
10
|
+
|
|
11
|
+
#### [v0.0.29](https://bitbucket.org/qrvey/qrvey_filters/compare/v0.0.29..v0.0.28)
|
|
12
|
+
|
|
13
|
+
> 7 February 2025
|
|
14
|
+
|
|
15
|
+
- fix: adjusted addFilter module to change the operator based on the new criteria [`#6`](https://bitbucket.org/qrvey/qrvey_filters/pull-requests/6)
|
|
16
|
+
- chore :upgraded Qrvey Utils to latest version [`87be141`](https://bitbucket.org/qrvey/qrvey_filters/commits/87be141d628b77607b0daa50e5e5d371a0892650)
|
|
17
|
+
|
|
7
18
|
#### [v0.0.28](https://bitbucket.org/qrvey/qrvey_filters/compare/v0.0.28..v0.0.27)
|
|
8
19
|
|
|
20
|
+
> 10 January 2025
|
|
21
|
+
|
|
9
22
|
- chore: update qrvey utils to latest version [`#5`](https://bitbucket.org/qrvey/qrvey_filters/pull-requests/5)
|
|
10
23
|
|
|
11
24
|
#### [v0.0.27](https://bitbucket.org/qrvey/qrvey_filters/compare/v0.0.27..v0.0.23)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IFilterBuilderAdd, IFilterBuilderAddValue, IFilterBuilderDelete, IFilterBuilderDeleteValue, IFilterBuilderEdit, IFilterBuilderEditValue, IFilterBuilderMerge, IFilterBuilderMergeValue, IFilterBuilderMultipleReturn, IFilterBuilderSet, IFilterBuilderSingleReturn } from "../models/filter-builder.models";
|
|
2
|
-
import { IFilterBuilderEditSettings, IFilterParamSettings } from "../resources/filter-functions.resources";
|
|
2
|
+
import { IFilterAddSettings, IFilterBuilderEditSettings, IFilterCreateSettings, IFilterMergeSettings, IFilterParamSettings, IFilterReplaceParamSettings } from "../resources/filter-functions.resources";
|
|
3
3
|
import { IFilterValue } from "../resources/filter-values.resources";
|
|
4
4
|
import { IFilter } from "../resources/filters.resources";
|
|
5
5
|
/**
|
|
@@ -25,19 +25,23 @@ export declare class FilterBuilder implements IFilterBuilderAdd, IFilterBuilderA
|
|
|
25
25
|
* Adds various filter into the collection.
|
|
26
26
|
* Inserts them next to the last similar filter
|
|
27
27
|
* @param newFilters the filter to add
|
|
28
|
-
* @param
|
|
28
|
+
* @param inIndexes collection of indexes to add the new filters
|
|
29
|
+
* @param settings the settings object to setup this function
|
|
29
30
|
* @returns the new collection of filters
|
|
30
31
|
*/
|
|
31
|
-
|
|
32
|
+
addMultiple(newFilters: IFilter[], inIndexes?: number[], settings?: IFilterAddSettings): IFilterBuilderMultipleReturn;
|
|
32
33
|
/**
|
|
33
34
|
* Adds one filter into the collection.
|
|
34
35
|
* - Inserts it next to the last similar filter
|
|
36
|
+
* - If the new one is match with the last similar filter, the operator will change to OR
|
|
35
37
|
* - If the id is not provided, a new one is created.
|
|
38
|
+
* - If the inIndex nunber is provided, this will be the index where the filter is inserted
|
|
36
39
|
* @param filter the filter to add
|
|
37
|
-
* @param
|
|
40
|
+
* @param inIndex the index to add the new filter
|
|
41
|
+
* @param settings settings object to setup this function
|
|
38
42
|
* @returns the new collection of filters
|
|
39
43
|
*/
|
|
40
|
-
addSingle(filter: IFilter,
|
|
44
|
+
addSingle(filter: IFilter, inIndex?: number, settings?: IFilterAddSettings): IFilterBuilderSingleReturn;
|
|
41
45
|
/**
|
|
42
46
|
* Adds one value from filter
|
|
43
47
|
* @param id the ID to search the filter to add value
|
|
@@ -69,7 +73,7 @@ export declare class FilterBuilder implements IFilterBuilderAdd, IFilterBuilderA
|
|
|
69
73
|
* @param ids a collection of ID to search filters to remove
|
|
70
74
|
* @returns the new filter collection
|
|
71
75
|
*/
|
|
72
|
-
|
|
76
|
+
deleteMultiple(ids: string[]): IFilterBuilderMultipleReturn;
|
|
73
77
|
/**
|
|
74
78
|
* Removes one filter from the collection
|
|
75
79
|
* @param id the ID to search the filter to remove
|
|
@@ -102,7 +106,7 @@ export declare class FilterBuilder implements IFilterBuilderAdd, IFilterBuilderA
|
|
|
102
106
|
* @param settings settings object for the function
|
|
103
107
|
* @returns the new filter collection
|
|
104
108
|
*/
|
|
105
|
-
|
|
109
|
+
editMultiple(ids: string[], filters: Partial<IFilter>[], settings?: IFilterBuilderEditSettings): IFilterBuilderMultipleReturn;
|
|
106
110
|
/**
|
|
107
111
|
* Edits one filter from the collection
|
|
108
112
|
* @param id the ID to search the filter to edit
|
|
@@ -135,15 +139,17 @@ export declare class FilterBuilder implements IFilterBuilderAdd, IFilterBuilderA
|
|
|
135
139
|
/**
|
|
136
140
|
* Merge the filter into the collection by some filter parameters
|
|
137
141
|
* @param filter the filter to merge
|
|
142
|
+
* @param settings the settings object to setup this function
|
|
138
143
|
* @returns the new filter collection
|
|
139
144
|
*/
|
|
140
|
-
mergeSingle(filter: IFilter): IFilterBuilderSingleReturn;
|
|
145
|
+
mergeSingle(filter: IFilter, settings?: IFilterMergeSettings): IFilterBuilderSingleReturn;
|
|
141
146
|
/**
|
|
142
147
|
* Merge the filters into the collection by some filter parameters
|
|
143
148
|
* @param filters the filter collection to merge
|
|
149
|
+
* @param settings the settings object to setup this function
|
|
144
150
|
* @returns the new filter collection
|
|
145
151
|
*/
|
|
146
|
-
|
|
152
|
+
mergeMultiple(filters: IFilter[], settings?: IFilterMergeSettings): IFilterBuilderMultipleReturn;
|
|
147
153
|
/**
|
|
148
154
|
* Merge values from filter
|
|
149
155
|
* @param id the ID to search the filter to merge values
|
|
@@ -159,10 +165,10 @@ export declare class FilterBuilder implements IFilterBuilderAdd, IFilterBuilderA
|
|
|
159
165
|
/**
|
|
160
166
|
* Builds an filter structure based on given params
|
|
161
167
|
* @param filter the partial filter params
|
|
162
|
-
* @param
|
|
168
|
+
* @param settings the settings object to setup this function
|
|
163
169
|
* @returns the complete filter structure
|
|
164
170
|
*/
|
|
165
|
-
static createFilter(filter: Partial<IFilter>,
|
|
171
|
+
static createFilter(filter: Partial<IFilter>, settings?: IFilterCreateSettings): IFilter;
|
|
166
172
|
/**
|
|
167
173
|
* Sets the given filters by param
|
|
168
174
|
* - Remove the filters by the sucesfull conditions and replace the given ones
|
|
@@ -171,7 +177,7 @@ export declare class FilterBuilder implements IFilterBuilderAdd, IFilterBuilderA
|
|
|
171
177
|
* @param settings settings for this function
|
|
172
178
|
* @returns the new collection of filters
|
|
173
179
|
*/
|
|
174
|
-
replaceByParams(filters: IFilter[], params: Partial<IFilter>, settings?:
|
|
180
|
+
replaceByParams(filters: IFilter[], params: Partial<IFilter>, settings?: IFilterReplaceParamSettings): IFilterBuilderMultipleReturn;
|
|
175
181
|
/**
|
|
176
182
|
* Method to sync the Filter instances
|
|
177
183
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBuilder.d.ts","sourceRoot":"","sources":["../../../src/classes/FilterBuilder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilterBuilder.d.ts","sourceRoot":"","sources":["../../../src/classes/FilterBuilder.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,4BAA4B,EAC5B,iBAAiB,EACjB,0BAA0B,EAC3B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,2BAA2B,EAC5B,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACL,YAAY,EAIb,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAGL,OAAO,EACR,MAAM,gCAAgC,CAAC;AAExC;;GAEG;AACH,qBAAa,aACX,YACE,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB;IAWP,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE;IATxC;;OAEG;IACH,OAAO,CAAC,YAAY,CAAiB;IAErC;;;OAGG;gBACmB,OAAO,GAAE,OAAO,EAAO;IAK7C;;;;OAIG;IAEH;;;;;;;OAOG;IACI,WAAW,CAChB,UAAU,EAAE,OAAO,EAAE,EACrB,SAAS,CAAC,EAAE,MAAM,EAAE,EACpB,QAAQ,CAAC,EAAE,kBAAkB,GAC5B,4BAA4B;IA2B/B;;;;;;;;;;OAUG;IACI,SAAS,CACd,MAAM,EAAE,OAAO,EACf,OAAO,CAAC,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,kBAAkB,GAC5B,0BAA0B;IAyC7B;;;;;OAKG;IACI,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,0BAA0B;IAiB5E;;;;;OAKG;IACI,SAAS,CACd,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,YAAY,EAAE,GACrB,0BAA0B;IAyB7B;;;;OAIG;IAEH;;;;;OAKG;IACI,cAAc,CACnB,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,EACxB,QAAQ,CAAC,EAAE,oBAAoB,GAC9B,4BAA4B;IAgB/B;;;;OAIG;IACI,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,4BAA4B;IAuBlE;;;;OAIG;IACI,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,0BAA0B;IAiB3D;;;;;OAKG;IACI,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,0BAA0B;IAsBzE;;;;;OAKG;IACI,YAAY,CACjB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EAAE,GAChB,0BAA0B;IA6B7B;;;;OAIG;IAEH;;;;;;OAMG;IACI,YAAY,CACjB,GAAG,EAAE,MAAM,EAAE,EACb,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,EAC3B,QAAQ,CAAC,EAAE,0BAA0B,GACpC,4BAA4B;IAgC/B;;;;;;OAMG;IACI,UAAU,CACf,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,EACxB,QAAQ,CAAC,EAAE,0BAA0B,GACpC,0BAA0B;IAyB7B;;;;;;OAMG;IACH,SAAS,CACP,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,YAAY,EACnB,KAAK,EAAE,MAAM,GACZ,0BAA0B;IAsB7B;;;;;;OAMG;IACI,UAAU,CACf,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,YAAY,EAAE,EACtB,OAAO,EAAE,MAAM,EAAE,GAChB,0BAA0B;IA6B7B;;;;OAIG;IAEH;;;;;OAKG;IACI,WAAW,CAChB,MAAM,EAAE,OAAO,EACf,QAAQ,CAAC,EAAE,oBAAoB,GAC9B,0BAA0B;IAqC7B;;;;;OAKG;IACI,aAAa,CAClB,OAAO,EAAE,OAAO,EAAE,EAClB,QAAQ,CAAC,EAAE,oBAAoB,GAC9B,4BAA4B;IA2B/B;;;;;OAKG;IACI,WAAW,CAChB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,YAAY,EAAE,GAAG,SAAS,GACjC,0BAA0B;IAiD7B;;;;OAIG;IAEH;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CACjB,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,EACxB,QAAQ,CAAC,EAAE,qBAAqB,GAC/B,OAAO;IA0CV;;;;;;;OAOG;IACI,eAAe,CACpB,OAAO,EAAE,OAAO,EAAE,EAClB,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,EACxB,QAAQ,CAAC,EAAE,2BAA2B,GACrC,4BAA4B;IAqB/B;;OAEG;IACH,OAAO,CAAC,IAAI;IAIZ;;;;OAIG;IAEH;;;OAGG;IACI,UAAU,IAAI,OAAO,EAAE;IAI9B;;;;OAIG;IAEH;;;OAGG;IACI,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,IAAI;CAI5C"}
|
|
@@ -4,9 +4,11 @@ exports.FilterBuilder = void 0;
|
|
|
4
4
|
const utils_1 = require("@qrvey/utils");
|
|
5
5
|
const FilterSearcher_1 = require("./FilterSearcher");
|
|
6
6
|
const FilterValidation_1 = require("./FilterValidation");
|
|
7
|
+
const FilterValues_1 = require("./FilterValues");
|
|
7
8
|
const filter_settings_helpers_1 = require("../helpers/filter-settings.helpers");
|
|
8
9
|
const getFilterId_1 = require("../helpers/getFilterId");
|
|
9
10
|
const getFilterType_1 = require("../helpers/getFilterType");
|
|
11
|
+
const filter_operators_resources_1 = require("../resources/filter-operators.resources");
|
|
10
12
|
const filters_resources_1 = require("../resources/filters.resources");
|
|
11
13
|
/**
|
|
12
14
|
* Class to build new filters and manipulate ones.
|
|
@@ -35,17 +37,18 @@ class FilterBuilder {
|
|
|
35
37
|
* Adds various filter into the collection.
|
|
36
38
|
* Inserts them next to the last similar filter
|
|
37
39
|
* @param newFilters the filter to add
|
|
38
|
-
* @param
|
|
40
|
+
* @param inIndexes collection of indexes to add the new filters
|
|
41
|
+
* @param settings the settings object to setup this function
|
|
39
42
|
* @returns the new collection of filters
|
|
40
43
|
*/
|
|
41
|
-
|
|
44
|
+
addMultiple(newFilters, inIndexes, settings) {
|
|
42
45
|
if ((0, utils_1.isEmpty)(newFilters))
|
|
43
46
|
return { resulting: this.filters };
|
|
44
47
|
const filters = (0, utils_1.objectCopy)(this.filters);
|
|
45
48
|
const affected = [];
|
|
46
49
|
try {
|
|
47
|
-
newFilters.forEach((newFilter) => {
|
|
48
|
-
const affectedFilter = this.addSingle(newFilter,
|
|
50
|
+
newFilters.forEach((newFilter, index) => {
|
|
51
|
+
const affectedFilter = this.addSingle(newFilter, inIndexes?.[index], settings);
|
|
49
52
|
affected.push(affectedFilter.affected);
|
|
50
53
|
});
|
|
51
54
|
}
|
|
@@ -63,26 +66,35 @@ class FilterBuilder {
|
|
|
63
66
|
/**
|
|
64
67
|
* Adds one filter into the collection.
|
|
65
68
|
* - Inserts it next to the last similar filter
|
|
69
|
+
* - If the new one is match with the last similar filter, the operator will change to OR
|
|
66
70
|
* - If the id is not provided, a new one is created.
|
|
71
|
+
* - If the inIndex nunber is provided, this will be the index where the filter is inserted
|
|
67
72
|
* @param filter the filter to add
|
|
68
|
-
* @param
|
|
73
|
+
* @param inIndex the index to add the new filter
|
|
74
|
+
* @param settings settings object to setup this function
|
|
69
75
|
* @returns the new collection of filters
|
|
70
76
|
*/
|
|
71
|
-
addSingle(filter,
|
|
77
|
+
addSingle(filter, inIndex, settings) {
|
|
72
78
|
if ((0, utils_1.isEmpty)(filter))
|
|
73
79
|
return { resulting: this.filters };
|
|
74
80
|
if (FilterValidation_1.FilterValidation.isDuplicated(this.filters, filter))
|
|
75
81
|
return { resulting: this.filters };
|
|
76
82
|
const original = { ...filter };
|
|
77
83
|
const newFilter = { ...filter };
|
|
78
|
-
|
|
84
|
+
const newSettings = (0, filter_settings_helpers_1.getFilterAddSettings)(settings);
|
|
85
|
+
const newInIndex = (0, utils_1.isNaNV2)(inIndex) ? -1 : inIndex;
|
|
86
|
+
if ((0, utils_1.isEmpty)(filter.id) || newSettings.automaticId)
|
|
79
87
|
newFilter.id = (0, getFilterId_1.getFilterId)(newFilter);
|
|
80
|
-
const lastIndex =
|
|
81
|
-
aFilter.
|
|
82
|
-
|
|
83
|
-
|
|
88
|
+
const lastIndex = newInIndex === -1
|
|
89
|
+
? (0, utils_1.getLastIndexFromArray)(this.filters, (aFilter) => aFilter.columnId === newFilter.columnId &&
|
|
90
|
+
aFilter.datasetId === newFilter.datasetId &&
|
|
91
|
+
aFilter.scope === newFilter.scope &&
|
|
92
|
+
aFilter.scopeId === newFilter.scopeId)
|
|
93
|
+
: newInIndex - 1;
|
|
84
94
|
if (lastIndex > -1) {
|
|
85
95
|
this.filters.splice(lastIndex + 1, 0, newFilter);
|
|
96
|
+
if (newSettings.automaticOperator)
|
|
97
|
+
this.filters[lastIndex].operator = filter_operators_resources_1.FILTER_OPERATOR.OR;
|
|
86
98
|
}
|
|
87
99
|
else {
|
|
88
100
|
this.filters.push(newFilter);
|
|
@@ -171,7 +183,7 @@ class FilterBuilder {
|
|
|
171
183
|
* @param ids a collection of ID to search filters to remove
|
|
172
184
|
* @returns the new filter collection
|
|
173
185
|
*/
|
|
174
|
-
|
|
186
|
+
deleteMultiple(ids) {
|
|
175
187
|
if (!Array.isArray(ids))
|
|
176
188
|
return { resulting: this.filters };
|
|
177
189
|
const filters = (0, utils_1.objectCopy)(this.filters);
|
|
@@ -280,7 +292,7 @@ class FilterBuilder {
|
|
|
280
292
|
* @param settings settings object for the function
|
|
281
293
|
* @returns the new filter collection
|
|
282
294
|
*/
|
|
283
|
-
|
|
295
|
+
editMultiple(ids, filters, settings) {
|
|
284
296
|
if (!Array.isArray(ids) ||
|
|
285
297
|
!Array.isArray(filters) ||
|
|
286
298
|
ids.length !== filters.length)
|
|
@@ -395,9 +407,10 @@ class FilterBuilder {
|
|
|
395
407
|
/**
|
|
396
408
|
* Merge the filter into the collection by some filter parameters
|
|
397
409
|
* @param filter the filter to merge
|
|
410
|
+
* @param settings the settings object to setup this function
|
|
398
411
|
* @returns the new filter collection
|
|
399
412
|
*/
|
|
400
|
-
mergeSingle(filter) {
|
|
413
|
+
mergeSingle(filter, settings) {
|
|
401
414
|
if ((0, utils_1.isEmpty)(filter))
|
|
402
415
|
return { resulting: this.filters };
|
|
403
416
|
const filterIndex = this.searchEngine.findIndexByParams({
|
|
@@ -416,7 +429,7 @@ class FilterBuilder {
|
|
|
416
429
|
affected = affectedMergeFilter;
|
|
417
430
|
}
|
|
418
431
|
else {
|
|
419
|
-
const { affected: affectedAddSingle } = this.addSingle(filter);
|
|
432
|
+
const { affected: affectedAddSingle } = this.addSingle(filter, undefined, settings);
|
|
420
433
|
affected = affectedAddSingle;
|
|
421
434
|
}
|
|
422
435
|
return {
|
|
@@ -428,16 +441,17 @@ class FilterBuilder {
|
|
|
428
441
|
/**
|
|
429
442
|
* Merge the filters into the collection by some filter parameters
|
|
430
443
|
* @param filters the filter collection to merge
|
|
444
|
+
* @param settings the settings object to setup this function
|
|
431
445
|
* @returns the new filter collection
|
|
432
446
|
*/
|
|
433
|
-
|
|
447
|
+
mergeMultiple(filters, settings) {
|
|
434
448
|
if (!Array.isArray(filters) || (0, utils_1.isEmpty)(filters))
|
|
435
449
|
return { resulting: this.filters };
|
|
436
450
|
const originalFilters = (0, utils_1.objectCopy)(this.filters);
|
|
437
451
|
const mergedFilters = [];
|
|
438
452
|
try {
|
|
439
453
|
filters.forEach((filter) => {
|
|
440
|
-
const mergedFilter = this.mergeSingle(filter);
|
|
454
|
+
const mergedFilter = this.mergeSingle(filter, settings);
|
|
441
455
|
mergedFilters.push(mergedFilter.affected);
|
|
442
456
|
});
|
|
443
457
|
}
|
|
@@ -504,10 +518,11 @@ class FilterBuilder {
|
|
|
504
518
|
/**
|
|
505
519
|
* Builds an filter structure based on given params
|
|
506
520
|
* @param filter the partial filter params
|
|
507
|
-
* @param
|
|
521
|
+
* @param settings the settings object to setup this function
|
|
508
522
|
* @returns the complete filter structure
|
|
509
523
|
*/
|
|
510
|
-
static createFilter(filter,
|
|
524
|
+
static createFilter(filter, settings) {
|
|
525
|
+
const newSettings = (0, filter_settings_helpers_1.getFilterCreateSettings)(settings);
|
|
511
526
|
const newFilter = {
|
|
512
527
|
...filters_resources_1.DEFAULT_FILTER,
|
|
513
528
|
aggregateType: filter.aggregateType ?? filters_resources_1.DEFAULT_FILTER.aggregateType,
|
|
@@ -530,8 +545,12 @@ class FilterBuilder {
|
|
|
530
545
|
selectAll: filter.selectAll ?? filters_resources_1.DEFAULT_FILTER.selectAll,
|
|
531
546
|
values: filter.values || filters_resources_1.DEFAULT_FILTER.values,
|
|
532
547
|
};
|
|
533
|
-
if ((0, utils_1.isEmpty)(filter.id) || automaticId)
|
|
548
|
+
if ((0, utils_1.isEmpty)(filter.id) || newSettings.automaticId)
|
|
534
549
|
newFilter.id = (0, getFilterId_1.getFilterId)(newFilter);
|
|
550
|
+
if (!(0, utils_1.isEmpty)(newSettings.rawValues)) {
|
|
551
|
+
const filterType = (0, getFilterType_1.getFilterType)(newFilter.columnType, newFilter.validator);
|
|
552
|
+
newFilter.values = FilterValues_1.FilterValues.getFilterValues(filterType, newSettings.rawValues);
|
|
553
|
+
}
|
|
535
554
|
return newFilter;
|
|
536
555
|
}
|
|
537
556
|
/**
|
|
@@ -544,8 +563,15 @@ class FilterBuilder {
|
|
|
544
563
|
*/
|
|
545
564
|
replaceByParams(filters, params, settings) {
|
|
546
565
|
const original = (0, utils_1.objectCopy)(this.filters);
|
|
547
|
-
|
|
548
|
-
|
|
566
|
+
const newSettings = (0, filter_settings_helpers_1.getReplaceByParamsSettings)(settings);
|
|
567
|
+
let filterIndexes = undefined;
|
|
568
|
+
if (newSettings.addingInSameIndex) {
|
|
569
|
+
filterIndexes = this.searchEngine.filterIndexesByParams(params, settings);
|
|
570
|
+
if ((0, utils_1.isEmpty)(filterIndexes))
|
|
571
|
+
filterIndexes = undefined;
|
|
572
|
+
}
|
|
573
|
+
this.filters = this.searchEngine.excludeByParams(params, newSettings);
|
|
574
|
+
const resulting = this.addMultiple(filters, filterIndexes, newSettings);
|
|
549
575
|
this.sync();
|
|
550
576
|
return {
|
|
551
577
|
resulting: this.filters,
|
|
@@ -31,7 +31,7 @@ export declare class FilterSearcher implements IFilterSearcherParams {
|
|
|
31
31
|
*/
|
|
32
32
|
filterByParams(params: Partial<IFilter>, settings?: IFilterParamSettings): IFilter[];
|
|
33
33
|
/**
|
|
34
|
-
* Searchs filters by the given params and returns the
|
|
34
|
+
* Searchs filters by the given params and returns the indexes
|
|
35
35
|
* @param params params to search the filters
|
|
36
36
|
* @param settings settings for this function
|
|
37
37
|
* @returns the new collection of filters
|
|
@@ -47,7 +47,7 @@ class FilterSearcher {
|
|
|
47
47
|
return this.filters.filter((filter) => (0, resolveFilterConditions_1.resolveFilterConditions)(filter, params, completeSettings));
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
|
-
* Searchs filters by the given params and returns the
|
|
50
|
+
* Searchs filters by the given params and returns the indexes
|
|
51
51
|
* @param params params to search the filters
|
|
52
52
|
* @param settings settings for this function
|
|
53
53
|
* @returns the new collection of filters
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { IFilterInputValue, IFilterInputValueRange, IFilterInputValueRegular, IFilterInputValueRelativeDate, IFilterValueRange, IFilterValueRegular, IFilterValueRelativeDate } from "../resources/filter-values.resources";
|
|
2
|
+
import { IFilterType } from "../resources/filters.resources";
|
|
3
|
+
/**
|
|
4
|
+
* Class to manipulate filter values and input values
|
|
5
|
+
*/
|
|
6
|
+
export declare class FilterValues {
|
|
7
|
+
/**
|
|
8
|
+
* Gets the Filter Values based on Regular Input values
|
|
9
|
+
* @param values the regular input values
|
|
10
|
+
* @returns the Filter Regular Values
|
|
11
|
+
*/
|
|
12
|
+
static getFilterRegularValues(values?: IFilterInputValueRegular[]): IFilterValueRegular[];
|
|
13
|
+
/**
|
|
14
|
+
* Gets the Filter Values based on Range Input values
|
|
15
|
+
* @param values the range input values
|
|
16
|
+
* @returns the Filter Range Values
|
|
17
|
+
*/
|
|
18
|
+
static getFilterRangeValues(values?: IFilterInputValueRange[]): IFilterValueRange[];
|
|
19
|
+
/**
|
|
20
|
+
* Gets the Filter Values based on Relative Input values
|
|
21
|
+
* @param values the relative range input value
|
|
22
|
+
* @returns the Filter Relative Value
|
|
23
|
+
*/
|
|
24
|
+
static getFilterRelativeValues(values?: IFilterInputValueRelativeDate[]): IFilterValueRelativeDate[];
|
|
25
|
+
/**
|
|
26
|
+
* Gets the Filter Values based on the flter type
|
|
27
|
+
* @param filterType the filter type
|
|
28
|
+
* @param values the input values
|
|
29
|
+
* @returns the Filter Values
|
|
30
|
+
*/
|
|
31
|
+
static getFilterValues(filterType: IFilterType, values?: IFilterInputValue[]): IFilterValueRegular[];
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=FilterValues.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterValues.d.ts","sourceRoot":"","sources":["../../../src/classes/FilterValues.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,6BAA6B,EAC7B,iBAAiB,EACjB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAe,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE1E;;GAEG;AACH,qBAAa,YAAY;IACvB;;;;OAIG;WACW,sBAAsB,CAClC,MAAM,GAAE,wBAAwB,EAAO,GACtC,mBAAmB,EAAE;IAQxB;;;;OAIG;WACW,oBAAoB,CAChC,MAAM,GAAE,sBAAsB,EAAO,GACpC,iBAAiB,EAAE;IAStB;;;;OAIG;WACW,uBAAuB,CACnC,MAAM,GAAE,6BAA6B,EAAO,GAC3C,wBAAwB,EAAE;IAQ7B;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CACpB,UAAU,EAAE,WAAW,EACvB,MAAM,GAAE,iBAAiB,EAAO,GAC/B,mBAAmB,EAAE;CAkBzB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterValues = void 0;
|
|
4
|
+
const filters_resources_1 = require("../resources/filters.resources");
|
|
5
|
+
/**
|
|
6
|
+
* Class to manipulate filter values and input values
|
|
7
|
+
*/
|
|
8
|
+
class FilterValues {
|
|
9
|
+
/**
|
|
10
|
+
* Gets the Filter Values based on Regular Input values
|
|
11
|
+
* @param values the regular input values
|
|
12
|
+
* @returns the Filter Regular Values
|
|
13
|
+
*/
|
|
14
|
+
static getFilterRegularValues(values = []) {
|
|
15
|
+
return values.map((value) => ({
|
|
16
|
+
displayed: true,
|
|
17
|
+
enabled: true,
|
|
18
|
+
value: `${value}`,
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Gets the Filter Values based on Range Input values
|
|
23
|
+
* @param values the range input values
|
|
24
|
+
* @returns the Filter Range Values
|
|
25
|
+
*/
|
|
26
|
+
static getFilterRangeValues(values = []) {
|
|
27
|
+
return values.map((value) => ({
|
|
28
|
+
displayed: true,
|
|
29
|
+
enabled: true,
|
|
30
|
+
max: value.max,
|
|
31
|
+
min: value.min,
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Gets the Filter Values based on Relative Input values
|
|
36
|
+
* @param values the relative range input value
|
|
37
|
+
* @returns the Filter Relative Value
|
|
38
|
+
*/
|
|
39
|
+
static getFilterRelativeValues(values = []) {
|
|
40
|
+
return values.map((value) => ({
|
|
41
|
+
displayed: true,
|
|
42
|
+
enabled: true,
|
|
43
|
+
...value,
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Gets the Filter Values based on the flter type
|
|
48
|
+
* @param filterType the filter type
|
|
49
|
+
* @param values the input values
|
|
50
|
+
* @returns the Filter Values
|
|
51
|
+
*/
|
|
52
|
+
static getFilterValues(filterType, values = []) {
|
|
53
|
+
switch (filterType) {
|
|
54
|
+
case filters_resources_1.FILTER_TYPE.REGULAR:
|
|
55
|
+
return FilterValues.getFilterRegularValues(values);
|
|
56
|
+
case filters_resources_1.FILTER_TYPE.RANGE:
|
|
57
|
+
return FilterValues.getFilterRangeValues(values);
|
|
58
|
+
case filters_resources_1.FILTER_TYPE.RELATIVE:
|
|
59
|
+
return FilterValues.getFilterRelativeValues(values);
|
|
60
|
+
case filters_resources_1.FILTER_TYPE.NULL:
|
|
61
|
+
return [];
|
|
62
|
+
default:
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.FilterValues = FilterValues;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/classes/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/classes/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
|
|
@@ -1,23 +1,42 @@
|
|
|
1
|
-
import { IFilterBuilderEditSettings, IFilterGroupingInfoListByColumnSettings, IFilterParamSettings } from "../resources/filter-functions.resources";
|
|
1
|
+
import { IFilterAddSettings, IFilterBuilderEditSettings, IFilterCreateSettings, IFilterGroupingInfoListByColumnSettings, IFilterParamSettings, IFilterReplaceParamSettings } from "../resources/filter-functions.resources";
|
|
2
2
|
/**
|
|
3
|
-
* Gets a complete settings for the
|
|
3
|
+
* Gets a complete settings for the edit filters settings
|
|
4
4
|
* - Fills the missing properties with default ones
|
|
5
5
|
* @param settings the settings
|
|
6
6
|
* @returns the complete settings
|
|
7
7
|
*/
|
|
8
|
-
export declare function
|
|
8
|
+
export declare function getEditFiltersSettings(settings?: IFilterBuilderEditSettings): IFilterBuilderEditSettings;
|
|
9
9
|
/**
|
|
10
|
-
* Gets a complete settings for the
|
|
10
|
+
* Gets a complete settings for the filter-create settings
|
|
11
|
+
* @param settings the filter-create settings
|
|
12
|
+
* @returns the complete filter-create settings
|
|
13
|
+
*/
|
|
14
|
+
export declare function getFilterAddSettings(settings?: IFilterAddSettings): IFilterAddSettings;
|
|
15
|
+
/**
|
|
16
|
+
* Gets a complete settings for the filter-create settings
|
|
17
|
+
* @param settings the filter-create settings
|
|
18
|
+
* @returns the complete filter-create settings
|
|
19
|
+
*/
|
|
20
|
+
export declare function getFilterCreateSettings(settings?: IFilterCreateSettings): IFilterCreateSettings;
|
|
21
|
+
/**
|
|
22
|
+
* Gets a complete settings for the info grouping by column settings
|
|
11
23
|
* - Fills the missing properties with default ones
|
|
12
24
|
* @param settings the settings
|
|
13
25
|
* @returns the complete settings
|
|
14
26
|
*/
|
|
15
|
-
export declare function
|
|
27
|
+
export declare function getInfoGroupingsByColumnTypeSettings(settings?: IFilterGroupingInfoListByColumnSettings): IFilterGroupingInfoListByColumnSettings;
|
|
16
28
|
/**
|
|
17
|
-
* Gets a complete settings for the
|
|
29
|
+
* Gets a complete settings for the param settings
|
|
18
30
|
* - Fills the missing properties with default ones
|
|
19
31
|
* @param settings the settings
|
|
20
32
|
* @returns the complete settings
|
|
21
33
|
*/
|
|
22
|
-
export declare function
|
|
34
|
+
export declare function getParamFiltersSettings(settings?: IFilterParamSettings): IFilterParamSettings;
|
|
35
|
+
/**
|
|
36
|
+
* Gets a complete settings for the replaceByParams settings
|
|
37
|
+
* - Fills the missing properties with default ones
|
|
38
|
+
* @param settings the settings
|
|
39
|
+
* @returns the complete settings
|
|
40
|
+
*/
|
|
41
|
+
export declare function getReplaceByParamsSettings(settings?: IFilterReplaceParamSettings): IFilterReplaceParamSettings;
|
|
23
42
|
//# sourceMappingURL=filter-settings.helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-settings.helpers.d.ts","sourceRoot":"","sources":["../../../src/helpers/filter-settings.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"filter-settings.helpers.d.ts","sourceRoot":"","sources":["../../../src/helpers/filter-settings.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,EACrB,uCAAuC,EACvC,oBAAoB,EACpB,2BAA2B,EAC5B,MAAM,yCAAyC,CAAC;AAEjD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,CAAC,EAAE,0BAA0B,GACpC,0BAA0B,CAQ5B;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,CAAC,EAAE,kBAAkB,GAC5B,kBAAkB,CAQpB;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,CAAC,EAAE,qBAAqB,GAC/B,qBAAqB,CAMvB;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,QAAQ,CAAC,EAAE,uCAAuC,GACjD,uCAAuC,CAkBzC;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,CAAC,EAAE,oBAAoB,GAC9B,oBAAoB,CAYtB;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,CAAC,EAAE,2BAA2B,GACrC,2BAA2B,CAM7B"}
|
|
@@ -1,24 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getInfoGroupingsByColumnTypeSettings = exports.
|
|
3
|
+
exports.getReplaceByParamsSettings = exports.getParamFiltersSettings = exports.getInfoGroupingsByColumnTypeSettings = exports.getFilterCreateSettings = exports.getFilterAddSettings = exports.getEditFiltersSettings = void 0;
|
|
4
4
|
const filter_functions_resources_1 = require("../resources/filter-functions.resources");
|
|
5
|
-
/**
|
|
6
|
-
* Gets a complete settings for the param settings
|
|
7
|
-
* - Fills the missing properties with default ones
|
|
8
|
-
* @param settings the settings
|
|
9
|
-
* @returns the complete settings
|
|
10
|
-
*/
|
|
11
|
-
function getParamFiltersSettings(settings) {
|
|
12
|
-
return {
|
|
13
|
-
letPassUndefinedParams: settings?.letPassUndefinedParams ??
|
|
14
|
-
filter_functions_resources_1.DEFAULT_FILTERS_PARAM_SETTINGS.letPassUndefinedParams,
|
|
15
|
-
letPassUndefinedProperties: settings?.letPassUndefinedProperties ??
|
|
16
|
-
filter_functions_resources_1.DEFAULT_FILTERS_PARAM_SETTINGS.letPassUndefinedProperties,
|
|
17
|
-
removeEmptyArrays: settings?.removeEmptyArrays ??
|
|
18
|
-
filter_functions_resources_1.DEFAULT_FILTERS_PARAM_SETTINGS.removeEmptyArrays,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
exports.getParamFiltersSettings = getParamFiltersSettings;
|
|
22
5
|
/**
|
|
23
6
|
* Gets a complete settings for the edit filters settings
|
|
24
7
|
* - Fills the missing properties with default ones
|
|
@@ -33,6 +16,31 @@ function getEditFiltersSettings(settings) {
|
|
|
33
16
|
};
|
|
34
17
|
}
|
|
35
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
|
+
function getFilterAddSettings(settings) {
|
|
25
|
+
return {
|
|
26
|
+
automaticId: settings?.automaticId ?? filter_functions_resources_1.DEFAULT_FILTER_ADD_SETTINGS.automaticId,
|
|
27
|
+
automaticOperator: settings?.automaticOperator ??
|
|
28
|
+
filter_functions_resources_1.DEFAULT_FILTER_ADD_SETTINGS.automaticOperator,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
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
|
+
function getFilterCreateSettings(settings) {
|
|
38
|
+
return {
|
|
39
|
+
automaticId: settings?.automaticId ?? filter_functions_resources_1.DEFAULT_FILTER_CREATE_SETTINGS.automaticId,
|
|
40
|
+
rawValues: settings?.rawValues ?? filter_functions_resources_1.DEFAULT_FILTER_CREATE_SETTINGS.rawValues,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
exports.getFilterCreateSettings = getFilterCreateSettings;
|
|
36
44
|
/**
|
|
37
45
|
* Gets a complete settings for the info grouping by column settings
|
|
38
46
|
* - Fills the missing properties with default ones
|
|
@@ -54,3 +62,34 @@ function getInfoGroupingsByColumnTypeSettings(settings) {
|
|
|
54
62
|
};
|
|
55
63
|
}
|
|
56
64
|
exports.getInfoGroupingsByColumnTypeSettings = getInfoGroupingsByColumnTypeSettings;
|
|
65
|
+
/**
|
|
66
|
+
* Gets a complete settings for the param settings
|
|
67
|
+
* - Fills the missing properties with default ones
|
|
68
|
+
* @param settings the settings
|
|
69
|
+
* @returns the complete settings
|
|
70
|
+
*/
|
|
71
|
+
function getParamFiltersSettings(settings) {
|
|
72
|
+
return {
|
|
73
|
+
letPassUndefinedParams: settings?.letPassUndefinedParams ??
|
|
74
|
+
filter_functions_resources_1.DEFAULT_FILTERS_PARAM_SETTINGS.letPassUndefinedParams,
|
|
75
|
+
letPassUndefinedProperties: settings?.letPassUndefinedProperties ??
|
|
76
|
+
filter_functions_resources_1.DEFAULT_FILTERS_PARAM_SETTINGS.letPassUndefinedProperties,
|
|
77
|
+
removeEmptyArrays: settings?.removeEmptyArrays ??
|
|
78
|
+
filter_functions_resources_1.DEFAULT_FILTERS_PARAM_SETTINGS.removeEmptyArrays,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
exports.getParamFiltersSettings = getParamFiltersSettings;
|
|
82
|
+
/**
|
|
83
|
+
* Gets a complete settings for the replaceByParams settings
|
|
84
|
+
* - Fills the missing properties with default ones
|
|
85
|
+
* @param settings the settings
|
|
86
|
+
* @returns the complete settings
|
|
87
|
+
*/
|
|
88
|
+
function getReplaceByParamsSettings(settings) {
|
|
89
|
+
return {
|
|
90
|
+
...settings,
|
|
91
|
+
automaticOperator: settings?.automaticOperator ?? false,
|
|
92
|
+
addingInSameIndex: settings?.addingInSameIndex ?? false,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
exports.getReplaceByParamsSettings = getReplaceByParamsSettings;
|