@fw-components/formula-editor 2.3.1 → 2.3.2-formula-editor-regex-fix.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.
|
@@ -49,10 +49,13 @@ let FormulaEditor = class FormulaEditor extends LitElement {
|
|
|
49
49
|
this.parseInput();
|
|
50
50
|
}
|
|
51
51
|
_adjustTextAreaHeight() {
|
|
52
|
-
|
|
52
|
+
requestAnimationFrame(() => {
|
|
53
|
+
if (!this.editor)
|
|
54
|
+
return;
|
|
53
55
|
this.editor.style.height = "var(--fe-height, 30px)";
|
|
54
|
-
|
|
55
|
-
this.editor.style.height =
|
|
56
|
+
const newHeight = this.editor.scrollHeight;
|
|
57
|
+
this.editor.style.height = `${newHeight + 5}px`;
|
|
58
|
+
});
|
|
56
59
|
}
|
|
57
60
|
/**
|
|
58
61
|
* @param recommendation The recommendation which needs to be inserted
|
|
@@ -109,7 +112,7 @@ let FormulaEditor = class FormulaEditor extends LitElement {
|
|
|
109
112
|
if (event.code === "Tab") {
|
|
110
113
|
event.preventDefault();
|
|
111
114
|
if (this.recommendations?.length === 1) {
|
|
112
|
-
this.suggestionMenu.handleRecommendationSelect();
|
|
115
|
+
this.suggestionMenu.handleRecommendationSelect(0);
|
|
113
116
|
}
|
|
114
117
|
else {
|
|
115
118
|
const direction = event.shiftKey ? "up" : "down";
|
|
@@ -121,10 +124,6 @@ let FormulaEditor = class FormulaEditor extends LitElement {
|
|
|
121
124
|
const direction = event.code === "ArrowDown" ? "down" : "up";
|
|
122
125
|
this.suggestionMenu.navigate(direction);
|
|
123
126
|
}
|
|
124
|
-
else if (event.code === "Enter") {
|
|
125
|
-
event.preventDefault();
|
|
126
|
-
this.suggestionMenu.handleRecommendationSelect();
|
|
127
|
-
}
|
|
128
127
|
}
|
|
129
128
|
render() {
|
|
130
129
|
return html `
|
|
@@ -6,7 +6,7 @@ import { Expectation } from "../types";
|
|
|
6
6
|
import { operatorPrecedence, unaryOperators, mathematicalOperators } from "./constants.js";
|
|
7
7
|
import { getFormulaTokens } from "./get-formula-tokens.js";
|
|
8
8
|
export class Parser {
|
|
9
|
-
constructor(variables, minSuggestionLen, formulaRegex = /[A-Za-z0-9_
|
|
9
|
+
constructor(variables, minSuggestionLen, formulaRegex = /[A-Za-z0-9_#@.]+|[-+(),*^/\s]/g, allowedNumbers = true, allowedOperators = mathematicalOperators, variableType = "") {
|
|
10
10
|
this.variables = variables;
|
|
11
11
|
this.formulaRegex = formulaRegex;
|
|
12
12
|
this._recommender = new Recommender(Array.from(this.variables.keys()), minSuggestionLen);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fw-components/formula-editor",
|
|
3
|
-
"version": "2.3.1",
|
|
3
|
+
"version": "2.3.2-formula-editor-regex-fix.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.3.
|
|
22
|
+
"@fw-components/styles": "^2.3.2-formula-editor-regex-fix.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": "0bd51838c74b79e3909b2380ce28fc188c20a420"
|
|
35
35
|
}
|