@pega/cosmos-react-condition-builder 5.0.0-dev.4.7 → 5.0.0-dev.4.9
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/package.json +2 -2
- package/lib/components/ConditionBuilder/AtomicCondition.d.ts +0 -57
- package/lib/components/ConditionBuilder/AtomicCondition.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/AtomicCondition.js +0 -164
- package/lib/components/ConditionBuilder/AtomicCondition.js.map +0 -1
- package/lib/components/ConditionBuilder/ConditionBuilder.d.ts +0 -6
- package/lib/components/ConditionBuilder/ConditionBuilder.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/ConditionBuilder.js +0 -271
- package/lib/components/ConditionBuilder/ConditionBuilder.js.map +0 -1
- package/lib/components/ConditionBuilder/ConditionBuilder.styles.d.ts +0 -7
- package/lib/components/ConditionBuilder/ConditionBuilder.styles.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/ConditionBuilder.styles.js +0 -59
- package/lib/components/ConditionBuilder/ConditionBuilder.styles.js.map +0 -1
- package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +0 -136
- package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/ConditionBuilder.types.js +0 -2
- package/lib/components/ConditionBuilder/ConditionBuilder.types.js.map +0 -1
- package/lib/components/ConditionBuilder/FieldCondition.d.ts +0 -7
- package/lib/components/ConditionBuilder/FieldCondition.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/FieldCondition.js +0 -26
- package/lib/components/ConditionBuilder/FieldCondition.js.map +0 -1
- package/lib/components/ConditionBuilder/FieldCondition.types.d.ts +0 -30
- package/lib/components/ConditionBuilder/FieldCondition.types.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/FieldCondition.types.js +0 -2
- package/lib/components/ConditionBuilder/FieldCondition.types.js.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/DateFunctionMenu.d.ts +0 -18
- package/lib/components/ConditionBuilder/RhsControls/DateFunctionMenu.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/DateFunctionMenu.js +0 -155
- package/lib/components/ConditionBuilder/RhsControls/DateFunctionMenu.js.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/FieldSelector.d.ts +0 -21
- package/lib/components/ConditionBuilder/RhsControls/FieldSelector.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/FieldSelector.js +0 -60
- package/lib/components/ConditionBuilder/RhsControls/FieldSelector.js.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/NumericInput.d.ts +0 -18
- package/lib/components/ConditionBuilder/RhsControls/NumericInput.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/NumericInput.js +0 -22
- package/lib/components/ConditionBuilder/RhsControls/NumericInput.js.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/RelativeDateMenu.d.ts +0 -18
- package/lib/components/ConditionBuilder/RhsControls/RelativeDateMenu.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/RelativeDateMenu.js +0 -119
- package/lib/components/ConditionBuilder/RhsControls/RelativeDateMenu.js.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/RhsModeSwitch.d.ts +0 -26
- package/lib/components/ConditionBuilder/RhsControls/RhsModeSwitch.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/RhsModeSwitch.js +0 -156
- package/lib/components/ConditionBuilder/RhsControls/RhsModeSwitch.js.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/TimePeriodInput.d.ts +0 -6
- package/lib/components/ConditionBuilder/RhsControls/TimePeriodInput.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/TimePeriodInput.js +0 -112
- package/lib/components/ConditionBuilder/RhsControls/TimePeriodInput.js.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/TimePeriodMenu.d.ts +0 -20
- package/lib/components/ConditionBuilder/RhsControls/TimePeriodMenu.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/TimePeriodMenu.js +0 -12
- package/lib/components/ConditionBuilder/RhsControls/TimePeriodMenu.js.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/ValueSelector.d.ts +0 -45
- package/lib/components/ConditionBuilder/RhsControls/ValueSelector.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/ValueSelector.js +0 -196
- package/lib/components/ConditionBuilder/RhsControls/ValueSelector.js.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/index.d.ts +0 -42
- package/lib/components/ConditionBuilder/RhsControls/index.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/RhsControls/index.js +0 -321
- package/lib/components/ConditionBuilder/RhsControls/index.js.map +0 -1
- package/lib/components/ConditionBuilder/core/comparators.d.ts +0 -12
- package/lib/components/ConditionBuilder/core/comparators.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/core/comparators.js +0 -78
- package/lib/components/ConditionBuilder/core/comparators.js.map +0 -1
- package/lib/components/ConditionBuilder/core/evaluator.d.ts +0 -17
- package/lib/components/ConditionBuilder/core/evaluator.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/core/evaluator.js +0 -314
- package/lib/components/ConditionBuilder/core/evaluator.js.map +0 -1
- package/lib/components/ConditionBuilder/core/extendDayJs.d.ts +0 -2
- package/lib/components/ConditionBuilder/core/extendDayJs.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/core/extendDayJs.js +0 -4
- package/lib/components/ConditionBuilder/core/extendDayJs.js.map +0 -1
- package/lib/components/ConditionBuilder/core/formatter.d.ts +0 -17
- package/lib/components/ConditionBuilder/core/formatter.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/core/formatter.js +0 -262
- package/lib/components/ConditionBuilder/core/formatter.js.map +0 -1
- package/lib/components/ConditionBuilder/core/rows-reducer.d.ts +0 -27
- package/lib/components/ConditionBuilder/core/rows-reducer.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/core/rows-reducer.js +0 -50
- package/lib/components/ConditionBuilder/core/rows-reducer.js.map +0 -1
- package/lib/components/ConditionBuilder/core/time-utils.d.ts +0 -5
- package/lib/components/ConditionBuilder/core/time-utils.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/core/time-utils.js +0 -23
- package/lib/components/ConditionBuilder/core/time-utils.js.map +0 -1
- package/lib/components/ConditionBuilder/core/transformer.d.ts +0 -7
- package/lib/components/ConditionBuilder/core/transformer.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/core/transformer.js +0 -210
- package/lib/components/ConditionBuilder/core/transformer.js.map +0 -1
- package/lib/components/ConditionBuilder/core/types.d.ts +0 -47
- package/lib/components/ConditionBuilder/core/types.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/core/types.js +0 -2
- package/lib/components/ConditionBuilder/core/types.js.map +0 -1
- package/lib/components/ConditionBuilder/core/utils.d.ts +0 -37
- package/lib/components/ConditionBuilder/core/utils.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/core/utils.js +0 -454
- package/lib/components/ConditionBuilder/core/utils.js.map +0 -1
- package/lib/components/ConditionBuilder/index.d.ts +0 -11
- package/lib/components/ConditionBuilder/index.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/index.js +0 -8
- package/lib/components/ConditionBuilder/index.js.map +0 -1
- package/lib/components/ConditionInput/ConditionInput.d.ts +0 -6
- package/lib/components/ConditionInput/ConditionInput.d.ts.map +0 -1
- package/lib/components/ConditionInput/ConditionInput.js +0 -302
- package/lib/components/ConditionInput/ConditionInput.js.map +0 -1
- package/lib/components/ConditionInput/ConditionInput.styles.d.ts +0 -5
- package/lib/components/ConditionInput/ConditionInput.styles.d.ts.map +0 -1
- package/lib/components/ConditionInput/ConditionInput.styles.js +0 -27
- package/lib/components/ConditionInput/ConditionInput.styles.js.map +0 -1
- package/lib/components/ConditionInput/ConditionInput.types.d.ts +0 -32
- package/lib/components/ConditionInput/ConditionInput.types.d.ts.map +0 -1
- package/lib/components/ConditionInput/ConditionInput.types.js +0 -2
- package/lib/components/ConditionInput/ConditionInput.types.js.map +0 -1
- package/lib/components/ConditionInput/index.d.ts +0 -3
- package/lib/components/ConditionInput/index.d.ts.map +0 -1
- package/lib/components/ConditionInput/index.js +0 -2
- package/lib/components/ConditionInput/index.js.map +0 -1
- package/lib/components/ConditionInput/utils.d.ts +0 -17
- package/lib/components/ConditionInput/utils.d.ts.map +0 -1
- package/lib/components/ConditionInput/utils.js +0 -121
- package/lib/components/ConditionInput/utils.js.map +0 -1
- package/lib/components/PromotedFilters/ConditionSelector.d.ts +0 -31
- package/lib/components/PromotedFilters/ConditionSelector.d.ts.map +0 -1
- package/lib/components/PromotedFilters/ConditionSelector.js +0 -44
- package/lib/components/PromotedFilters/ConditionSelector.js.map +0 -1
- package/lib/components/PromotedFilters/PromotedFilters.d.ts +0 -11
- package/lib/components/PromotedFilters/PromotedFilters.d.ts.map +0 -1
- package/lib/components/PromotedFilters/PromotedFilters.js +0 -153
- package/lib/components/PromotedFilters/PromotedFilters.js.map +0 -1
- package/lib/components/PromotedFilters/PromotedFilters.styles.d.ts +0 -4
- package/lib/components/PromotedFilters/PromotedFilters.styles.d.ts.map +0 -1
- package/lib/components/PromotedFilters/PromotedFilters.styles.js +0 -38
- package/lib/components/PromotedFilters/PromotedFilters.styles.js.map +0 -1
- package/lib/components/PromotedFilters/PromotedFilters.types.d.ts +0 -33
- package/lib/components/PromotedFilters/PromotedFilters.types.d.ts.map +0 -1
- package/lib/components/PromotedFilters/PromotedFilters.types.js +0 -2
- package/lib/components/PromotedFilters/PromotedFilters.types.js.map +0 -1
- package/lib/components/PromotedFilters/index.d.ts +0 -3
- package/lib/components/PromotedFilters/index.d.ts.map +0 -1
- package/lib/components/PromotedFilters/index.js +0 -2
- package/lib/components/PromotedFilters/index.js.map +0 -1
- package/lib/index.d.ts +0 -7
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -8
- package/lib/index.js.map +0 -1
|
@@ -1,454 +0,0 @@
|
|
|
1
|
-
// cspell:words LPAREN LPARENs RPAREN RPARENs
|
|
2
|
-
import { createUID, hasProp } from '@pega/cosmos-react-core';
|
|
3
|
-
const AND = 'AND';
|
|
4
|
-
const OR = 'OR';
|
|
5
|
-
const NOT = 'NOT';
|
|
6
|
-
const LPAREN = '(';
|
|
7
|
-
const RPAREN = ')';
|
|
8
|
-
const precedenceMap = { OR: 1, AND: 2, NOT: 3 }; // Operator precedence. NOT has the highest precedence over the others
|
|
9
|
-
const operatorTokens = new Set([AND, OR, NOT]); // Valid logical operators
|
|
10
|
-
const validTokens = new Set([AND, OR, NOT, LPAREN, RPAREN]); // Other than these, integer tokens are valid
|
|
11
|
-
const isIntegerToken = (token) => /^\d+$/.test(token); // Checks if the input token is an integer
|
|
12
|
-
const isOperatorToken = (token) => operatorTokens.has(token); // Checks if the input token is an operator
|
|
13
|
-
/**
|
|
14
|
-
* Tokenize the input expression.
|
|
15
|
-
* Valid tokens are 'AND', 'OR', 'NOT', '(', ')' and any integer token.
|
|
16
|
-
* Throws an error if an invalid token is found.
|
|
17
|
-
*/
|
|
18
|
-
function tokenizeExpression(expression, disallowNOT = false) {
|
|
19
|
-
expression = expression.trim().toUpperCase(); // To simplify comparisons below; the tokens AND/OR/NOT are anyways expected to be in uppercase
|
|
20
|
-
const words = expression.match(/[A-Z]+|[0-9]+|_|\W/g); // Split contiguous alphabets and contiguous numbers into the same token. For all other characters, create a token for each character. Although `_` is not expected to be used, handling it just for completeness
|
|
21
|
-
const tokens = []; // Final list of valid tokens
|
|
22
|
-
const invalidWords = []; // Any invalid words are captured here
|
|
23
|
-
// `words` will never be null because of the regex we used. Using `!` to indicate the same to TS
|
|
24
|
-
words.forEach(word => {
|
|
25
|
-
// Ignore white-space characters
|
|
26
|
-
if (word.trim().length > 0) {
|
|
27
|
-
// If it's a token from the above Set or if it's an integer token
|
|
28
|
-
if (isIntegerToken(word) || (validTokens.has(word) && !(word === NOT && disallowNOT))) {
|
|
29
|
-
tokens.push(word);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
invalidWords.push(word);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
// Return an error if any invalid tokens are present
|
|
37
|
-
if (invalidWords.length > 0) {
|
|
38
|
-
return { error: `Unexpected words/characters: ${invalidWords.join(' ')}` }; // FIXME: TR
|
|
39
|
-
}
|
|
40
|
-
return { tokens };
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Captures any invalid/unexpected token patterns
|
|
44
|
-
* NOTE: This does not expect any invalid tokens to be passed in the input
|
|
45
|
-
* NOTE: This doesn't handle mismatched parentheses. That is handled separately in getPostfixFromInfix
|
|
46
|
-
* Returns an error message about the first invalid sequence present in the input. Returns `null` if none found
|
|
47
|
-
*/
|
|
48
|
-
function findInvalidPatterns(tokens) {
|
|
49
|
-
// These patterns are identified based on which token can precede/succeed which.
|
|
50
|
-
// A table with all such permutations can be found in DOC-38200
|
|
51
|
-
for (let i = 0; i < tokens.length; i += 1) {
|
|
52
|
-
const NUMBER = 'NUMBER'; // To avoid repeating a string literal
|
|
53
|
-
const token = tokens[i];
|
|
54
|
-
const tokenType = isIntegerToken(token) ? NUMBER : token; // To simplify comparisons below
|
|
55
|
-
// The expression can only start with NOT, LPAREN or NUMBER
|
|
56
|
-
if (i === 0 && ![NOT, LPAREN, NUMBER].includes(tokenType)) {
|
|
57
|
-
return `Unexpected "${token}" at the beginning.`; // FIXME: TR
|
|
58
|
-
}
|
|
59
|
-
// The expression can only end with RPAREN or NUMBER
|
|
60
|
-
if (i === tokens.length - 1 && ![RPAREN, NUMBER].includes(tokenType)) {
|
|
61
|
-
return `Unexpected "${token}" at the end.`; // FIXME: TR
|
|
62
|
-
}
|
|
63
|
-
// If there is a previous token, check if it is supposed to precede the current token
|
|
64
|
-
if (i > 0) {
|
|
65
|
-
const prevToken = tokens[i - 1];
|
|
66
|
-
const prevTokenType = isIntegerToken(prevToken) ? NUMBER : prevToken; // To simplify comparisons below
|
|
67
|
-
switch (tokenType) {
|
|
68
|
-
// AND/OR/RPAREN can only be preceded by RPAREN or NUMBER
|
|
69
|
-
case AND:
|
|
70
|
-
case OR:
|
|
71
|
-
case RPAREN:
|
|
72
|
-
if (![RPAREN, NUMBER].includes(prevTokenType)) {
|
|
73
|
-
return `Unexpected "${token}" after "${prevToken}"`; // FIXME: TR
|
|
74
|
-
}
|
|
75
|
-
break;
|
|
76
|
-
// NOT/LPAREN/NUMBER can not be preceded by RPAREN or NUMBER
|
|
77
|
-
case NOT:
|
|
78
|
-
case LPAREN:
|
|
79
|
-
case NUMBER:
|
|
80
|
-
if ([RPAREN, NUMBER].includes(prevTokenType)) {
|
|
81
|
-
return `Unexpected "${token}" after "${prevToken}"`; // FIXME: TR
|
|
82
|
-
}
|
|
83
|
-
break;
|
|
84
|
-
default: // do nothing
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
// Return null if no invalid sequences
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Converts an input array of Infix tokens into a Postfix array.
|
|
93
|
-
* Uses the ShuntingYard algorithm.
|
|
94
|
-
* NOTE: This does not expect any invalid tokens to be passed in the input
|
|
95
|
-
*/
|
|
96
|
-
function getPostfixFromInfix(tokens) {
|
|
97
|
-
// Refer these for the ShuntingYard algorithm:
|
|
98
|
-
// * https://brilliant.org/wiki/shunting-yard-algorithm/
|
|
99
|
-
// * https://en.wikipedia.org/wiki/Shunting-yard_algorithm#The_algorithm_in_detail
|
|
100
|
-
const postfixQueue = []; // Output queue
|
|
101
|
-
const stack = []; // Operations stack
|
|
102
|
-
// While there are tokens to be read
|
|
103
|
-
for (let i = 0; i < tokens.length; i += 1) {
|
|
104
|
-
const token = tokens[i];
|
|
105
|
-
if (isIntegerToken(token)) {
|
|
106
|
-
// If it's a number add it to queue
|
|
107
|
-
postfixQueue.push(token);
|
|
108
|
-
}
|
|
109
|
-
else if (isOperatorToken(token)) {
|
|
110
|
-
// If it's an operator
|
|
111
|
-
// While there's an operator on the top of the stack with greater precedence (or equal precedence and the token is left-associative), pop operators from the stack onto the output queue
|
|
112
|
-
if (token !== NOT) {
|
|
113
|
-
// Unary operators should not cause any operators to be popped from the stack.
|
|
114
|
-
// See http://wcipeg.com/wiki/Shunting_yard_algorithm#Unary_operators
|
|
115
|
-
while (stack.length > 0) {
|
|
116
|
-
const stackTop = stack[stack.length - 1];
|
|
117
|
-
if (isOperatorToken(stackTop) && precedenceMap[stackTop] >= precedenceMap[token]) {
|
|
118
|
-
postfixQueue.push(stack.pop());
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
// Push the current operator onto the stack
|
|
126
|
-
stack.push(token);
|
|
127
|
-
}
|
|
128
|
-
else if (token === LPAREN) {
|
|
129
|
-
// If it's a left parenthesis, push it onto the stack
|
|
130
|
-
stack.push(token);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
// If it's a right parenthesis (RPAREN)
|
|
134
|
-
// While there's not a left parenthesis at the top of the stack, pop operators from the stack onto the output queue
|
|
135
|
-
while (stack.length > 0) {
|
|
136
|
-
const stackTop = stack[stack.length - 1];
|
|
137
|
-
if (stackTop === LPAREN)
|
|
138
|
-
break;
|
|
139
|
-
postfixQueue.push(stack.pop());
|
|
140
|
-
}
|
|
141
|
-
// Pop the left parenthesis from the stack and discard it
|
|
142
|
-
if (stack.length > 0) {
|
|
143
|
-
stack.pop();
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
// FIXME: TR
|
|
147
|
-
return { error: 'Please fix mismatched parentheses.' }; // If no LPAREN found for the current RPAREN
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
// While there are operators on the stack, pop them to the queue
|
|
152
|
-
while (stack.length > 0) {
|
|
153
|
-
if (stack[stack.length - 1] === LPAREN) {
|
|
154
|
-
// FIXME: TR
|
|
155
|
-
return { error: 'Please fix mismatched parentheses.' }; // If there were excess LPARENs. (Excess RPARENs are already handled in the above loop. Also, RPARENs are never pushed to the stack)
|
|
156
|
-
}
|
|
157
|
-
postfixQueue.push(stack.pop());
|
|
158
|
-
}
|
|
159
|
-
return { postfixArr: postfixQueue };
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Converts an input array of Postfix tokens into a Condition tree.
|
|
163
|
-
* NOTE: This expects a properly formed Postfix array as input
|
|
164
|
-
*/
|
|
165
|
-
function getConditionFromPostfix(postfixArr, conditionLookup, ignoreUnusedLabels) {
|
|
166
|
-
// To learn more about the below algorithm, refer this: https://brilliant.org/wiki/shunting-yard-algorithm/#reverse-polish
|
|
167
|
-
const operandsStack = [];
|
|
168
|
-
const labelsWithNoRows = []; // Labels for which there is no corresponding op in conditionLookup
|
|
169
|
-
const usedLabels = []; // A list of all labels used in the condition. This is used to warn about any unused operations
|
|
170
|
-
postfixArr.forEach(token => {
|
|
171
|
-
if (isIntegerToken(token)) {
|
|
172
|
-
// If it's a numeric token (leaf condition), push it to the stack
|
|
173
|
-
const conditionRow = conditionLookup[token]; // Identify the corresponding condition row
|
|
174
|
-
operandsStack.push({ condition: conditionRow }); // Push it even if null so that the conversion goes on smoothly and identifies any other issues
|
|
175
|
-
if (!conditionRow) {
|
|
176
|
-
labelsWithNoRows.push(token); // Mark it as missing
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
usedLabels.push(token); // Mark it as used
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
else if (token === NOT) {
|
|
183
|
-
// If it's the NOT operator
|
|
184
|
-
// Pop an operand, perform the operation and push the result back to the stack
|
|
185
|
-
const operand = operandsStack.pop();
|
|
186
|
-
operandsStack.push({ NOT: operand });
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
// If it's the AND/OR operator
|
|
190
|
-
// Pop two operands, perform the operation and push the result back to the stack
|
|
191
|
-
const operand2 = operandsStack.pop();
|
|
192
|
-
const operand1 = operandsStack.pop();
|
|
193
|
-
// If the inner operation is the same as the current one, consolidate them
|
|
194
|
-
// e.g. `1 AND (2 AND 3)` should be consolidated as `1 AND 2 AND 3`
|
|
195
|
-
// e.g. `1 OR (2 OR 3)` should be consolidated as `1 OR 2 OR 3`
|
|
196
|
-
if (token === 'AND') {
|
|
197
|
-
const operands = [
|
|
198
|
-
...(hasProp(operand1, 'AND') ? operand1.AND : [operand1]),
|
|
199
|
-
...(hasProp(operand2, 'AND') ? operand2.AND : [operand2])
|
|
200
|
-
];
|
|
201
|
-
operandsStack.push({ AND: operands });
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
const operands = [
|
|
205
|
-
...(hasProp(operand1, 'OR') ? operand1.OR : [operand1]),
|
|
206
|
-
...(hasProp(operand2, 'OR') ? operand2.OR : [operand2])
|
|
207
|
-
];
|
|
208
|
-
operandsStack.push({ OR: operands });
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
// If any labels are used for which there are no corresponding condition-rows
|
|
213
|
-
if (labelsWithNoRows.length > 0) {
|
|
214
|
-
if (labelsWithNoRows.length === 1) {
|
|
215
|
-
return {
|
|
216
|
-
error: `Condition ${labelsWithNoRows[0]} used in the logical string is not defined.` // FIXME: TR
|
|
217
|
-
};
|
|
218
|
-
}
|
|
219
|
-
return {
|
|
220
|
-
error: `Conditions ${labelsWithNoRows.join(', ')} used in the logical string are not defined.` // FIXME: TR
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
// Warn if any of the condition rows are unused
|
|
224
|
-
if (!ignoreUnusedLabels) {
|
|
225
|
-
const unusedLabels = Object.keys(conditionLookup).filter(l => !usedLabels.includes(l));
|
|
226
|
-
if (unusedLabels.length > 0) {
|
|
227
|
-
if (unusedLabels.length === 1) {
|
|
228
|
-
return { error: `Condition ${unusedLabels[0]} is not used in the logic expression.` }; // FIXME: TR
|
|
229
|
-
}
|
|
230
|
-
return {
|
|
231
|
-
error: `Conditions ${unusedLabels.join(', ')} are not used in the logic expression.` // FIXME: TR
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
return { condition: operandsStack[0] };
|
|
236
|
-
}
|
|
237
|
-
/** Parses a logic-expression into a condition object. */
|
|
238
|
-
export function parseLogicString(expression, conditionLookup, // To look up condition-rows from the labels
|
|
239
|
-
disallowNOT = false, ignoreUnusedLabels = false) {
|
|
240
|
-
// Handle empty expressions
|
|
241
|
-
if (!expression.trim().length)
|
|
242
|
-
return { error: 'Please provide a logic expression.' }; // FIXME: TR
|
|
243
|
-
// Split the expression into individual tokens
|
|
244
|
-
const tokeningResult = tokenizeExpression(expression, disallowNOT);
|
|
245
|
-
if (hasProp(tokeningResult, 'error'))
|
|
246
|
-
return tokeningResult;
|
|
247
|
-
const { tokens } = tokeningResult;
|
|
248
|
-
// Capture any invalid/unexpected token patterns
|
|
249
|
-
// NOTE: This doesn't handle mismatched parentheses. That is handled below in getPostfixFromInfix
|
|
250
|
-
const badPatternError = findInvalidPatterns(tokens);
|
|
251
|
-
if (badPatternError !== null)
|
|
252
|
-
return { error: badPatternError };
|
|
253
|
-
// Convert the Infix tokens to a Postfix notation using the ShuntingYard algorithm
|
|
254
|
-
const postfixResult = getPostfixFromInfix(tokens);
|
|
255
|
-
if (hasProp(postfixResult, 'error'))
|
|
256
|
-
return postfixResult;
|
|
257
|
-
const { postfixArr } = postfixResult;
|
|
258
|
-
// Convert the Postfix token to a Condition tree
|
|
259
|
-
return getConditionFromPostfix(postfixArr, conditionLookup, ignoreUnusedLabels);
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* Takes a valid logic string and formats it with parentheses at appropriate places to keep things unambiguous
|
|
263
|
-
* For example, `1 AND 2 OR 3` is disambiguated as `(1 AND 2) OR 3`
|
|
264
|
-
* NOTE: This expects only valid logic strings to be passed as an input
|
|
265
|
-
*/
|
|
266
|
-
export function disambiguateLogic(expression) {
|
|
267
|
-
// Split the expression into individual tokens
|
|
268
|
-
const tokeningResult = tokenizeExpression(expression);
|
|
269
|
-
const { tokens } = tokeningResult; // Only valid expressions are expected as inputs
|
|
270
|
-
// Convert the Infix tokens to a Postfix notation using the ShuntingYard algorithm
|
|
271
|
-
const postfixResult = getPostfixFromInfix(tokens);
|
|
272
|
-
const { postfixArr } = postfixResult;
|
|
273
|
-
// Convert the postfix back to infix with parentheses at appropriate places
|
|
274
|
-
// To learn more about the below algorithm, refer this: https://brilliant.org/wiki/shunting-yard-algorithm/#reverse-polish
|
|
275
|
-
const operandsStack = [];
|
|
276
|
-
postfixArr.forEach(token => {
|
|
277
|
-
if (isIntegerToken(token)) {
|
|
278
|
-
// If it's a numeric token (leaf condition), push it to the stack
|
|
279
|
-
operandsStack.push(token);
|
|
280
|
-
}
|
|
281
|
-
else if (token === NOT) {
|
|
282
|
-
// If it's the NOT operator
|
|
283
|
-
// Pop an operand, perform the operation and push the result back to the stack
|
|
284
|
-
const operand = operandsStack.pop();
|
|
285
|
-
operandsStack.push(`NOT ${operand}`);
|
|
286
|
-
}
|
|
287
|
-
else {
|
|
288
|
-
// If it's the AND/OR operator
|
|
289
|
-
// Pop two operands, perform the operation and push the result back to the stack
|
|
290
|
-
let operand2 = operandsStack.pop();
|
|
291
|
-
let operand1 = operandsStack.pop();
|
|
292
|
-
// If the inner operation is the same as the current one, consolidate them
|
|
293
|
-
// e.g. `1 AND (2 AND 3)` should be consolidated as `1 AND 2 AND 3`
|
|
294
|
-
// e.g. `1 OR (2 OR 3)` should be consolidated as `1 OR 2 OR 3`
|
|
295
|
-
if (token === 'AND') {
|
|
296
|
-
// Remove any wrapping parentheses if an operand contains just AND(s)
|
|
297
|
-
if (operand1.startsWith(LPAREN) && !operand1.includes(OR) && !operand1.includes(NOT)) {
|
|
298
|
-
operand1 = operand1.slice(1, -1);
|
|
299
|
-
}
|
|
300
|
-
if (operand2.startsWith(LPAREN) && !operand2.includes(OR) && !operand2.includes(NOT)) {
|
|
301
|
-
operand2 = operand2.slice(1, -1);
|
|
302
|
-
}
|
|
303
|
-
operandsStack.push(`(${operand1} AND ${operand2})`);
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
// Remove any wrapping parentheses if an operand contains just OR(s)
|
|
307
|
-
if (operand1.startsWith(LPAREN) && !operand1.includes(AND) && !operand1.includes(NOT)) {
|
|
308
|
-
operand1 = operand1.slice(1, -1);
|
|
309
|
-
}
|
|
310
|
-
if (operand2.startsWith(LPAREN) && !operand2.includes(AND) && !operand2.includes(NOT)) {
|
|
311
|
-
operand2 = operand2.slice(1, -1);
|
|
312
|
-
}
|
|
313
|
-
operandsStack.push(`(${operand1} OR ${operand2})`);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
});
|
|
317
|
-
// If the root node is AND/OR, there will be extra parentheses. Remove them
|
|
318
|
-
let outputLogic = operandsStack[0];
|
|
319
|
-
if (outputLogic.startsWith(LPAREN) && outputLogic.endsWith(RPAREN)) {
|
|
320
|
-
outputLogic = outputLogic.slice(1, -1);
|
|
321
|
-
}
|
|
322
|
-
return outputLogic;
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Recursively splits the input condition node into a logic-string and a list of condition-rows
|
|
326
|
-
* NOTE: Returns an empty string and an empty array if the condition is malformed
|
|
327
|
-
*/
|
|
328
|
-
function splitConditionNode(node, labelsSoFar) {
|
|
329
|
-
// Using a try-catch block for safety against any malformed conditions
|
|
330
|
-
try {
|
|
331
|
-
let logic;
|
|
332
|
-
const rows = [];
|
|
333
|
-
if (hasProp(node, 'AND')) {
|
|
334
|
-
const childStrings = [];
|
|
335
|
-
node.AND.forEach(n => {
|
|
336
|
-
const splitResult = splitConditionNode(n, labelsSoFar); // Recursively get child rows and logic
|
|
337
|
-
childStrings.push(splitResult.logic);
|
|
338
|
-
rows.push(...splitResult.rows);
|
|
339
|
-
});
|
|
340
|
-
logic = `(${childStrings.join(' AND ')})`;
|
|
341
|
-
}
|
|
342
|
-
else if (hasProp(node, 'OR')) {
|
|
343
|
-
const childStrings = [];
|
|
344
|
-
node.OR.forEach(n => {
|
|
345
|
-
const splitResult = splitConditionNode(n, labelsSoFar); // Recursively get child rows and logic
|
|
346
|
-
childStrings.push(splitResult.logic);
|
|
347
|
-
rows.push(...splitResult.rows);
|
|
348
|
-
});
|
|
349
|
-
logic = `(${childStrings.join(' OR ')})`;
|
|
350
|
-
}
|
|
351
|
-
else if (hasProp(node, 'NOT')) {
|
|
352
|
-
const splitResult = splitConditionNode(node.NOT, labelsSoFar); // Recursively get child rows and logic
|
|
353
|
-
logic = `NOT ${splitResult.logic}`;
|
|
354
|
-
rows.push(...splitResult.rows);
|
|
355
|
-
}
|
|
356
|
-
else {
|
|
357
|
-
// If leaf-level is reached
|
|
358
|
-
const newLabel = `${labelsSoFar.length + 1}`; // Get a new label for the node
|
|
359
|
-
labelsSoFar.push(newLabel); // Update for the next time
|
|
360
|
-
logic = newLabel;
|
|
361
|
-
rows.push({ ...node.condition, label: newLabel, id: createUID() });
|
|
362
|
-
}
|
|
363
|
-
return { logic, rows };
|
|
364
|
-
}
|
|
365
|
-
catch {
|
|
366
|
-
return { logic: '', rows: [] }; // For safety against any malformed conditions
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
// Splitter for internal consumption
|
|
370
|
-
/** Splits the input condition tree into a logic-string and a list of condition-rows */
|
|
371
|
-
export function splitConditionForBuilder(tree) {
|
|
372
|
-
// Recursively split the tree, starting at the root node
|
|
373
|
-
const splitResult = splitConditionNode(tree, []);
|
|
374
|
-
// If the root node is AND/OR, there will be extra parentheses. Remove them
|
|
375
|
-
if (splitResult.logic.startsWith(LPAREN) && splitResult.logic.endsWith(RPAREN)) {
|
|
376
|
-
splitResult.logic = splitResult.logic.slice(1, -1);
|
|
377
|
-
}
|
|
378
|
-
return splitResult;
|
|
379
|
-
}
|
|
380
|
-
// Splitter for public consumption
|
|
381
|
-
/** Converts the input nested condition into a flat tree with the leaf-conditions and a logic string representing the input tree */
|
|
382
|
-
export function splitConditionTree(tree, labelPrefix = '') {
|
|
383
|
-
// Split using the internal splitter
|
|
384
|
-
const { logic, rows } = splitConditionForBuilder(tree);
|
|
385
|
-
// Build a condition-lookup from the ConditionRow objects
|
|
386
|
-
const conditionLookup = {};
|
|
387
|
-
rows.forEach(row => {
|
|
388
|
-
const { id, label, ...leaf } = row; // Discard the excess properties set up by ConditionRow when extending LeafCondition interface
|
|
389
|
-
conditionLookup[`${labelPrefix}${label}`] = leaf;
|
|
390
|
-
});
|
|
391
|
-
// Prepend labelPrefix to all numeric tokens in the logic
|
|
392
|
-
let outputLogic = logic;
|
|
393
|
-
if (labelPrefix !== '') {
|
|
394
|
-
outputLogic = logic.replace(/\d+/g, `${labelPrefix}$&`);
|
|
395
|
-
}
|
|
396
|
-
return { logic: outputLogic, conditions: conditionLookup };
|
|
397
|
-
}
|
|
398
|
-
/** Checks if the input Condition is simple enough to be displayed in the `Basic mode` without loss of information */
|
|
399
|
-
export function isBasicModeApplicable(condition) {
|
|
400
|
-
// If an OR condition is present at the outer level,
|
|
401
|
-
// each child should either be a leaf condition or an AND with all leaf nodes inside
|
|
402
|
-
if (hasProp(condition, 'OR')) {
|
|
403
|
-
return condition.OR.every(node => {
|
|
404
|
-
if (hasProp(node, 'condition')) {
|
|
405
|
-
return true;
|
|
406
|
-
}
|
|
407
|
-
if (hasProp(node, 'AND')) {
|
|
408
|
-
return node.AND.every(subNode => hasProp(subNode, 'condition'));
|
|
409
|
-
}
|
|
410
|
-
return false;
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
// If an AND condition is present at the outer level, it can't have any nested levels
|
|
414
|
-
if (hasProp(condition, 'AND')) {
|
|
415
|
-
return condition.AND.every(node => hasProp(node, 'condition'));
|
|
416
|
-
}
|
|
417
|
-
// NOT operator is not supported in Basic-mode
|
|
418
|
-
// eslint-disable-next-line sonarjs/prefer-single-boolean-return
|
|
419
|
-
if (hasProp(condition, 'NOT')) {
|
|
420
|
-
return false;
|
|
421
|
-
}
|
|
422
|
-
// If a single leaf condition is present at the outer level
|
|
423
|
-
return true;
|
|
424
|
-
}
|
|
425
|
-
/** Returns a list of operators to show in the Basic mode, using a logicString as the input */
|
|
426
|
-
export function getBasicModeOperators(logic) {
|
|
427
|
-
const matches = logic.match(/(AND|OR)/g);
|
|
428
|
-
if (matches === null) {
|
|
429
|
-
return [];
|
|
430
|
-
}
|
|
431
|
-
return matches;
|
|
432
|
-
}
|
|
433
|
-
/** Takes a list of operators from between the Basic mode rows and constructs a logic-string out of them */
|
|
434
|
-
export function getLogicFromBasicMode(operatorsList) {
|
|
435
|
-
const logicString = operatorsList.reduce((logic, op, i) => `${logic} ${op} ${i + 2}`, '1');
|
|
436
|
-
return disambiguateLogic(logicString); // Disambiguating the logic string by placing parentheses at appropriate places
|
|
437
|
-
}
|
|
438
|
-
/** Takes a list of objects and id of the object to be found and recursively finds and returns the object */
|
|
439
|
-
export function getItem(items, id) {
|
|
440
|
-
let found;
|
|
441
|
-
items.some(item => {
|
|
442
|
-
if (item.id === id) {
|
|
443
|
-
found = item;
|
|
444
|
-
return true;
|
|
445
|
-
}
|
|
446
|
-
if (hasProp(item, 'items')) {
|
|
447
|
-
found = getItem(item.items, id);
|
|
448
|
-
return !!found;
|
|
449
|
-
}
|
|
450
|
-
return false;
|
|
451
|
-
});
|
|
452
|
-
return found;
|
|
453
|
-
}
|
|
454
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/components/ConditionBuilder/core/utils.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAI7D,MAAM,GAAG,GAAG,KAAK,CAAC;AAClB,MAAM,EAAE,GAAG,IAAI,CAAC;AAChB,MAAM,GAAG,GAAG,KAAK,CAAC;AAClB,MAAM,MAAM,GAAG,GAAG,CAAC;AACnB,MAAM,MAAM,G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,CAAC,IAAI,CAAC,EAAE;QAChB,IAAI,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE;YAClB,KAAK,GAAG,IAAI,CAAC;YACb,OAAO,IAAI,CAAC;SACb;QAED,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE;YAC1B,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAChC,OAAO,CAAC,CAAC,KAAK,CAAC;SAChB;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// cspell:words LPAREN LPARENs RPAREN RPARENs\nimport { createUID, hasProp } from '@pega/cosmos-react-core';\n\nimport { Condition, ConditionRow, LeafCondition, Field } from '../ConditionBuilder.types';\n\nconst AND = 'AND';\nconst OR = 'OR';\nconst NOT = 'NOT';\nconst LPAREN = '(';\nconst RPAREN = ')';\n\nconst precedenceMap: { [op: string]: number } = { OR: 1, AND: 2, NOT: 3 }; // Operator precedence. NOT has the highest precedence over the others\nconst operatorTokens = new Set([AND, OR, NOT]); // Valid logical operators\nconst validTokens = new Set([AND, OR, NOT, LPAREN, RPAREN]); // Other than these, integer tokens are valid\n\nconst isIntegerToken = (token: string): boolean => /^\\d+$/.test(token); // Checks if the input token is an integer\nconst isOperatorToken = (token: string): boolean => operatorTokens.has(token); // Checks if the input token is an operator\n\n/**\n * Tokenize the input expression.\n * Valid tokens are 'AND', 'OR', 'NOT', '(', ')' and any integer token.\n * Throws an error if an invalid token is found.\n */\nfunction tokenizeExpression(\n expression: string,\n disallowNOT: boolean = false\n): { tokens: string[] } | { error: string } {\n expression = expression.trim().toUpperCase(); // To simplify comparisons below; the tokens AND/OR/NOT are anyways expected to be in uppercase\n const words = expression.match(/[A-Z]+|[0-9]+|_|\\W/g); // Split contiguous alphabets and contiguous numbers into the same token. For all other characters, create a token for each character. Although `_` is not expected to be used, handling it just for completeness\n const tokens: string[] = []; // Final list of valid tokens\n const invalidWords: string[] = []; // Any invalid words are captured here\n\n // `words` will never be null because of the regex we used. Using `!` to indicate the same to TS\n words!.forEach(word => {\n // Ignore white-space characters\n if (word.trim().length > 0) {\n // If it's a token from the above Set or if it's an integer token\n if (isIntegerToken(word) || (validTokens.has(word) && !(word === NOT && disallowNOT))) {\n tokens.push(word);\n } else {\n invalidWords.push(word);\n }\n }\n });\n\n // Return an error if any invalid tokens are present\n if (invalidWords.length > 0) {\n return { error: `Unexpected words/characters: ${invalidWords.join(' ')}` }; // FIXME: TR\n }\n\n return { tokens };\n}\n\n/**\n * Captures any invalid/unexpected token patterns\n * NOTE: This does not expect any invalid tokens to be passed in the input\n * NOTE: This doesn't handle mismatched parentheses. That is handled separately in getPostfixFromInfix\n * Returns an error message about the first invalid sequence present in the input. Returns `null` if none found\n */\nfunction findInvalidPatterns(tokens: string[]): string | null {\n // These patterns are identified based on which token can precede/succeed which.\n // A table with all such permutations can be found in DOC-38200\n\n for (let i = 0; i < tokens.length; i += 1) {\n const NUMBER = 'NUMBER'; // To avoid repeating a string literal\n const token = tokens[i];\n const tokenType = isIntegerToken(token) ? NUMBER : token; // To simplify comparisons below\n\n // The expression can only start with NOT, LPAREN or NUMBER\n if (i === 0 && ![NOT, LPAREN, NUMBER].includes(tokenType)) {\n return `Unexpected \"${token}\" at the beginning.`; // FIXME: TR\n }\n\n // The expression can only end with RPAREN or NUMBER\n if (i === tokens.length - 1 && ![RPAREN, NUMBER].includes(tokenType)) {\n return `Unexpected \"${token}\" at the end.`; // FIXME: TR\n }\n\n // If there is a previous token, check if it is supposed to precede the current token\n if (i > 0) {\n const prevToken = tokens[i - 1];\n const prevTokenType = isIntegerToken(prevToken) ? NUMBER : prevToken; // To simplify comparisons below\n switch (tokenType) {\n // AND/OR/RPAREN can only be preceded by RPAREN or NUMBER\n case AND:\n case OR:\n case RPAREN:\n if (![RPAREN, NUMBER].includes(prevTokenType)) {\n return `Unexpected \"${token}\" after \"${prevToken}\"`; // FIXME: TR\n }\n break;\n\n // NOT/LPAREN/NUMBER can not be preceded by RPAREN or NUMBER\n case NOT:\n case LPAREN:\n case NUMBER:\n if ([RPAREN, NUMBER].includes(prevTokenType)) {\n return `Unexpected \"${token}\" after \"${prevToken}\"`; // FIXME: TR\n }\n break;\n default: // do nothing\n }\n }\n }\n\n // Return null if no invalid sequences\n return null;\n}\n\n/**\n * Converts an input array of Infix tokens into a Postfix array.\n * Uses the ShuntingYard algorithm.\n * NOTE: This does not expect any invalid tokens to be passed in the input\n */\nfunction getPostfixFromInfix(tokens: string[]): { postfixArr: string[] } | { error: string } {\n // Refer these for the ShuntingYard algorithm:\n // * https://brilliant.org/wiki/shunting-yard-algorithm/\n // * https://en.wikipedia.org/wiki/Shunting-yard_algorithm#The_algorithm_in_detail\n const postfixQueue: string[] = []; // Output queue\n const stack: string[] = []; // Operations stack\n\n // While there are tokens to be read\n for (let i = 0; i < tokens.length; i += 1) {\n const token = tokens[i];\n\n if (isIntegerToken(token)) {\n // If it's a number add it to queue\n postfixQueue.push(token);\n } else if (isOperatorToken(token)) {\n // If it's an operator\n // While there's an operator on the top of the stack with greater precedence (or equal precedence and the token is left-associative), pop operators from the stack onto the output queue\n if (token !== NOT) {\n // Unary operators should not cause any operators to be popped from the stack.\n // See http://wcipeg.com/wiki/Shunting_yard_algorithm#Unary_operators\n while (stack.length > 0) {\n const stackTop = stack[stack.length - 1];\n if (isOperatorToken(stackTop) && precedenceMap[stackTop] >= precedenceMap[token]) {\n postfixQueue.push(stack.pop()!);\n } else {\n break;\n }\n }\n }\n // Push the current operator onto the stack\n stack.push(token);\n } else if (token === LPAREN) {\n // If it's a left parenthesis, push it onto the stack\n stack.push(token);\n } else {\n // If it's a right parenthesis (RPAREN)\n // While there's not a left parenthesis at the top of the stack, pop operators from the stack onto the output queue\n while (stack.length > 0) {\n const stackTop = stack[stack.length - 1];\n if (stackTop === LPAREN) break;\n postfixQueue.push(stack.pop()!);\n }\n\n // Pop the left parenthesis from the stack and discard it\n if (stack.length > 0) {\n stack.pop();\n } else {\n // FIXME: TR\n return { error: 'Please fix mismatched parentheses.' }; // If no LPAREN found for the current RPAREN\n }\n }\n }\n\n // While there are operators on the stack, pop them to the queue\n while (stack.length > 0) {\n if (stack[stack.length - 1] === LPAREN) {\n // FIXME: TR\n return { error: 'Please fix mismatched parentheses.' }; // If there were excess LPARENs. (Excess RPARENs are already handled in the above loop. Also, RPARENs are never pushed to the stack)\n }\n postfixQueue.push(stack.pop()!);\n }\n\n return { postfixArr: postfixQueue };\n}\n\n/**\n * Converts an input array of Postfix tokens into a Condition tree.\n * NOTE: This expects a properly formed Postfix array as input\n */\nfunction getConditionFromPostfix(\n postfixArr: string[],\n conditionLookup: { [label: string]: LeafCondition },\n ignoreUnusedLabels: boolean\n): { condition: Condition } | { error: string } {\n // To learn more about the below algorithm, refer this: https://brilliant.org/wiki/shunting-yard-algorithm/#reverse-polish\n const operandsStack: Condition[] = [];\n const labelsWithNoRows: string[] = []; // Labels for which there is no corresponding op in conditionLookup\n const usedLabels: string[] = []; // A list of all labels used in the condition. This is used to warn about any unused operations\n postfixArr.forEach(token => {\n if (isIntegerToken(token)) {\n // If it's a numeric token (leaf condition), push it to the stack\n const conditionRow = conditionLookup[token]; // Identify the corresponding condition row\n operandsStack.push({ condition: conditionRow }); // Push it even if null so that the conversion goes on smoothly and identifies any other issues\n if (!conditionRow) {\n labelsWithNoRows.push(token); // Mark it as missing\n } else {\n usedLabels.push(token); // Mark it as used\n }\n } else if (token === NOT) {\n // If it's the NOT operator\n // Pop an operand, perform the operation and push the result back to the stack\n const operand = operandsStack.pop()!;\n operandsStack.push({ NOT: operand });\n } else {\n // If it's the AND/OR operator\n // Pop two operands, perform the operation and push the result back to the stack\n const operand2 = operandsStack.pop()!;\n const operand1 = operandsStack.pop()!;\n\n // If the inner operation is the same as the current one, consolidate them\n // e.g. `1 AND (2 AND 3)` should be consolidated as `1 AND 2 AND 3`\n // e.g. `1 OR (2 OR 3)` should be consolidated as `1 OR 2 OR 3`\n if (token === 'AND') {\n const operands = [\n ...(hasProp(operand1, 'AND') ? operand1.AND : [operand1]),\n ...(hasProp(operand2, 'AND') ? operand2.AND : [operand2])\n ];\n operandsStack.push({ AND: operands });\n } else {\n const operands = [\n ...(hasProp(operand1, 'OR') ? operand1.OR : [operand1]),\n ...(hasProp(operand2, 'OR') ? operand2.OR : [operand2])\n ];\n operandsStack.push({ OR: operands });\n }\n }\n });\n\n // If any labels are used for which there are no corresponding condition-rows\n if (labelsWithNoRows.length > 0) {\n if (labelsWithNoRows.length === 1) {\n return {\n error: `Condition ${labelsWithNoRows[0]} used in the logical string is not defined.` // FIXME: TR\n };\n }\n return {\n error: `Conditions ${labelsWithNoRows.join(', ')} used in the logical string are not defined.` // FIXME: TR\n };\n }\n\n // Warn if any of the condition rows are unused\n if (!ignoreUnusedLabels) {\n const unusedLabels = Object.keys(conditionLookup).filter(l => !usedLabels.includes(l));\n if (unusedLabels.length > 0) {\n if (unusedLabels.length === 1) {\n return { error: `Condition ${unusedLabels[0]} is not used in the logic expression.` }; // FIXME: TR\n }\n return {\n error: `Conditions ${unusedLabels.join(', ')} are not used in the logic expression.` // FIXME: TR\n };\n }\n }\n\n return { condition: operandsStack[0] };\n}\n\n/** Parses a logic-expression into a condition object. */\nexport function parseLogicString(\n expression: string,\n conditionLookup: { [label: string]: LeafCondition }, // To look up condition-rows from the labels\n disallowNOT: boolean = false,\n ignoreUnusedLabels: boolean = false\n): { condition: Condition } | { error: string } {\n // Handle empty expressions\n if (!expression.trim().length) return { error: 'Please provide a logic expression.' }; // FIXME: TR\n\n // Split the expression into individual tokens\n const tokeningResult = tokenizeExpression(expression, disallowNOT);\n if (hasProp(tokeningResult, 'error')) return tokeningResult;\n const { tokens } = tokeningResult;\n\n // Capture any invalid/unexpected token patterns\n // NOTE: This doesn't handle mismatched parentheses. That is handled below in getPostfixFromInfix\n const badPatternError = findInvalidPatterns(tokens);\n if (badPatternError !== null) return { error: badPatternError };\n\n // Convert the Infix tokens to a Postfix notation using the ShuntingYard algorithm\n const postfixResult = getPostfixFromInfix(tokens);\n if (hasProp(postfixResult, 'error')) return postfixResult;\n const { postfixArr } = postfixResult;\n\n // Convert the Postfix token to a Condition tree\n return getConditionFromPostfix(postfixArr, conditionLookup, ignoreUnusedLabels);\n}\n\n/**\n * Takes a valid logic string and formats it with parentheses at appropriate places to keep things unambiguous\n * For example, `1 AND 2 OR 3` is disambiguated as `(1 AND 2) OR 3`\n * NOTE: This expects only valid logic strings to be passed as an input\n */\nexport function disambiguateLogic(expression: string): string {\n // Split the expression into individual tokens\n const tokeningResult = tokenizeExpression(expression);\n const { tokens } = tokeningResult as { tokens: string[] }; // Only valid expressions are expected as inputs\n\n // Convert the Infix tokens to a Postfix notation using the ShuntingYard algorithm\n const postfixResult = getPostfixFromInfix(tokens);\n const { postfixArr } = postfixResult as { postfixArr: string[] };\n\n // Convert the postfix back to infix with parentheses at appropriate places\n // To learn more about the below algorithm, refer this: https://brilliant.org/wiki/shunting-yard-algorithm/#reverse-polish\n const operandsStack: string[] = [];\n postfixArr.forEach(token => {\n if (isIntegerToken(token)) {\n // If it's a numeric token (leaf condition), push it to the stack\n operandsStack.push(token);\n } else if (token === NOT) {\n // If it's the NOT operator\n // Pop an operand, perform the operation and push the result back to the stack\n const operand = operandsStack.pop()!;\n operandsStack.push(`NOT ${operand}`);\n } else {\n // If it's the AND/OR operator\n // Pop two operands, perform the operation and push the result back to the stack\n let operand2 = operandsStack.pop()!;\n let operand1 = operandsStack.pop()!;\n\n // If the inner operation is the same as the current one, consolidate them\n // e.g. `1 AND (2 AND 3)` should be consolidated as `1 AND 2 AND 3`\n // e.g. `1 OR (2 OR 3)` should be consolidated as `1 OR 2 OR 3`\n if (token === 'AND') {\n // Remove any wrapping parentheses if an operand contains just AND(s)\n if (operand1.startsWith(LPAREN) && !operand1.includes(OR) && !operand1.includes(NOT)) {\n operand1 = operand1.slice(1, -1);\n }\n if (operand2.startsWith(LPAREN) && !operand2.includes(OR) && !operand2.includes(NOT)) {\n operand2 = operand2.slice(1, -1);\n }\n operandsStack.push(`(${operand1} AND ${operand2})`);\n } else {\n // Remove any wrapping parentheses if an operand contains just OR(s)\n if (operand1.startsWith(LPAREN) && !operand1.includes(AND) && !operand1.includes(NOT)) {\n operand1 = operand1.slice(1, -1);\n }\n if (operand2.startsWith(LPAREN) && !operand2.includes(AND) && !operand2.includes(NOT)) {\n operand2 = operand2.slice(1, -1);\n }\n operandsStack.push(`(${operand1} OR ${operand2})`);\n }\n }\n });\n\n // If the root node is AND/OR, there will be extra parentheses. Remove them\n let outputLogic = operandsStack[0];\n if (outputLogic.startsWith(LPAREN) && outputLogic.endsWith(RPAREN)) {\n outputLogic = outputLogic.slice(1, -1);\n }\n return outputLogic;\n}\n\n/**\n * Recursively splits the input condition node into a logic-string and a list of condition-rows\n * NOTE: Returns an empty string and an empty array if the condition is malformed\n */\nfunction splitConditionNode(\n node: Condition,\n labelsSoFar: string[]\n): { logic: string; rows: ConditionRow[] } {\n // Using a try-catch block for safety against any malformed conditions\n try {\n let logic: string;\n const rows: ConditionRow[] = [];\n\n if (hasProp(node, 'AND')) {\n const childStrings: string[] = [];\n node.AND.forEach(n => {\n const splitResult = splitConditionNode(n, labelsSoFar); // Recursively get child rows and logic\n childStrings.push(splitResult.logic);\n rows.push(...splitResult.rows);\n });\n logic = `(${childStrings.join(' AND ')})`;\n } else if (hasProp(node, 'OR')) {\n const childStrings: string[] = [];\n node.OR.forEach(n => {\n const splitResult = splitConditionNode(n, labelsSoFar); // Recursively get child rows and logic\n childStrings.push(splitResult.logic);\n rows.push(...splitResult.rows);\n });\n logic = `(${childStrings.join(' OR ')})`;\n } else if (hasProp(node, 'NOT')) {\n const splitResult = splitConditionNode(node.NOT, labelsSoFar); // Recursively get child rows and logic\n logic = `NOT ${splitResult.logic}`;\n rows.push(...splitResult.rows);\n } else {\n // If leaf-level is reached\n const newLabel = `${labelsSoFar.length + 1}`; // Get a new label for the node\n labelsSoFar.push(newLabel); // Update for the next time\n logic = newLabel;\n rows.push({ ...node.condition, label: newLabel, id: createUID() });\n }\n\n return { logic, rows };\n } catch {\n return { logic: '', rows: [] }; // For safety against any malformed conditions\n }\n}\n\n// Splitter for internal consumption\n/** Splits the input condition tree into a logic-string and a list of condition-rows */\nexport function splitConditionForBuilder(tree: Condition): { logic: string; rows: ConditionRow[] } {\n // Recursively split the tree, starting at the root node\n const splitResult = splitConditionNode(tree, []);\n\n // If the root node is AND/OR, there will be extra parentheses. Remove them\n if (splitResult.logic.startsWith(LPAREN) && splitResult.logic.endsWith(RPAREN)) {\n splitResult.logic = splitResult.logic.slice(1, -1);\n }\n\n return splitResult;\n}\n\n// Splitter for public consumption\n/** Converts the input nested condition into a flat tree with the leaf-conditions and a logic string representing the input tree */\nexport function splitConditionTree(\n tree: Condition,\n labelPrefix: string = ''\n): { logic: string; conditions: { [label: string]: LeafCondition } } {\n // Split using the internal splitter\n const { logic, rows } = splitConditionForBuilder(tree);\n\n // Build a condition-lookup from the ConditionRow objects\n const conditionLookup: { [label: string]: LeafCondition } = {};\n rows.forEach(row => {\n const { id, label, ...leaf } = row; // Discard the excess properties set up by ConditionRow when extending LeafCondition interface\n conditionLookup[`${labelPrefix}${label}`] = leaf;\n });\n\n // Prepend labelPrefix to all numeric tokens in the logic\n let outputLogic = logic;\n if (labelPrefix !== '') {\n outputLogic = logic.replace(/\\d+/g, `${labelPrefix}$&`);\n }\n\n return { logic: outputLogic, conditions: conditionLookup };\n}\n\n/** Checks if the input Condition is simple enough to be displayed in the `Basic mode` without loss of information */\nexport function isBasicModeApplicable(condition: Condition): boolean {\n // If an OR condition is present at the outer level,\n // each child should either be a leaf condition or an AND with all leaf nodes inside\n if (hasProp(condition, 'OR')) {\n return condition.OR.every(node => {\n if (hasProp(node, 'condition')) {\n return true;\n }\n if (hasProp(node, 'AND')) {\n return node.AND.every(subNode => hasProp(subNode, 'condition'));\n }\n return false;\n });\n }\n // If an AND condition is present at the outer level, it can't have any nested levels\n if (hasProp(condition, 'AND')) {\n return condition.AND.every(node => hasProp(node, 'condition'));\n }\n // NOT operator is not supported in Basic-mode\n // eslint-disable-next-line sonarjs/prefer-single-boolean-return\n if (hasProp(condition, 'NOT')) {\n return false;\n }\n // If a single leaf condition is present at the outer level\n return true;\n}\n\n/** Returns a list of operators to show in the Basic mode, using a logicString as the input */\nexport function getBasicModeOperators(logic: string): ('AND' | 'OR')[] {\n const matches = logic.match(/(AND|OR)/g);\n if (matches === null) {\n return [];\n }\n return matches as ('AND' | 'OR')[];\n}\n\n/** Takes a list of operators from between the Basic mode rows and constructs a logic-string out of them */\nexport function getLogicFromBasicMode(operatorsList: ('AND' | 'OR')[]): string {\n const logicString = operatorsList.reduce((logic, op, i) => `${logic} ${op} ${i + 2}`, '1');\n return disambiguateLogic(logicString); // Disambiguating the logic string by placing parentheses at appropriate places\n}\n\n/** Takes a list of objects and id of the object to be found and recursively finds and returns the object */\nexport function getItem(items: Field[], id: string): Field | undefined {\n let found: Field | undefined;\n items.some(item => {\n if (item.id === id) {\n found = item;\n return true;\n }\n\n if (hasProp(item, 'items')) {\n found = getItem(item.items, id);\n return !!found;\n }\n\n return false;\n });\n\n return found;\n}\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { default } from './ConditionBuilder';
|
|
2
|
-
export type { default as ConditionBuilderProps, Condition, DateFunctionsByType, Field, LeafCondition, ValueSelection } from './ConditionBuilder.types';
|
|
3
|
-
export { default as FieldCondition } from './FieldCondition';
|
|
4
|
-
export type { default as FieldConditionProps } from './FieldCondition.types';
|
|
5
|
-
export { default as evaluateCondition } from './core/evaluator';
|
|
6
|
-
export { default as formatCondition, formatRelativeDate } from './core/formatter';
|
|
7
|
-
export { default as transformComplexCondition } from './core/transformer';
|
|
8
|
-
export type { ComparatorsByType, RHSType } from './core/types';
|
|
9
|
-
export { splitConditionTree, parseLogicString } from './core/utils';
|
|
10
|
-
export { default as AtomicCondition, getInitConditionForLhs, isValidCondition } from './AtomicCondition';
|
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ConditionBuilder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,YAAY,EACV,OAAO,IAAI,qBAAqB,EAChC,SAAS,EACT,mBAAmB,EACnB,KAAK,EACL,aAAa,EACb,cAAc,EACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,YAAY,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,YAAY,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { default } from './ConditionBuilder';
|
|
2
|
-
export { default as FieldCondition } from './FieldCondition';
|
|
3
|
-
export { default as evaluateCondition } from './core/evaluator';
|
|
4
|
-
export { default as formatCondition, formatRelativeDate } from './core/formatter';
|
|
5
|
-
export { default as transformComplexCondition } from './core/transformer';
|
|
6
|
-
export { splitConditionTree, parseLogicString } from './core/utils';
|
|
7
|
-
export { default as AtomicCondition, getInitConditionForLhs, isValidCondition } from './AtomicCondition';
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ConditionBuilder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAS7C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC","sourcesContent":["export { default } from './ConditionBuilder';\nexport type {\n default as ConditionBuilderProps,\n Condition,\n DateFunctionsByType,\n Field,\n LeafCondition,\n ValueSelection\n} from './ConditionBuilder.types';\nexport { default as FieldCondition } from './FieldCondition';\nexport type { default as FieldConditionProps } from './FieldCondition.types';\nexport { default as evaluateCondition } from './core/evaluator';\nexport { default as formatCondition, formatRelativeDate } from './core/formatter';\nexport { default as transformComplexCondition } from './core/transformer';\nexport type { ComparatorsByType, RHSType } from './core/types';\nexport { splitConditionTree, parseLogicString } from './core/utils';\nexport {\n default as AtomicCondition,\n getInitConditionForLhs,\n isValidCondition\n} from './AtomicCondition';\n"]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { FunctionComponent } from 'react';
|
|
2
|
-
import { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
-
import type { ConditionInputProps } from './ConditionInput.types';
|
|
4
|
-
declare const ConditionInput: FunctionComponent<ConditionInputProps & ForwardProps>;
|
|
5
|
-
export default ConditionInput;
|
|
6
|
-
//# sourceMappingURL=ConditionInput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConditionInput.d.ts","sourceRoot":"","sources":["../../../src/components/ConditionInput/ConditionInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAEf,OAAO,EAGL,YAAY,EAab,MAAM,yBAAyB,CAAC;AAsBjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AA+ClE,QAAA,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CA4ezE,CAAC;AAEF,eAAe,cAAc,CAAC"}
|