@fw-components/formula-editor 2.2.1-fw-localize.0 → 2.3.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.
|
@@ -90,11 +90,11 @@ export class Parser {
|
|
|
90
90
|
* Unknown symbol/variable/word
|
|
91
91
|
*/
|
|
92
92
|
if (!(isNumber || isOperator || isBracket || isSpace)) {
|
|
93
|
-
parseOutput.errorString = `${this.variableType} : '${token}'
|
|
93
|
+
parseOutput.errorString = `${this.variableType} : '${token}' doesn't exist.`;
|
|
94
94
|
expectation = Expectation.UNDEFINED;
|
|
95
95
|
}
|
|
96
96
|
else if (this.allowedOperators.has(previousToken) && isOperator) {
|
|
97
|
-
parseOutput.errorString = `Please use ${
|
|
97
|
+
parseOutput.errorString = `Please don't use mathematical operators (${Array.from(this.allowedOperators).join(" ")}) consecutively.`;
|
|
98
98
|
expectation = Expectation.UNDEFINED;
|
|
99
99
|
}
|
|
100
100
|
else if (parentheses.isEmpty() && token === ")") {
|
|
@@ -107,28 +107,28 @@ export class Parser {
|
|
|
107
107
|
*/
|
|
108
108
|
else if (expectation === Expectation.VARIABLE && !isNumber && !isSpace && token != "("
|
|
109
109
|
&& !((unaryOperators.includes(token)) && (!parsedString.trim() || previousToken === "(" || this.allowedOperators.has(previousToken)))) {
|
|
110
|
-
parseOutput.errorString = `Please use ${this.variableType}${this.allowedNumbers ? " or numbers" : ""} after '${previousToken}'.`;
|
|
110
|
+
parseOutput.errorString = `Please use ${this.variableType} ${this.variableType && this.allowedNumbers ? " or " : ''} ${this.allowedNumbers ? "numbers" : ""} after '${previousToken}'.`;
|
|
111
111
|
expectation = Expectation.UNDEFINED;
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
114
|
* Multiple number/variable together without operator
|
|
115
115
|
*/
|
|
116
116
|
else if (expectation === Expectation.OPERATOR && !isOperator && !isSpace && token != ")") {
|
|
117
|
-
parseOutput.errorString = `Please use
|
|
117
|
+
parseOutput.errorString = `Please use mathematical operators (${Array.from(this.allowedOperators).join(" ")}) after '${previousToken}'.`;
|
|
118
118
|
expectation = Expectation.UNDEFINED;
|
|
119
119
|
}
|
|
120
120
|
/**
|
|
121
121
|
* division by zero
|
|
122
122
|
*/
|
|
123
123
|
else if (isNumber && previousToken === "/" && (this.variables.get(token) === 0 || Number(token) === 0)) {
|
|
124
|
-
parseOutput.errorString = `Division by zero is not possible
|
|
124
|
+
parseOutput.errorString = `Division by zero is not possible.`;
|
|
125
125
|
expectation = Expectation.UNDEFINED;
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
128
|
* Empty brackets
|
|
129
129
|
*/
|
|
130
130
|
else if (previousToken === "(" && token === ")") {
|
|
131
|
-
parseOutput.errorString = `
|
|
131
|
+
parseOutput.errorString = `Please don't use empty brackets ().`;
|
|
132
132
|
expectation = Expectation.UNDEFINED;
|
|
133
133
|
}
|
|
134
134
|
}
|
|
@@ -161,7 +161,7 @@ export class Parser {
|
|
|
161
161
|
parseOutput.recommendations = !parseOutput.errorString?.length ? Array.from(this.variables.keys()) : [];
|
|
162
162
|
}
|
|
163
163
|
if (this.allowedOperators.has(previousToken)) {
|
|
164
|
-
parseOutput.errorString = `
|
|
164
|
+
parseOutput.errorString = `Please don't use mathematical operators (${Array.from(this.allowedOperators).join(" ")}) at the end.`;
|
|
165
165
|
}
|
|
166
166
|
if (!parentheses.isEmpty()) {
|
|
167
167
|
parseOutput.errorString = "Unexpected opening bracket. Make sure all closing brackets ')' have matching opening brackets '('.";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fw-components/formula-editor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "A WYSIWYG type formula editor",
|
|
5
5
|
"main": "dist/formula-editor/src/formula-editor.js",
|
|
6
6
|
"exports": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"prepublishOnly": "npm run build"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fw-components/styles": "^2.
|
|
22
|
+
"@fw-components/styles": "^2.3.1",
|
|
23
23
|
"big.js": "^6.2.1",
|
|
24
24
|
"lit": "^2.1.2",
|
|
25
25
|
"match-sorter": "^8.0.0",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"@types/big.js": "^6.1.6",
|
|
32
32
|
"es-dev-server": "^2.1.0"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "f563fb5a8936a1767f930a8d98a0fe686e963293"
|
|
35
35
|
}
|