@fw-components/formula-editor 2.2.1-formula-error-typo-fixes.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -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}' does not exist`;
|
|
94
94
|
expectation = Expectation.UNDEFINED;
|
|
95
95
|
}
|
|
96
96
|
else if (this.allowedOperators.has(previousToken) && isOperator) {
|
|
97
|
-
parseOutput.errorString = `Please
|
|
97
|
+
parseOutput.errorString = `Please use ${this.variableType}${this.allowedNumbers ? " or numbers" : ""} after '${previousToken}'. Pls do not use consecutive two mathametical operators (+ - * / ^)`;
|
|
98
98
|
expectation = Expectation.UNDEFINED;
|
|
99
99
|
}
|
|
100
100
|
else if (parentheses.isEmpty() && token === ")") {
|
|
@@ -107,14 +107,14 @@ 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}
|
|
110
|
+
parseOutput.errorString = `Please use ${this.variableType}${this.allowedNumbers ? " or 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 mathametical operators (${Array.from(this.allowedOperators).join(" ")}) after '${previousToken}'.`;
|
|
118
118
|
expectation = Expectation.UNDEFINED;
|
|
119
119
|
}
|
|
120
120
|
/**
|
|
@@ -128,7 +128,7 @@ export class Parser {
|
|
|
128
128
|
* Empty brackets
|
|
129
129
|
*/
|
|
130
130
|
else if (previousToken === "(" && token === ")") {
|
|
131
|
-
parseOutput.errorString = `
|
|
131
|
+
parseOutput.errorString = `Pls do not 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 = `Pls do not use mathametical 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.0",
|
|
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.0",
|
|
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": "8d6a4d40e1207f2f71368aa140af51d134755508"
|
|
35
35
|
}
|