@fw-components/formula-editor 2.0.7-formula-editor.12 → 2.0.7-formula-editor.14
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.
|
@@ -185,6 +185,11 @@ let FormulaEditor = class FormulaEditor extends LitElement {
|
|
|
185
185
|
this._recommendations = null;
|
|
186
186
|
this.requestUpdate();
|
|
187
187
|
}
|
|
188
|
+
handleFocus(e) {
|
|
189
|
+
if (!this.content.trim()) {
|
|
190
|
+
this._recommendations = Array.from(this.variables.keys());
|
|
191
|
+
}
|
|
192
|
+
}
|
|
188
193
|
render() {
|
|
189
194
|
return html `
|
|
190
195
|
<style>
|
|
@@ -206,6 +211,7 @@ let FormulaEditor = class FormulaEditor extends LitElement {
|
|
|
206
211
|
@input=${this.handleChange}
|
|
207
212
|
@keydown=${this.handleKeyboardEvents}
|
|
208
213
|
@blur=${this.handleFocusOut}
|
|
214
|
+
@focus=${this.handleFocus}
|
|
209
215
|
></div>
|
|
210
216
|
${this._recommendations
|
|
211
217
|
? html ` <suggestion-menu
|
|
@@ -177,6 +177,11 @@ export class Parser {
|
|
|
177
177
|
previousToken = token;
|
|
178
178
|
currentTokens += token;
|
|
179
179
|
});
|
|
180
|
+
if (recommendation) {
|
|
181
|
+
parseOutput.newCursorPosition = Math.min(parseOutput.newCursorPosition +
|
|
182
|
+
recommendation.length, formula.length + recommendation.length);
|
|
183
|
+
formattedString = `${formattedString}<span class="wysiwygInternals">${recommendation}</span>`;
|
|
184
|
+
}
|
|
180
185
|
// If the formula ends with a mathematical operator, or has unclosed `(`
|
|
181
186
|
if (this.mathematicalOperators.has(previousToken)) {
|
|
182
187
|
// parseOutput.errorString = "Unexpected ending of formula.";
|
|
@@ -216,6 +221,7 @@ export class Parser {
|
|
|
216
221
|
parsedTokens.push(token);
|
|
217
222
|
}
|
|
218
223
|
previousToken = token;
|
|
224
|
+
currentTokens += token;
|
|
219
225
|
}
|
|
220
226
|
/**
|
|
221
227
|
* Shunting Yard Algorithm (EW Dijkstra)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fw-components/formula-editor",
|
|
3
|
-
"version": "2.0.7-formula-editor.
|
|
3
|
+
"version": "2.0.7-formula-editor.14",
|
|
4
4
|
"description": "A WYSIWYG type formula editor",
|
|
5
5
|
"main": "dist/formula-editor/src/formula-builder.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"@types/big.js": "^6.1.6",
|
|
26
26
|
"es-dev-server": "^2.1.0"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "2dc58c17d6ead375305a45c5e254be86da0d81b3"
|
|
29
29
|
}
|