@genesislcap/foundation-criteria 14.70.3 → 14.70.4-es2021.1
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.
|
@@ -17,8 +17,7 @@ export class CriteriaBuilder {
|
|
|
17
17
|
withExpression(expression, options = {}, groupJoin = Join.And()) {
|
|
18
18
|
const { condition, join: optionsJoin, groupName } = options;
|
|
19
19
|
const addExpressionToGroup = (e, gName = DEFAULT_GROUP) => {
|
|
20
|
-
|
|
21
|
-
const prev = (_a = this.expressions[gName]) !== null && _a !== void 0 ? _a : [];
|
|
20
|
+
const prev = this.expressions[gName] ?? [];
|
|
22
21
|
this.expressions[gName] = [
|
|
23
22
|
...prev,
|
|
24
23
|
{ join: groupJoin || optionsJoin, condition, expression: e },
|
|
@@ -61,10 +60,13 @@ export class CriteriaBuilder {
|
|
|
61
60
|
return this;
|
|
62
61
|
}
|
|
63
62
|
build(outputFn) {
|
|
64
|
-
const parsedExpressions = Object.entries(this.expressions).reduce((acc, [groupName, expressions]) => (
|
|
63
|
+
const parsedExpressions = Object.entries(this.expressions).reduce((acc, [groupName, expressions]) => ({
|
|
64
|
+
...acc,
|
|
65
|
+
[groupName]: `(${expressions
|
|
65
66
|
.filter(({ condition }) => (condition ? condition() : true))
|
|
66
67
|
.map(({ expression, join }, index, arr) => this.parseExpression(expression, arr[index - 1], join))
|
|
67
|
-
.join('')})
|
|
68
|
+
.join('')})`,
|
|
69
|
+
}), {});
|
|
68
70
|
return outputFn
|
|
69
71
|
? outputFn(parsedExpressions)
|
|
70
72
|
: `(${Object.values(parsedExpressions).join(' && ')})`;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-criteria",
|
|
3
3
|
"description": "Genesis Foundation UI Criteria Utils",
|
|
4
|
-
"version": "14.70.
|
|
4
|
+
"version": "14.70.4-es2021.1",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"test:debug": "genx test --debug"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@genesislcap/foundation-testing": "14.70.
|
|
41
|
-
"@genesislcap/genx": "14.70.
|
|
40
|
+
"@genesislcap/foundation-testing": "14.70.4-es2021.1",
|
|
41
|
+
"@genesislcap/genx": "14.70.4-es2021.1",
|
|
42
42
|
"rimraf": "^3.0.2"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@genesislcap/foundation-utils": "14.70.
|
|
45
|
+
"@genesislcap/foundation-utils": "14.70.4-es2021.1",
|
|
46
46
|
"@microsoft/fast-element": "^1.7.0",
|
|
47
47
|
"tslib": "^2.3.1"
|
|
48
48
|
},
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "5d0d8ee36cfd068cfc6211033b326d0a978cfc05"
|
|
58
58
|
}
|